Back to Jose

Interface: Recipient

docs/jwe/general/encrypt/interfaces/Recipient.md

6.2.92.9 KB
Original Source

Interface: Recipient

šŸ’— Help the project

Support from the community to continue maintaining and improving this module is welcome. If you find the module useful, please consider supporting the project by becoming a sponsor.

Used to build General JWE object's individual recipients.

Methods

addRecipient()

ā–ø addRecipient(key, options?): Recipient

A shorthand for calling addRecipient() on the enclosing GeneralEncrypt instance.

Parameters

ParameterTypeDescription
keyKeyInputPublic Key or Secret to encrypt the Content Encryption Key for the recipient with. See Algorithm Key Requirements.
options?CritOptionJWE Encryption options.

Returns

Recipient


done()

ā–ø done(): GeneralEncrypt

Returns the enclosing GeneralEncrypt instance

Returns

GeneralEncrypt


encrypt()

ā–ø encrypt(): Promise<GeneralJWE>

A shorthand for calling encrypt() on the enclosing GeneralEncrypt instance. Takes no arguments — each recipient's key is supplied to addRecipient.

Returns

Promise<GeneralJWE>


setKeyManagementParameters()

ā–ø setKeyManagementParameters(parameters): Recipient

Sets the JWE Key Management parameters to be used when encrypting. Use this method instead of the header setters to configure algorithm inputs such as ECDH-ES "apu" (Agreement PartyUInfo) and "apv" (Agreement PartyVInfo), or PBES2 "p2c" (PBES2 Count). The parameters are added to the appropriate JOSE Header.

Parameters

ParameterTypeDescription
parametersJWEKeyManagementHeaderParametersJWE Key Management parameters.

Returns

Recipient


setUnprotectedHeader()

ā–ø setUnprotectedHeader(unprotectedHeader): Recipient

Sets the JWE Per-Recipient Unprotected Header on the Recipient object.

Parameters

ParameterTypeDescription
unprotectedHeaderJWEHeaderParametersJWE Per-Recipient Unprotected Header.

Returns

Recipient