Skip to content

Commit

Permalink
docs: adapt web-wallet diagram to tari-connector changes (tari-projec…
Browse files Browse the repository at this point in the history
…t#696)

Description
---
Updated the web-wallet sequence diagram to reflect the latest
`tari-connector` changes

Motivation and Context
---
Recently there has been some major changes to the way `tari-connector`
operates:
* tari-project/tari-connector#9
* tari-project/tari-connector#10

The goal of this PR is to update the sequence diagram of the web-wallet
interaction to reflect the new flow.

How Has This Been Tested?
---
Testing does not apply

What process can a PR reviewer use to test or verify this change?
---
Check that the sequence diagram is accurate

Breaking Changes
---
- [x] None
- [ ] Requires data directory to be deleted
- [ ] Other - Please specify
  • Loading branch information
mrnaveira committed Sep 14, 2023
1 parent e29fdb3 commit 97115c4
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions docs/wallet_sequence_diagram.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,28 @@ TariConnector->>TariConnector: Create and store webRTC offer in memory (hashmap)
TariConnector->>User: Show QR that contains the JWT
User->>User: Copy JWT to clipboard
note right of User: The user switchs tabs to go to the Wallet UI
User->>WalletUI: User clicks "Connect" button with the JWT in the clipboard
WalletUI->>User: Displays modal to review the requested permissions
User->>WalletUI: User accepts the permissions
WalletUI->>WalletDaemon: webrtc.start(JWT)
WalletDaemon->>WalletDaemon: Check that the caller has the StartWebrtc permission
WalletDaemon->>WalletDaemon: Parse the JWT, extract permissions and generate a wallet JWT
WalletDaemon->>WalletDaemon: Spawn tokio task to handle the WebRTC channel
User->>TariConnector: User clicks "SetAnswer" button
TariConnector->>SignalingServer: getAnswer
TariConnector->>SignalingServer: getIceCandidates
TariConnector->>TariConnector: create the data channel with the Ice candidates
loop Polling every 2 seconds until we get the ICE candidates
TariConnector->>SignalingServer: Try getting the ICE candidates for the wallet daemon
end
TariConnector->>TariConnector: Ceate the WebRTC data channel with the ICE candidates
TariConnector->>WalletDaemon: Call special method "get.token" via the WebRTC channel
WalletDaemon->>TariConnector: Wallet's JWT
TariConnector->>User: Invoke the "onConnect" callback defined by the client web
note right of User: At this point the user/web can do any request to the wallet daemon via "sendMessage"
User->>TariConnector: sendMessage(walletDaemonMethod, JWT, args)
User->>TariConnector: sendMessage(walletDaemonMethod, wallet's JWT, args)
TariConnector->>TariConnector: generate a new messageId = previousMessageId + 1
TariConnector->>WalletDaemon: WebRTC messaging with the user request
WalletDaemon->>WalletDaemon: The wallet JWT is auto-injected (via callback) to the incoming message
WalletDaemon->>WalletDaemon: Calling the requested wallet JSON RPC method and getting the response
WalletDaemon->>TariConnector: WebRTC messaging with the response
TariConnector->>User: response
Expand Down

0 comments on commit 97115c4

Please sign in to comment.