siweAuthenticate
Ce contenu n’est pas encore disponible dans votre langue.
siweAuthenticate(
client,args):Promise<{message:string;signature:`0x${string}`; }>
Defined in: actions/wrapper/siweAuthenticate.ts:86
Function used to launch a siwe authentication
Parameters
Section titled “Parameters”client
Section titled “client”The current Frak Client
The parameters
metadata?
Section titled “metadata?”Custom metadata to be passed to the modal
Partial<SiweAuthenticationParams>
Partial SIWE params, since we can rebuild them from the SDK if they are empty
If no parameters provider, some fields will be recomputed from the current configuration and environment.
statementwill be set to a default valuenoncewill be generateduriwill be set to the current domainversionwill be set to “1”domainwill be set to the current window domain
Default
{}Returns
Section titled “Returns”Promise<{ message: string; signature: `0x${string}`; }>
The SIWE authentication result (message + signature) in a promise
Description
Section titled “Description”This function will display a modal to the user with the provided SIWE parameters and metadata.
Example
Section titled “Example”import { siweAuthenticate } from "@frak-labs/core-sdk/actions";import { parseSiweMessage } from "viem/siwe";
const { signature, message } = await siweAuthenticate(frakConfig, { siwe: { statement: "Sign in to My App", domain: "my-app.com", expirationTimeTimestamp: Date.now() + 1000 * 60 * 5, }, metadata: { header: { title: "Sign in", }, context: "Sign in to My App", },});console.log("Parsed final message:", parseSiweMessage(message));console.log("Siwe signature:", signature);