import { WebexPlugin } from '@webex/webex-core'; import { FileDownloadOptions, IEncryption } from './types'; /** * @description Encryption APIs for KMS * @class */ declare class Cypher extends WebexPlugin implements IEncryption { readonly namespace = "cypher"; private readonly $webex; registered: boolean; /** * Constructs an instance of the class. * * @param {...any[]} args - The arguments to pass to the superclass constructor. * * @remarks * This constructor calls the superclass constructor with the provided arguments. * It also assigns the `webex` property to the `$webex` property, ignoring TypeScript errors. */ constructor(...args: any[]); /** * Registers the device to WDM. This is required for metrics and other services. * @returns {Promise} */ register(): Promise; /** * Deregisters the device. * @returns {Promise} */ deregister(): Promise; /** * Downloads and decrypts a file from the given URI. * * @param {string} fileUri - The URI of the file to be decrypted. * @param {FileDownloadOptions} options - The options for file download. * @returns {Promise} A promise that resolves to the decrypted ArrayBuffer. * @throws {Error} If the file download or decryption fails. * * @example * ```typescript * const attachmentURL = 'https:/myfileurl.xyz/zzz/fileid?keyUri=somekeyuri&JWE=somejwe'; * const options: FileDownloadOptions = { * useFileService: false, * jwe: somejwe, // Provide the JWE here if not already present in the attachmentURL * keyUri: someKeyUri, // Provide the keyURI here if not already present in the attachmentURL * }; * const decryptedBuf = await webex.cypher.downloadAndDecryptFile(attachmentURL, options); * const file = new File([decryptedBuf], "myFileName.jpeg", {type: 'image/jpeg'}); * ``` */ downloadAndDecryptFile(fileUri: string, { useFileService, ...options }?: FileDownloadOptions): Promise; } export default Cypher;