encrypt() function
Encrypts the given data using a Curve25519 variant of the public key.
The encryption uses an ephemeral private key, which is prepended to the ciphertext, along with a nonce of random bytes.
Signature:
export declare function encrypt(data: Uint8Array, pubKey: Uint8Array, type?: string): Promise<Uint8Array>;
Parameters
| Parameter | Type | Description |
|---|---|---|
| data | Uint8Array | Data to encrypt. |
| pubKey | Uint8Array | |
| type | string |
Returns:
Promise<Uint8Array>