better-cipher
Version:
A secure encryption library with browser and Node.js support using AES-GCM
17 lines (14 loc) • 386 B
text/typescript
export type Encrypted = {
iv: string;
content: string;
authTag: string;
};
export interface IEncryption {
encrypt(text: string): Promise<Encrypted>;
decrypt(encrypted: Encrypted): Promise<string>;
}
export type ReEncryptData = (prevEncrypted: Encrypted) => Promise<Encrypted>;
export type CreateRotator = (
oldSecretKey: string,
newSecretKey: string
) => ReEncryptData;