function decrypt({ payload, privateKey, publicKey, opts = {} }) {
  $.checkArgument(Buffer.isBuffer(payload), '`buffer` must be a Buffer');
  $.checkArgument(privateKey, 'privateKey is required');
  
  if (!(privateKey instanceof PrivateKey)) {
    privateKey = new PrivateKey(privateKey);
  }

  if (publicKey && !(publicKey instanceof PublicKey)) {
    publicKey = new PublicKey(publicKey);
  }

  let offset = 0;
  const tagLength = opts.shortTag ? 4 : 32;
  if (!publicKey) {
    let pub;
    switch(payload[0]) {
      case 4:
        pub = payload.subarray(0, 65);
        break;
      case 3:
      case 2:
        pub = payload.subarray(0, 33);
        break;
      default:
        throw new Error('Invalid type: ' + payload[0]);
    }
    publicKey = PublicKey.fromDER(pub);
    offset += pub.length;
  }

  const ivbuf = payload.subarray(offset, offset + 16);
  const cipherText = payload.subarray(offset + 16, payload.length - tagLength);
  const tag = payload.subarray(payload.length - tagLength, payload.length);

  const [kE, kM] = KDF(privateKey, publicKey);

  const tag2 = Hash.sha256hmac(cipherText, kM).subarray(0, tagLength);
  if (tag2.compare(tag) !== 0) {
    throw new Error('Invalid checksum');
  }

  const cipher = crypto.createDecipheriv('aes-256-cbc', kE, ivbuf);
  const message = Buffer.concat([cipher.update(cipherText), cipher.final()]);
  return message;
}
Decrypt the payload
@param {Object} params
@param {Buffer} params.payload - Encrypted payload buffer.
@param {PrivateKey} params.privateKey - Your private key is used to decrypt the payload.
@param {PublicKey} params.publicKey - Sender's public key is used to verify the payload.
                             *Only* include this if the encrypter specified the `noKey` option, otherwise the public key is included in the payload.
@param {Object} params.opts (optional) Options object. Every field is optional.
@param {boolean} params.opts.shortTag - Use 4-byte tag instead of 32-byte.
                             This was decided during encryption and must be communicated by the sender.
@returns {Buffer} Decrypted message buffer.