@meeco/cryppo
Version:
In-browser encryption and decryption. Clone of Ruby Cryppo
26 lines • 1.08 kB
TypeScript
/**
* SymmetricKey that can be used to encrypt and decrypt data
* This wrapper ensures that keys can be safely serialized as JSON (by encoding them as URL-Safe Base64)
* and avoids confusion when dealing with converting to and from this encoded format.
*/
export declare class EncryptionKey {
private readonly value;
static fromSerialized(value: string): EncryptionKey;
static fromBytes(bytes: Uint8Array): EncryptionKey;
static generateRandom(length?: number): EncryptionKey;
private static checkStringValue;
private static checkBytesValue;
/**
* The constructor is intentionally private as we want the user ot be explicit as to whether the value coming
* in is raw bytes or a base64 encoded version.
*
* @param value Value as binary string. Avoid outputting to console but should be used for actual encryption.
*/
private constructor();
/**
* Encode a key in a human-readable and url-safe format.
*/
get serialize(): string;
get bytes(): Uint8Array;
}
//# sourceMappingURL=encryption-key.d.ts.map