w3up icon indicating copy to clipboard operation
w3up copied to clipboard

Signup flow

Open Gozala opened this issue 1 year ago • 2 comments

@travis wrote proposal here https://hackmd.io/@tvpl/SylEjddfp I have some thought around it but prefer to discuss those here instead of hackmd.

Gozala avatar Oct 27 '23 07:10 Gozala

I think we need to be very clear what is the change we are trying to make. Currently when user agent invokes provider/add capability using did:mailto resource (with field) and gives a not yet provisioned space did (nb.consumer field) we simply create a subscription for that did:mailto account and provision requested space.

Per spec provider gets to decide requirements agent needs to meet to grant provider, and while in the past it was just a proof that they have email address (hence requirement that with was did:mailto) now we also want them to provide card info (through stripe).

I think moving forward we probably need to let the provider/add go and instead embrace consumer/add, more specifically once account has billing setup and plan selected we can delegate to the account (did:mailto principal) consumer/add capability which they can then invoke to provision as many spaces as they choose.

In terms of flow this would make most sense to me:

First run

$ w3 authorize [email protected]
⠋ 🔗 please click the link we sent to [email protected] to authorize this agent
⁂ agent authorized to use capabilities delegated to [email protected]


## User clicks on link, and lands on confirmation page that arranges did:mailto to agent
## Same page also asks user to choose a plan that will take them through stipe flow

⁂ [email protected] now signed up!

$ w3 up example.txt
⁂ Selected space does not have a store provider, attempting to provision it

⁂ w3 space provision
⠋ please select a plan on https://console.web3.storage/plans
##  Agent polls for `consumer/add` capability in the background
## User picks a plan and enters card into stripe page
## Service delegates consumer/add capability to did:mailto principal
## Agent receives consumer/add capability and invokes it
⁂ Space is provisioned and ready for some uploads

1 file 2.4KB
⁂ Stored 1 file
⁂ https://w3s.link/ipfs/bafybeicabmosrxusohk6mx5573be7p7254veddqrerjiis6fkwbpolbg7q

Gozala avatar Oct 27 '23 08:10 Gozala

stateDiagram-v2

mnemonic: ⁂ Save this key 📜
verify: ⁂ Enter saved key
confirm_email: ⁂ Confirm by clicking link in email
state has_account <<choice>>


[*] --> mnemonic: > w3 create stuff
mnemonic --> verify
verify --> has_account: is authorized ?

has_account --> authorize_with: Yes
authorize_with: ⁂ Provision with [email protected] ?

state authorize_with_proceed <<choice>>
authorize_with --> authorize_with_proceed
authorize_with_proceed --> recovery: Yes
authorize_with_proceed --> [*]: No

has_account --> want_provision: No

want_provision: ⁂ Want to provision space ?
state want_provision_choice <<choice>>


want_provision --> want_provision_choice
want_provision_choice --> [*]: No
want_provision_choice --> authorize: Yes

authorize: ⁂ What is your email address ?
authorize --> authorization
authorization: > [email protected]
authorization --> confirm_email
confirm_email --> recovery

recovery: ⁂ Setup recovery with [email protected] ?

state recovery_choice <<choice>>

recovery --> recovery_choice

recovery_choice --> setup_default_recovery: Enter
recovery_choice --> done: Exit
recovery_choice --> setup_custom_recovery: [email protected]

setup_default_recovery: ⁂  Delegating access to [email protected]
setup_custom_recovery: ⁂  Delegating access to [email protected]

setup_default_recovery --> done
setup_custom_recovery --> done

done: ✨ Space is ready

from https://github.com/web3-storage/w3up/issues/945#issuecomment-1786507013

alanshaw avatar Nov 10 '23 19:11 alanshaw