import { JoseCryptoKeyObj } from './TYPES'; /** * JoseCryptoSubtle Class to implement JOSE Cryptography using Subtle Crypto * * @class * @typedef {JoseCryptoSubtle} */ export default class JoseCryptoSubtle { /** * Function to generate AES-256-GCM Key in plaintext and encrypted string. Encrypted key is generated using RSA-OAEP public key. * * @static * @async * @param base64PublicKey RSA-OAEP public key as Base64 string. * @returns */ static generateAndWrapKey(base64PublicKey: string): Promise; /** * Function to encrypt any data using AES-256-GCM. * * @static * @async * @param data Data to be encrypted. * @param key AES-256-GCM plaintext key to be used for encryption. * @returns */ static encryptData(data: any, key: CryptoKey): Promise; /** * Function to decrypt encrypted data using AES-256-GCM. * * @static * @async * @param payload AES-256-GCM encrypted string to decrypt. * @param key AES-256-GCM plaintext key to be used for encryption. * @returns */ static decryptData(payload: string, key: CryptoKey): Promise; /** * Function to convert CryptoKey to Base64 string. * * @static * @async * @param key AES-256-GCM CryptoKey key to be used for encryption. * @returns */ static exportCryptoKey(key: CryptoKey): Promise; /** * Function to convert Base64 string to CryptoKey. * * @static * @async * @param base64Key AES-256-GCM Base64 string to be used for encryption. * @returns */ static importCryptoKey(base64Key: string): Promise; }