UNPKG

addvansed-hash

Version:
58 lines (57 loc) 1.9 kB
import { BinaryToTextEncoding } from "crypto"; export declare class JWT { static RSA: { GenrateKeys: typeof RSA_GenerateKeys; Encrypt(data: string, key: any): string | void; Decrypt(data: string, key: any): string | void; }; static RSASync: { GenrateKeys: typeof RSA_GenerateKeys_Sync; Encrypt(data: any, key: any): Promise<string>; Decrypt(data: any, key: any): Promise<string>; }; static SHA256: { Sign(payload: any, secret: string, options?: Sha256SignOptions): string | Error; Decrypt(token: string, options?: Sha256DecryptOptions): any | Error; Verify(token: string, secret: string, options: Sha256DecryptOptions): any | Error; }; static SHA256Sync: { Sign(payload: any, secret: string, options?: any): Promise<String | Error>; Decrypt(token: any, options?: Sha256DecryptOptions): Promise<any | Error>; Verify(token: any, secret: string, options: Sha256DecryptOptions): Promise<any | Error>; }; private static RSABasic; private static SHA256Basic; private static base64UrlDecode; private static base64UrlEncode; } declare function RSA_GenerateKeys(mode: true): KeyPairA; declare function RSA_GenerateKeys(mode?: false): KeyPairB; declare function RSA_GenerateKeys_Sync(mode: true): Promise<KeyPairA>; declare function RSA_GenerateKeys_Sync(mode?: false): Promise<KeyPairB>; type KeyPairA = { public: string; private: string; }; type KeyPairB = { publicKey: string; privateKey: string; }; interface Sha256SignOptions { encoding?: BinaryToTextEncoding; expiresIn?: number; iat?: boolean; notBefore?: number; iss?: string; sub?: string; aud?: string; jti?: string; } interface Sha256DecryptOptions { diractData?: boolean; } export interface Keys { privateKey: string; publicKey: any; } export {};