@frank-auth/react
Version:
Flexible and customizable React UI components for Frank Authentication
112 lines • 5.55 kB
TypeScript
export declare const base64Encode: (data: string) => string;
export declare const base64Decode: (encoded: string) => string;
export declare const base64UrlEncode: (data: string) => string;
export declare const base64UrlDecode: (encoded: string) => string;
export declare const generateRandomBytes: (length: number) => Uint8Array;
export declare const generateRandomString: (length: number, charset?: string) => string;
export declare const generateSecureId: () => string;
export declare const generateNonce: () => string;
export declare const generateState: () => string;
export declare const generateCodeVerifier: () => string;
export declare const generateCodeChallenge: (verifier: string) => Promise<string>;
export declare const generatePKCEPair: () => Promise<{
codeVerifier: string;
codeChallenge: string;
codeChallengeMethod: "S256" | "plain";
}>;
export declare const sha256: (data: string) => Promise<string>;
export declare const md5: (data: string) => string;
export declare const simpleEncrypt: (data: string, key: string) => string;
export declare const simpleDecrypt: (encrypted: string, key: string) => string;
export interface JWTHeader {
alg: string;
typ: string;
kid?: string;
}
export interface JWTPayload {
[key: string]: any;
iss?: string;
sub?: string;
aud?: string | string[];
exp?: number;
nbf?: number;
iat?: number;
jti?: string;
}
export declare const parseJWT: (token: string) => {
header: JWTHeader;
payload: JWTPayload;
signature: string;
} | null;
export declare const isJWTExpired: (token: string) => boolean;
export declare const getJWTExpiration: (token: string) => Date | null;
export declare const arrayBufferToBase64: (buffer: ArrayBuffer) => string;
export declare const base64ToArrayBuffer: (base64: string) => ArrayBuffer;
export declare const uint8ArrayToBase64: (array: Uint8Array) => string;
export declare const base64ToUint8Array: (base64: string) => Uint8Array;
export declare const credentialToJSON: (credential: PublicKeyCredential) => any;
export declare const jsonToCredentialCreationOptions: (options: any) => PublicKeyCredentialCreationOptions;
export declare const jsonToCredentialRequestOptions: (options: any) => PublicKeyCredentialRequestOptions;
export declare const hashPassword: (password: string, salt: string) => Promise<string>;
export declare const generateSalt: () => string;
export declare const generateDeviceFingerprintPromise: () => Promise<string>;
export declare const generateDeviceFingerprint: () => string;
export declare const generateSecureToken: (length?: number) => string;
export declare const generateApiKey: () => string;
export declare const isValidBase64: (str: string) => boolean;
export declare const isValidJWT: (token: string) => boolean;
export declare const generateTOTPSecret: () => string;
export declare const generateBackupCodes: (count?: number) => string[];
export declare const urlSafeEncode: (data: string) => string;
export declare const urlSafeDecode: (encoded: string) => string;
export declare const calculateChecksum: (data: string) => string;
export declare const verifyChecksum: (data: string, expectedChecksum: string) => boolean;
export declare const deriveKey: (password: string, salt: string, iterations?: number) => Promise<string>;
export declare const CryptoUtils: {
base64Encode: (data: string) => string;
base64Decode: (encoded: string) => string;
base64UrlEncode: (data: string) => string;
base64UrlDecode: (encoded: string) => string;
urlSafeEncode: (data: string) => string;
urlSafeDecode: (encoded: string) => string;
generateRandomBytes: (length: number) => Uint8Array;
generateRandomString: (length: number, charset?: string) => string;
generateSecureId: () => string;
generateNonce: () => string;
generateState: () => string;
generateSecureToken: (length?: number) => string;
sha256: (data: string) => Promise<string>;
md5: (data: string) => string;
calculateChecksum: (data: string) => string;
verifyChecksum: (data: string, expectedChecksum: string) => boolean;
parseJWT: (token: string) => {
header: JWTHeader;
payload: JWTPayload;
signature: string;
} | null;
isJWTExpired: (token: string) => boolean;
getJWTExpiration: (token: string) => Date | null;
isValidJWT: (token: string) => boolean;
arrayBufferToBase64: (buffer: ArrayBuffer) => string;
base64ToArrayBuffer: (base64: string) => ArrayBuffer;
uint8ArrayToBase64: (array: Uint8Array) => string;
base64ToUint8Array: (base64: string) => Uint8Array;
credentialToJSON: (credential: PublicKeyCredential) => any;
jsonToCredentialCreationOptions: (options: any) => PublicKeyCredentialCreationOptions;
jsonToCredentialRequestOptions: (options: any) => PublicKeyCredentialRequestOptions;
generateCodeVerifier: () => string;
generateCodeChallenge: (verifier: string) => Promise<string>;
generatePKCEPair: () => Promise<{
codeVerifier: string;
codeChallenge: string;
codeChallengeMethod: "S256" | "plain";
}>;
generateDeviceFingerprint: () => string;
generateTOTPSecret: () => string;
generateBackupCodes: (count?: number) => string[];
deriveKey: (password: string, salt: string, iterations?: number) => Promise<string>;
simpleEncrypt: (data: string, key: string) => string;
simpleDecrypt: (encrypted: string, key: string) => string;
isValidBase64: (str: string) => boolean;
};
//# sourceMappingURL=crypto.d.ts.map