UNPKG

@azuro-org/toolkit

Version:

This framework-agnostic package provides essential utilities for building applications on the Azuro Protocol.

32 lines (31 loc) 1.03 kB
import { type Address } from 'viem'; import { type ChainId } from '../../config'; export type GetSiweNonceParams = { address: Address; affiliateId: Address; chainId: ChainId; domain: string; uri: string; }; export type GetSiweNonceResult = { nonce: string; issuedAt: number; expiresAt: number; }; /** * Requests a SIWE (Sign-In with Ethereum) nonce for the given (address, affiliateId, chainId) tuple. * The returned nonce is single-use and expires in approximately 5 minutes server-side. * Pass the result to `buildSiweMessage` and then `verifySiwe` to complete authentication. * * @example * import { getSiweNonce } from '@azuro-org/toolkit' * * const { nonce, issuedAt, expiresAt } = await getSiweNonce({ * address: '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045', * affiliateId: '0x123...', * chainId: 137, * domain: 'app.example.com', * uri: 'https://app.example.com', * }) * */ export declare const getSiweNonce: (props: GetSiweNonceParams) => Promise<GetSiweNonceResult>;