Skip to content

Function: openBytes() ​

openBytes(secretKey, data, options?): Promise<Uint8Array<ArrayBufferLike>>

Defined in: stream.ts:463

Convenience: decrypts a whole buffer produced by sealBytes.

Parameters ​

secretKey ​

SecretKey

The recipient's KEM secret key.

data ​

Uint8Array

The complete encrypted stream.

options? ​

OpenStreamOptions = {}

expectedAad, the associated data the sender used (default none).

Returns ​

Promise<Uint8Array<ArrayBufferLike>>

The plaintext in one array.

Throws ​

on authentication failure; MalformedCiphertextError for a malformed or truncated stream.

Throws ​

if the stream's algorithm differs from the key's.

Throws ​

if secretKey is not a SecretKey or data is not bytes.

Apache-2.0.