node-jose icon indicating copy to clipboard operation
node-jose copied to clipboard

Add types in function update JWE constructor to improve readability

Open Exodiel opened this issue 4 years ago • 0 comments

const encrypt = async (publicToEncrypt: JWK.Key, data: JWS.CreateSignResult): Promise<string> => {
  const encrypted = await JWE
    .createEncrypt({
      contentAlg: 'A256GCM',
      format: 'compact',
      fields: {
        alg: 'RSA-OAEP-256',
        cty: 'JWT',
        enc: 'A256GCM',
        iss: 'COMPANY'
      }
    }, publicToEncrypt)
    .update(data) // <--- here
    .final()

  return encrypted
}

In the update function, the input data is received as a parameter but the data type is any Here is what I am saying:

(method) JWE.Encryptor.update(input: any): JWE.Encryptor

Exodiel avatar Mar 25 '22 20:03 Exodiel