async encrypt({data, recipients, keyResolver}) {
    if(!(data instanceof Uint8Array) && typeof data !== 'string') {
      throw new TypeError('"data" must be a Uint8Array or a string.');
    }
    if(data) {
      data = stringToUint8Array(data);
    }
    const transformer = await this.createEncryptTransformer(
      {recipients, keyResolver});
    return transformer.encrypt(data);
  }
/**
   * Encrypts some data for one or more recipients and outputs a JWE. The
   * data to encrypt can be given as a Uint8Array or a string.
   *
   * A list of recipients must be given in the `recipients` array, identified
   * by key agreement keys. An ephemeral ECDH key will be generated and used to
   * derive shared KEKs that will wrap a randomly generated CEK. Each recipient
   * in the `recipients` array will be updated to include the generated
   * ephemeral ECDH key.
   *
   * @param {object} options - Options for encrypt.
   * @param {Uint8Array|string} [options.data] - The data to encrypt.
   * @param {Array} options.recipients - An array of recipients for the\
   *   encrypted content.
   * @param {Function} options.keyResolver - A function that returns a Promise
   *   that resolves a key ID to a DH public key.
   *
   * @returns {Promise<object>} Resolves to a JWE.
   */
Encrypts some data for one or more recipients and outputs a JWE. The
data to encrypt can be given as a Uint8Array or a string.

A list of recipients must be given in the `recipients` array, identified
by key agreement keys. An ephemeral ECDH key will be generated and used to
derive shared KEKs that will wrap a randomly generated CEK. Each recipient
in the `recipients` array will be updated to include the generated
ephemeral ECDH key.

@param {object} options - Options for encrypt.
@param {Uint8Array|string} [options.data] - The data to encrypt.
@param {Array} options.recipients - An array of recipients for the\
encrypted content.
@param {Function} options.keyResolver - A function that returns a Promise
that resolves a key ID to a DH public key.

@returns {Promise} Resolves to a JWE.
Encrypts some data for one or more recipients and outputs a JWE . The data to encrypt can be given as a Uint8Array or a string . A list of recipients must be given in the ` recipients ` array identified by key agreement keys . An ephemeral ECDH key will be generated and used to derive shared KEKs that will wrap a randomly generated CEK . Each recipient in the ` recipients ` array will be updated to include the generated ephemeral ECDH key . @param { object } options - Options for encrypt . @param { Uint8Array|string } [ options . data ] - The data to encrypt . @param { Array } options . recipients - An array of recipients for the \ encrypted content . @param { Function } options . keyResolver - A function that returns a Promise that resolves a key ID to a DH public key . @returns { Promise } Resolves to a JWE .
async encrypt({data, recipients, keyResolver}) {
    if(!(data instanceof Uint8Array) && typeof data !== 'string') {
      throw new TypeError('"data" must be a Uint8Array or a string.');
    }
    if(data) {
      data = stringToUint8Array(data);
    }
    const transformer = await this.createEncryptTransformer(
      {recipients, keyResolver});
    return transformer.encrypt(data);
  }
async encrypt ( { data , recipients , keyResolver } ) { if ( ! ( data instanceof Uint8Array ) && typeof data !== 'string' ) { throw new TypeError ( '"data" must be a Uint8Array or a string.' ) ; } if ( data ) { data = stringToUint8Array ( data ) ; } const transformer = await this . createEncryptTransformer ( { recipients , keyResolver } ) ; return transformer . encrypt ( data ) ; }
Encrypts some data for one or more recipients and outputs a JWE.
Encrypts some data for one or more recipients and outputs a JWE .