keyvenant
Version:
Keyvenant is a JavaScript tool to generate and export CovenantSQL keys to facilitate key management locally and in web extensions.
28 lines (27 loc) • 1.13 kB
TypeScript
/**
* symmetric encryption
* @param plaintext input text to be encrypted
* @param key serectKey string in hex (16 btyes)
* @param iv iv string in hex (16 btyes because of AES 128bit blocksize)
* @param algo='aes256' symmetric encryption algo, defualt is AES256
* @return encrypted ciphertext in hex (48 btyes)
*/
export declare function encrypt(plaintext: string, key: string, iv: string, algo?: string): string;
/**
* symmetric decryption
* @param encrypted encrypted ciphertext in hex (48 btyes)
* @param key serectKey string in hex (16 btyes)
* @param iv iv string in hex (16 btyes because of AES 128bit blocksize)
* @param algo='aes256' symmetric encryption algo, defualt is AES256
* @return decrypted text in hex
*/
export declare function decrypt(encrypted: string, // 48 bytes
key: string, // derivedKey 16 bytes
iv: string, // 16 btyes
algo?: string): string;
/**
* randomly generate iv
* @param length default length is 16 btyes because of AES 128bit blocksize
* @return iv in hex
*/
export declare function generateIv(length?: number): string;