generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add requestPermissionsForProtocol helper method to connect module (#854)
This PR adds a `requestPermissionsForProtocol` helper method to the Connect module. This helper method takes a protocol definition, as well as simple string representations of the permissions being requested, ie `write`, `read`, `delete`, `query` and `subscribe`. It will by default include the permissions also needed to sync a protocol's messages `MessagesRead`, `MessagesQuery` and `MessagesSubscribe`. #### Example: ```typescript // all permissions for each protocol const { delegateDid } = await Web5.connect({ walletConnectOptions: { walletUri: "web5://connect", connectServerUrl: "http://localhost:3000/connect", permissionRequests: [{ protocolDefinition: profileProtocol }], onWalletUriReady: generateQRCode, validatePin: async () => { goToPinScreen(); const pin = await waitForPin(); return pin; }, }, }); ``` ```typescript // specific permissions const { delegateDid } = await Web5.connect({ walletConnectOptions: { walletUri: "web5://connect", connectServerUrl: "http://localhost:3000/connect", permissionRequests: [{ definition: protocol1, permissions: ['read', 'write'] // creates read+write + sync grants },{ definition: protocol2, }], onWalletUriReady: generateQRCode, validatePin: async () => { goToPinScreen(); const pin = await waitForPin(); return pin; }, }, }); ``` --- This PR also makes `registerIdentity` options optional. If no options are provided all protocols are synced.
- Loading branch information
1 parent
fea0535
commit 4ff2316
Showing
12 changed files
with
422 additions
and
187 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@web5/agent": patch | ||
--- | ||
|
||
Add requestPermissionsForProtocol helper method to connect module |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.