Skip to content

clarify web3wallet signature verification #2236

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions docs/references/javascript/types/web3-wallet.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ The `Web3Wallet` object describes a Web3 wallet address. The address can be used

Web3 addresses must be verified to ensure that they can be assigned to their rightful owners. The verification is completed via Web3 wallet browser extensions, such as [Metamask](https://metamask.io/), [Coinbase Wallet](https://www.coinbase.com/wallet), and [OKX Wallet](https://www.okx.com/help/section/faq-web3-wallet). The `Web3Wallet3` object holds all the necessary state around the verification process.

The verification process always starts with the [`Web3Wallet.prepareVerification()`](/docs/references/javascript/types/web3-wallet#prepare-verification) or [`signIn.prepareFirstFactor()`](/docs/references/javascript/sign-in#prepare-first-factor) method, which will send the wallet address to the [Frontend API](/docs/reference/frontend-api){{ target: '_blank' }} and will receive a nonce that needs to be signed by the Web3 wallet browser extension.
The verification process always starts with the [`Web3Wallet.prepareVerification()`](/docs/references/javascript/types/web3-wallet#prepare-verification) or [`signIn.prepareFirstFactor()`](/docs/references/javascript/sign-in#prepare-first-factor) method, which will send the wallet address to Clerk's [Frontend API](/docs/reference/frontend-api){{ target: '_blank' }} and will receive a nonce that needs to be signed by the Web3 wallet browser extension. A signature is generated from the nonce and is returned in the `Verification.message` property of the returned `Web3Wallet` object.

The second and final step involves an attempt to complete the verification by calling [`Web3Wallet.attemptVerification()`](/docs/references/javascript/types/web3-wallet#attempt-verification) method, passing the generated signature as a parameter.
The second and final step involves an attempt to complete the verification by calling [`Web3Wallet.attemptVerification()`](/docs/references/javascript/types/web3-wallet#attempt-verification) method, passing the signature that was generated from the `prepareVerification()`method as a parameter.

## Properties

Expand Down Expand Up @@ -62,7 +62,7 @@ function toString(): string

## `prepareVerification()`

Kick off the verification process for this Web3 wallet. The user will be prompted to sign a generated nonce by the browser extension e.g MetaMask. Returns a `Web3Wallet` object.
Starts the verification process for the Web3 wallet. The user will be prompted to sign a generated nonce by the browser extension. Returns a `Web3Wallet` object **with the signature in the `Verification.message` property.** The signature should then be passed to the [`attemptVerification()`](#attempt-verification) method.

```typescript
function prepareVerification(params: PrepareWeb3WalletVerificationParams): Promise<Web3Wallet>
Expand All @@ -83,7 +83,7 @@ function prepareVerification(params: PrepareWeb3WalletVerificationParams): Promi

## `attemptVerification()`

Attempts to verify this Web3 wallet, by passing the generated signature. Returns a `Web3Wallet` object.
Attempts to verify the Web3 wallet by passing the signature generated from the [`prepareVerification()`](#prepare-verification) method. Returns a `Web3Wallet` object.

```typescript
function attemptVerification(params: AttemptWeb3WalletVerificationParams): Promise<Web3Wallet>
Expand All @@ -95,5 +95,5 @@ function attemptVerification(params: AttemptWeb3WalletVerificationParams): Promi
- `signature`
- `string`

The signature that was generated after [`prepareVerification`](#prepare-verification) was called.
The signature generated from calling the [`prepareVerification()`](#prepare-verification) method.
</Properties>