Documentation / @frak-labs/core-sdk / actions / siweAuthenticate
Function: siweAuthenticate()
siweAuthenticate(
client,args):Promise<{message:string;signature:`0x${string}`; }>
Defined in: actions/wrapper/siweAuthenticate.ts:62
Function used to launch a siwe authentication
Parameters
client
The current Frak Client
args
The parameters
metadata?
Custom metadata to be passed to the modal
siwe?
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
{}Returns
Promise<{ message: string; signature: `0x${string}`; }>
The SIWE authentication result (message + signature) in a promise
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);