-
Notifications
You must be signed in to change notification settings - Fork 74
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
chore(sdk): Update passkeys documentation #649
base: development
Are you sure you want to change the base?
Conversation
Branch preview✅ Deployed successfully in branch deployment: |
Overall readability score: 32.41 (🟢 +0.02)
View detailed metrics🟢 - Shows an increase in readability
Averages:
View metric targets
|
@@ -1081,3 +1081,32 @@ const signedMessage = await protocolKit.signMessage(signedMessage, SigningMethod | |||
const signedMessage = await protocolKit.signMessage(signedMessage, SigningMethod.ETH_SIGN) | |||
const signedMessage = await protocolKit.signMessage(signedMessage, SigningMethod.SAFE_SIGNATURE, parentSafeAddress). | |||
``` | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yagopv be careful, I see the development
branch doesn't contain the latest changes. I will merge them.
The Protocol Kit reference is now split in many different files (check it here: https://docs.safe.global/reference-sdk-protocol-kit/overview) so a new "Passkeys" entry should be added to the reference with the new function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just rebased the developement
branch with the latest changes from main
|
||
{/* <!-- vale on --> */} | ||
|
||
</Steps> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
</Steps> | |
</Steps> |
|
||
### Get the provider and signer | ||
|
||
Once the passkey is created, you can get the `provider` and `signer`, which is the externally-owned account of the user that was derived from its credentials. | ||
Once the passkey is created, you need the `provider` and `signer` props that the Safe\{Core\} SDK require to instantiate the kits. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once the passkey is created, you need the `provider` and `signer` props that the Safe\{Core\} SDK require to instantiate the kits. | |
Once the passkey is created, you need the `provider` and `signer` properties required to instantiate the Safe\{Core\} SDK kits. |
The `provider` (eip1193 compatible or rpc) can be obtained by using `viem` in several ways: | ||
{/* <!-- vale off --> */} | ||
|
||
<Tabs items={['viem']}> | ||
<Tabs items={['eip1193', 'rpcUrl']}> | ||
<Tabs.Tab> | ||
You can instantiate the provider using `viem` and the following imports: | ||
|
||
```typescript | ||
import { createWalletClient, http } from 'viem' | ||
import { sepolia } from 'viem/chains' | ||
``` | ||
```typescript | ||
import { createWalletClient, http } from 'viem' | ||
import { sepolia } from 'viem/chains' | ||
|
||
```typescript | ||
const provider = createWalletClient({ | ||
chain: sepolia, | ||
transport: http('https://rpc.ankr.com/eth_sepolia') | ||
}) | ||
const walletClient = createWalletClient({ | ||
chain: sepolia, | ||
transport: http('https://rpc.ankr.com/eth_sepolia') | ||
}) | ||
|
||
const signer = passkey | ||
const provider = { request: walletClient.request } | ||
const signer = passkeySigner | ||
``` | ||
</Tabs.Tab> | ||
<Tabs.Tab> | ||
```typescript | ||
import { sepolia } from 'viem/chains' | ||
|
||
const provider = sepolia.rpcUrls.default.http[0] | ||
const signer = passkeySigner | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is out of scope for this PR.
The used provider
is just an example to provide to the kits, all the different ways to create it are covered in the reference here: https://docs.safe.global/reference-sdk-protocol-kit/initialization/init#provider
In fact, I think the provider
could also be reemoved as this is just about the generating the signer
. This also applies to all the Safe Signers guides, so I think it's out of scope for this PR.
We are updating the passkeys guide and protocol-kit reference section after implementing compatibility with React Native