@am92/kms
Version:
Key Management Service
52 lines (51 loc) • 1.49 kB
TypeScript
import { DataKeyObject, DataKeyPairObject, EncryptDecryptOptions, NodeKmsConfig, NodeKmsExtendedConfig } from '../../TYPES';
/**
* Class to execute KMS methods using Node Crypto
*
* @class
*/
export declare class NodeKms {
/**
* Configurations used for Node Crypto
*/
CONFIG: NodeKmsExtendedConfig;
/**
* Creates an instance of NodeKms.
*
* @constructor
* @param config
*/
constructor(config: NodeKmsConfig);
/**
* Generates encryption keys for symmetric encryption algorithm
*
* @async
* @returns
*/
generateDataKey(): Promise<DataKeyObject>;
/**
* Generates encryption keys for asymmetric encryption algorithm
*
* @async
* @returns
*/
generateDataKeyPair(): Promise<DataKeyPairObject>;
/**
* Encrypts a given string using AES-256-CBC. The key and IV are as defined in `CONFIG.MASTER_KEY_HEX` and `CONFIG.MASTER_IV_HEX` respectively.
*
* @async
* @param [plainText='']
* @param [options]
* @returns
*/
encrypt(plainText?: string, options?: EncryptDecryptOptions): Promise<string>;
/**
* Decrypts a given string using AES-256-CBC. The key and IV are as defined in `CONFIG.MASTER_KEY_HEX` and `CONFIG.MASTER_IV_HEX` respectively.
*
* @async
* @param [ciphertext='']
* @param [options]
* @returns
*/
decrypt(ciphertext?: string, options?: EncryptDecryptOptions): Promise<string>;
}