Create sequence diagrams with simple online tool

Swimlanes.io is a free webapp for making sequence diagrams. You simply edit the text on the left and the diagram is updated in real time. You can download your sequence diagrams as images or distribute with a link.

title: Custom Auth Telegram Example User -> Web App: Clicks `Login with Telegram` button Web App -> Telegram OAuth API: Makes a request to get the user's authenticated Telegram account info Telegram OAuth API -> Web App: Returns authenticated Telegram user info User -> Web App: Clicks `Mint PKP` button Web App -> Browser Wallet Extension: Requests access to an Ethereum wallet Browser Wallet Extension -> Web App: Etherem signer Web App -> Lit Datil-test network: Initializes `LitContracts` client and connects to the Datil-test network Web App -> Web App: Generates Auth Method type and ID note: The Auth Method type is the `keccak256` hash of the string: `Lit Developer Guide Telegram Auth Example` The Auth Method ID is the `keccak256` hash of the string: `telegram:${telegramUser.id}` Web App -> Chronicle Yellowstone Blockchain: Fetches the PKP mint cost Web App -> Web App: Calculates the IPFS CID for the Telegram OAuth Lit Action Web App -> Browser Wallet Extension: Request user to sign and send a transaction to mint a PKP note: The transaction is calling the [mintNextAndAddAuthMethods](https://github.com/LIT-Protocol/lit-assets/blob/84521e4ab756c4bd2cf2e56ac614879862f8f3d2/blockchain/contracts/contracts/lit-node/PKPHelperV2.sol#L77-L81) method from the `PKPHelperV2` contract. As part of the minting PKP transaction, two Auth Methods are permitted for the PKP: 1. The IPFS CID of the Telegram OAuth Lit Action - Granted the ability to sign anything using the PKP 2. The custom Auth Method generated by the Web App previously - Not granted any signing abilities - Only used to tie the PKP to a specific Telegram user Browser Wallet Extension -> Chronicle Yellowstone Blockchain: Broadcasts signed mint PKP transaction Browser Wallet Extension -> Web App: Returns transaction receipt Web App -> Web App: Parses transaction receipt to get PKP `publicKey`, `tokenId`, and `ethAddress` Web App -> Chronicle Yellowstone Blockchain: Gets permitted Auth Methods for PKP and `console.log`s them User -> Web App: Clicks `Get Session Sigs` button Web App -> Web App: Checks if a Lit Capacity Credit token ID was provided as an ENV Web App -> Browser Wallet Extension: Request user to sign and send a transaction to mint a new Lit Capacity Credit (if one wasn't provided via ENV) Browser Wallet Extension -> Chronicle Yellowstone Blockchain: Broadcasts signed mint Lit Capacity Credit transaction Browser Wallet Extension -> Web App: Token ID of newly minted Lit Capacity Credit Web App -> Browser Wallet Extension: Requests user to sign a Capacity Credit Delegated Auth Sig note: The Datil-test network is a paid Lit network, meaning you must pay for usage of it via Capacity Credits. You can learn more about there [here](https://developer.litprotocol.com/paying-for-lit/overview). By signing the Capacity Credit Delegated Auth Sig, the User is authorizing the newly minted PKP to use the Capacity Credit to pay for the execution the Telegram OAuth Lit Action. Browser Wallet Extension -> Web App: Returns the signed Capacity Credit Delegated Auth Sig Web App -> Lit Datil-test network: Requests the Lit Datil-test network to generate Session Signatures using the previously minted PKP note: In this request the Web App is passing the Telegram OAuth Lit Action code as a [code string](https://developer.litprotocol.com/sdk/serverless-signing/deploying#deploying-using-a-code-string). Lit Datil-test network -> Lit nodes: Request to generate Session Signature share note: When each Lit node receives the request to generate it's Session Signature share, they will: 1. Compute the IPFS CID for the given Lit Action code string 2. Request the permitted Auth Methods for the PKP from the Chronicle Yellowstone Blockchain 3. Verify the IPFS CID is one of the permitted Auth Methods for the PKP 4. Execute the given Lit Action code Lit nodes -> Lit nodes: Execute provided Lit Action code note: The Lit Action does the following: 1. Parses and authenticates the provided Telegram user info is both valid and recent 2. Uses the provided Telegram user ID to generate the Auth Method ID 3. Calls the [isPermittedAuthMethod](https://github.com/LIT-Protocol/lit-assets/blob/84521e4ab756c4bd2cf2e56ac614879862f8f3d2/blockchain/contracts/contracts/lit-node/PKPPermissions/PKPPermissionsFacet.sol#L267-L281) method on the `PKPPermissionsFacet` contract to check if Auth Method type and ID are permitted to use the PKP (i.e. check if authenticated Telegram user is allowed to signed with the PKP) 4. If permitted, returns `true` signalling the Lit node to generate it's Session Signature share Lit nodes -> Web App: Returns Session Signature shares