react-native-pure-jwt
Version:
React Native Pure JWT implementation
29 lines (23 loc) • 513 B
TypeScript
export interface DecodeResponse {
headers: object
payload: object
}
interface CustomHeaders {
[key: string]: string | number | boolean
}
export interface SignOptions extends CustomHeaders {
alg: 'HS256' | 'HS384' | 'HS512'
}
export interface DecodeOptions {
skipValidation?: boolean
}
export function sign(
payload: object,
secret: string,
options: SignOptions
): Promise<string>
export function decode(
token: string,
secret: string,
options?: DecodeOptions
): Promise<DecodeResponse>