function encrypt
encrypt(
message: string,
userKey: CryptoPublicKey,
options?: OutputOptions,
): Promise<string>

Encrypt a message.

The generated ciphertext can be encoded

  • as plain string, with the value encoded, by default, in base64 or, on request, in base58.
  • as a Multibase string, with the value encoded, by default, in base58 or, on request, in base64.

Default is plain string with base64.

Parameters

message: string
optional
options: OutputOptions
  • choice between signature result in multibase or plain, and between base64 or base58 encoding

Return Type

Promise<string>
  • ciphertext in plain or multibase encoded format

Usage

import { encrypt } from "lib/crypto.ts";