UNPKG

@beland/crypto-middleware

Version:
13 lines (12 loc) 1.39 kB
import { AuthChain } from '@beland/crypto/dist/types'; import { DecentralandSignatureData, VerifyAuthChainHeadersOptions } from './types'; export declare function isEIP1664AuthChain(authChain: AuthChain): boolean; export declare function extractAuthChain(headers: Record<string, string | string[] | undefined>): AuthChain; export declare function verifyPersonalSign(authChain: AuthChain, payload: string): Promise<string>; export declare function verifyEIP1654Sign(authChain: AuthChain, payload: string, options?: Pick<VerifyAuthChainHeadersOptions, 'catalyst'>): Promise<string>; export declare function verifySign(authChain: AuthChain, payload: string, options?: Pick<VerifyAuthChainHeadersOptions, 'catalyst'>): Promise<string>; export declare function verifyTimestamp(value?: string | string[]): number; export declare function verifyMetadata(value?: string | string[]): Record<string, any>; export declare function verifyExpiration(timestamp: number, options?: VerifyAuthChainHeadersOptions): boolean; export declare function createPayload(method: string, path: string, rawTimestamp: string | string[] | undefined, rawMetadata: string | string[] | undefined): string; export default function verify<P extends {} = {}>(method: string, path: string, headers: Record<string, string | string[] | undefined>, options?: VerifyAuthChainHeadersOptions): Promise<DecentralandSignatureData<P>>;