Skip to Content
Documentation@aptos-labs/siwaReferencegenerateNonce

generateNonce

Generates a randomized nonce used to prevent replay attacks.

import { generateNonce, type AptosSignInInput } from "@aptos-labs/siwa"; const nonce = generateNonce(); // "abc123def456ghi789" const input: AptosSignInInput = { domain: "example.com", address: "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef", version: "1", chainId: "aptos:mainnet", nonce // Use the generated nonce here };

Specifications

Parameters:
This function does not accept any parameters.
Returns:
string

A random nonce.

Last updated on