Skip to content

encrypt

encrypt(payload, options, instance): Promise<ArrayBuffer>

Defined in: astrobase/src/encrypt/encrypt.ts:160

Encrypts the payload using the given options. Requires a key derivation input to be provided - one of EncryptOptions.passphrase or EncryptOptions.pubKey. If pubkey is provided, then the Identity’s private key must be available in the Keyring.

The promise will error if no key derivation input is provided or if key derivation or encryption fails.

BufferSource

The payload to decrypt.

EncryptOptions

The full options object.

Instance

The instance of the active Keyring when using pubKey.

Promise<ArrayBuffer>

The encrypted payload as a promise.