Back to Jose

Interface: Recipient

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

6.2.122.6 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.

Configures an individual recipient in a General JWE.

Methods

addRecipient()

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

Adds another recipient to the enclosing GeneralEncrypt and returns its configuration.

Parameters

ParameterTypeDescription
keyKeyInputPublic key or shared secret. See Algorithm Key Requirements.
options?CritOptionJWE Encryption options.

Returns

Recipient


done()

ā–ø done(): GeneralEncrypt

Returns the enclosing GeneralEncrypt instance.

Returns

GeneralEncrypt


encrypt()

ā–ø encrypt(): Promise<GeneralJWE>

Encrypts for all recipients on the enclosing GeneralEncrypt, using their configured keys.

Returns

Promise<GeneralJWE>


setKeyManagementParameters()

ā–ø setKeyManagementParameters(parameters): Recipient

Sets key management inputs such as ECDH-ES "apu"/"apv" or PBES2 "p2c". Use this method instead of header setters; the resulting parameters are added to the JOSE header. May only be called once.

Parameters

ParameterTypeDescription
parametersJWEKeyManagementHeaderParametersJWE Key Management parameters.

Returns

Recipient


setUnprotectedHeader()

ā–ø setUnprotectedHeader(unprotectedHeader): Recipient

Sets the JWE Per-Recipient Unprotected Header. May only be called once.

Parameters

ParameterTypeDescription
unprotectedHeaderJWEHeaderParametersJWE Per-Recipient Unprotected Header.

Returns

Recipient