UNPKG

paseto-ts

Version:

PASETO v4 (encrypt, decrypt, sign & verify) in TypeScript

27 lines (26 loc) 1.13 kB
export declare function isObject(val: any): boolean; /** * Compare two Uint8Arrays in constant time * @param {Uint8Array} a First array * @param {Uint8Array} b Second array * @returns {boolean} true if the arrays are equal, false otherwise */ export declare function constantTimeEqual(a: Uint8Array, b: Uint8Array): boolean; /** * Validate a date string * @param {string} date Date string to validate * @returns {boolean} true if the date is valid, false otherwise * @see https://github.com/paseto-standard/paseto-spec/blob/master/docs/02-Implementation-Guide/04-Claims.md#payload-claims */ export declare function validateISODate(date: string): boolean; /** * Validate the footer claims. * @param obj The footer object to validate. */ export declare function validateFooterClaims(obj: Record<string, any>): void; /** * Assert that the token is a valid PASETO token. * @param {('local' | 'public')} type The type of token to assert. * @param {string | Uint8Array} token The token to assert. */ export declare function validateToken(type: 'local' | 'public', token: Uint8Array | string): Uint8Array | string;