-
Notifications
You must be signed in to change notification settings - Fork 9
/
aeadEncryptionContext.ts
35 lines (33 loc) · 1 KB
/
aeadEncryptionContext.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// The key usages for AEAD.
export const AEAD_USAGES: KeyUsage[] = ["encrypt", "decrypt"];
/**
* The AEAD encryption context interface.
*/
export interface AeadEncryptionContext {
/**
* Encrypts data with an initialization vector and additional authenticated data.
*
* @param iv An initialization vector.
* @param data A plain text as bytes to be encrypted.
* @param aad Additional authenticated data as bytes fed by an application.
* @returns A cipher text as bytes.
*/
seal(
iv: ArrayBuffer,
data: ArrayBuffer,
aad: ArrayBuffer,
): Promise<ArrayBuffer>;
/**
* Decrypts data with an initialization vector and additional authenticated data.
*
* @param iv An initialization vector.
* @param data A plain text as bytes to be encrypted.
* @param aad Additional authenticated data as bytes fed by an application.
* @returns A decrypted plain text as bytes.
*/
open(
iv: ArrayBuffer,
data: ArrayBuffer,
aad: ArrayBuffer,
): Promise<ArrayBuffer>;
}