• Encrypt the given message to the given public key. If an AES key is not provided, one will be created. Use an AES key to encrypt the given content, then we encrypt the AES key to the given public key.

    Parameters

    • opts: { content: string | Uint8Array<ArrayBufferLike>; publicKey: string | CryptoKey }

      The content to encrypt and public key to encrypt to

    • OptionalaesKey: string | Uint8Array<ArrayBufferLike> | CryptoKey

      An optional AES key to encrypt to the given public key

    Returns Promise<ArrayBuffer>

    The encrypted AES key, concattenated with the encrypted content.

Methods

Methods

  • Encrypt the given AES key to the given public key. Return the encrypted AES key concattenated with the cipher text.

    Parameters

    • opts: { content: string | Uint8Array<ArrayBufferLike>; publicKey: string | CryptoKey }

      The content to encrypt and key to encrypt to.

    • OptionalaesKey: string | Uint8Array<ArrayBufferLike> | CryptoKey

      Optional -- the AES key. One will be created if not passed in.

    Returns Promise<string>

    The encrypted AES key concattenated with the cipher text.