@meeco/cryppo
Version:
In-browser encryption and decryption. Clone of Ruby Cryppo
32 lines (31 loc) • 1.16 kB
TypeScript
import { SerializationFormat } from '../serialization-versions';
export declare function generateRSAKeyPair(bits?: number): Promise<{
privateKey: string;
publicKey: string;
bits: number;
}>;
export declare function encryptPrivateKeyWithPassword({ privateKeyPem, password, }: {
privateKeyPem: string;
password: string;
}): string;
export declare function encryptWithPublicKey({ publicKeyPem, data, scheme, }: {
publicKeyPem: string;
data: string;
scheme?: RsaEncryptionScheme;
}, serializationFormat?: SerializationFormat): Promise<{
encrypted: string;
serialized: string;
}>;
export declare type RsaEncryptionScheme = 'RSA-OAEP';
export declare function decryptSerializedWithPrivateKey({ password, privateKeyPem, serialized, scheme, }: {
password?: string;
privateKeyPem: string;
serialized: string;
scheme?: RsaEncryptionScheme;
}): Promise<string>;
export declare function decryptWithPrivateKey({ password, privateKeyPem, encrypted, scheme, }: {
password?: string;
privateKeyPem: string;
encrypted: string;
scheme?: RsaEncryptionScheme;
}): Promise<string>;