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

chore(sdk): Update passkeys documentation #649

Open
wants to merge 6 commits into
base: development
Choose a base branch
from

Conversation

yagopv
Copy link
Member

@yagopv yagopv commented Nov 25, 2024

⚠️ Do not merge until SDK released ⚠️

We are updating the passkeys guide and protocol-kit reference section after implementing compatibility with React Native

Copy link

github-actions bot commented Nov 25, 2024

Branch preview

✅ Deployed successfully in branch deployment:

https://sdk_update_passkeys_guide--docs.review.5afe.dev

Copy link

github-actions bot commented Nov 25, 2024

Overall readability score: 32.41 (🟢 +0.02)

File Readability
safe.mdx 65.17 (🟢 +0.15)
passkeys.mdx 29.81 (🟢 +3.12)
View detailed metrics

🟢 - Shows an increase in readability
🔴 - Shows a decrease in readability

File Readability FRE GF ARI CLI DCRS
safe.mdx 65.17 41.46 7.72 12 13.15 5.96
  🟢 +0.15 🟢 +0.2 🟢 +0.03 🟢 +0.2 🟢 +0 🔴 -0.07
passkeys.mdx 29.81 37.78 16.89 21.6 11.44 8.29
  🟢 +3.12 🟢 +2.84 🟢 +0.84 🟢 +0.4 🔴 -0.4 🟢 +0.37

Averages:

  Readability FRE GF ARI CLI DCRS
Average 32.41 27.93 13.41 17.63 15.64 8.78
  🟢 +0.02 🟢 +0.02 🟢 +0 🟢 +0 🟢 +0 🟢 +0
View metric targets
Metric Range Ideal score
Flesch Reading Ease 100 (very easy read) to 0 (extremely difficult read) 60
Gunning Fog 6 (very easy read) to 17 (extremely difficult read) 8 or less
Auto. Read. Index 6 (very easy read) to 14 (extremely difficult read) 8 or less
Coleman Liau Index 6 (very easy read) to 17 (extremely difficult read) 8 or less
Dale-Chall Readability 4.9 (very easy read) to 9.9 (extremely difficult read) 6.9 or less

@yagopv yagopv changed the title chore(sdk): Update passkeys chore(sdk): Update passkeys documentation Nov 25, 2024
@yagopv yagopv linked an issue Nov 25, 2024 that may be closed by this pull request
@@ -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).
```

Copy link
Member

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.

Copy link
Member

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>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
</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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.

Comment on lines +116 to +140
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
```
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[React Native] Update docs
2 participants