siwe
Version:
Sign-In with Ethereum
31 lines (30 loc) • 1.56 kB
TypeScript
import { providers, Signer } from 'ethers';
import type { SiweMessage } from './client';
/**
* This method calls the EIP-1271 method for Smart Contract wallets
* @param message The EIP-4361 parsed message
* @param provider Web3 provider able to perform a contract check (Web3/EthersJS).
* @returns {Promise<boolean>} Checks for the smart contract (if it exists) if
* the signature is valid for given address.
*/
export declare const checkContractWalletSignature: (message: SiweMessage, signature: string, provider?: providers.Provider | Signer) => Promise<boolean>;
/**
* This method leverages a native CSPRNG with support for both browser and Node.js
* environments in order generate a cryptographically secure nonce for use in the
* SiweMessage in order to prevent replay attacks.
*
* 96 bits has been chosen as a number to sufficiently balance size and security considerations
* relative to the lifespan of it's usage.
*
* @returns cryptographically generated random nonce with 96 bits of entropy encoded with
* an alphanumeric character set.
*/
export declare const generateNonce: () => string;
/**
* This method matches the given date string against the ISO-8601 regex and also
* performs checks if it's a valid date.
* @param inputDate any string to be validated against ISO-8601
* @returns boolean indicating if the provided date is valid and conformant to ISO-8601
*/
export declare const isValidISO8601Date: (inputDate: string) => boolean;
export declare const checkInvalidKeys: <T>(obj: T, keys: (keyof T)[]) => (keyof T)[];