Skip to Content
Documentation@aptos-labs/siwaReferencecreateSignInMessage

createSignInMessage

Creates a human readable SIWA message to be displayed to the user.

import { createSignInMessage, type AptosSignInInput } from "@aptos-labs/siwa"; const input: AptosSignInInput = { domain: "example.com", address: "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef", version: "1", chainId: "aptos:mainnet", nonce: "abc123def456", uri: "https://example.com", statement: "Sign in to Example.com to access your account" }; const message = createSignInMessage(input); // Returns: // "example.com wants you to sign in with your Aptos account: // 0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef // // Sign in to Example.com to access your account // // URI: https://example.com // Version: 1 // Nonce: abc123def456 // Chain ID: aptos:mainnet"

Specifications

Parameters:
NameTypeDefault
inputAptosSignInInput & AptosSignInBoundFields

The input to create the SIWA message from.

Returns:
string

The SIWA message text.

Last updated on