@azuro-org/toolkit
Version:
This framework-agnostic package provides essential utilities for building applications on the Azuro Protocol.
30 lines (29 loc) • 900 B
TypeScript
import { type Address, type Hex } from 'viem';
import { type ChainId } from '../../config';
export type VerifySiweParams = {
chainId: ChainId;
message: string;
signature: Hex;
};
export type VerifySiweResult = {
token: string;
expiresIn: number;
address: Address;
affiliateId: Address;
chainId: ChainId;
};
/**
* Verifies a signed SIWE message and returns a JWT valid for `expiresIn` seconds.
* The call is single-use: the nonce embedded in the message is consumed upon success.
* `chainId` is used only to resolve the API endpoint and is not included in the request body.
*
* @example
* import { verifySiwe } from '@azuro-org/toolkit'
*
* const { token, expiresIn } = await verifySiwe({
* chainId: 137,
* message: siweMessage,
* signature: '0x...',
* })
* */
export declare const verifySiwe: (props: VerifySiweParams) => Promise<VerifySiweResult>;