The encrypt() method encrypts some data.
|algorithm||AesCtrParams, AesCbcParams, or AesGcmParams object||Defines the algorithm to use and any extra-parameters.|
|key||CryptoKey||The key to use for encryption.|
|data||ArrayBuffer, TypedArray, or DataView||The data to be encrypted (also known as "plaintext").|
A Promise that resolves to a new ArrayBuffer containing the encrypted data.
|InvalidAccessError||Raised when the requested operation is not valid with the provided key. For instance when an invalid encryption algorithm is used, or a key not matching the selected algorithm is provided.|
|OperationError||Raised when the operation failed for an operation-specific reason. For instance, if the algorithm size is invalid, or errors occurred during the process of decrypting the ciphertext.|