Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mwa 2.0 spec #521

Merged
merged 15 commits into from
Sep 19, 2023
7 changes: 4 additions & 3 deletions spec/_diagrams/authorize_and_sign.plantuml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ activate Dapp
== Authorize for transaction signing ==

Dapp -> Dapp : <i>i</i> = DappIdentity()
Dapp -> Wallet ++-- : authorize {<i>i</i>, ["sign_transactions"]}
Dapp -> Dapp : <i>c</i> = "{namespace}:{chain_reference}"
Dapp -> Wallet ++-- : authorize {<i>i</i>, <i>c</i>}
Wallet -> Wallet : validate Dapp identity <i>i</i>
Wallet -> Wallet : Generate new auth token\n<i>at</i> = GenerateAuthToken(<i>i</i>, ["sign_transactions"])
Wallet -> Wallet : <i>pub</i> = base58encode(GetPublicKey())
Expand All @@ -29,8 +30,8 @@ Dapp -> Dapp : Store(<i>at</i>, <i>pub</i>, <i>uri</i>)
== Submit transaction for signing ==

Dapp -> Dapp : <i>t</i> = CreateTransaction(<i>pub</i>, ...)
Dapp -> Wallet ++-- : sign_transactions {<i>at</i>, <i>t</i>}
Wallet -> Wallet : validate auth token <i>at</i>
Dapp -> Wallet ++-- : sign_transactions {<i>t</i>}
Wallet -> Wallet : verify session is in authorized state
Wallet -> Wallet : validate transaction <i>t</i>
Wallet -> Wallet : sign transaction\n<i>st</i> = SignSolanaTransactions(<i>t</i>)
Wallet --> Dapp ++-- : response {<i>st</i>}
Expand Down
13 changes: 7 additions & 6 deletions spec/_diagrams/reauthorize_and_sign.plantuml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@ Dapp -> Dapp : <i>t</i> = CreateTransaction(<i>pub</i>, ...)

== Submit for signing with cached auth token ==

Dapp -> Wallet ++-- : sign_transactions {<i>at</i>, <i>t</i>}
Wallet -X Wallet : validate auth token <i>at</i>
Wallet --> Dapp ++-- : error {ERROR_REAUTHORIZE}
Dapp -> Wallet ++-- : sign_transactions {<i>t</i>}
Wallet -X Wallet : verify session is in authorized state
Wallet --> Dapp ++-- : error {ERROR_AUTHORIZATION_FAILED}

== Reauthorize ==

Dapp -> Dapp : <i>i</i> = DappIdentity()
Dapp -> Wallet ++-- : reauthorize {<i>i</i>, <i>at</i>}
Dapp -> Dapp : <i>c</i> = "{namespace}:{chain_reference}"
Dapp -> Wallet ++-- : authorize {<i>i</i>, <i>c</i>, <i>at</i>}
Wallet -> Wallet : validate Dapp identity <i>i</i> matches <i>at</i>
Wallet -> Wallet : Generate new auth token\n<i>at2</i> = RegenerateAuthToken(<i>i</i>, <i>at</i>)
Wallet -> Wallet : <i>pub</i> = base58encode(GetPublicKey())
Expand All @@ -37,8 +38,8 @@ Dapp -> Dapp : Store(<i>at2</i>, <i>pub</i>, <i>uri</i>)

== Resubmit for signing with new auth token ==

Dapp -> Wallet ++-- : sign_transactions(<i>at2</i>, <i>t</i>)
Wallet -> Wallet : validate auth token <i>at2</i>
Dapp -> Wallet ++-- : sign_transactions(<i>t</i>)
Wallet -> Wallet : verify session is in authorized state
Wallet -> Wallet : validate transaction <i>t</i>
Wallet -> Wallet : sign transaction\n<i>st</i> = SignSolanaTransactions(<i>t</i>)
Wallet --> Dapp ++-- : response(<i>st</i>)
Expand Down
Loading