Module jwt aims to provide an implementation of the JSON Web Encryption. Only compact serialization is supported.
▸ decryptAsString(key
: Key, jwe
: string): string
Decrypt JWE serialized form based to string payload (e.g. json)
Name | Type | Description |
---|---|---|
key |
Key | The Key wrapping key |
jwe |
string | JWE in compact serialization |
Returns: string
string jwe payload as string (e.g. json)
▸ encrypt(key
: Key, payload
: string, encAlg
: string, keyAlg
: string): string
Create JWE serialized form based on string payload (e.g. json)
Name | Type | Description |
---|---|---|
key |
Key | The key wrapping key |
payload |
string | The payload to sign. e.g. json claims |
encAlg |
string | Content encryption algorithm. See JWA RFC chapter 4 for details on supported algorithms |
keyAlg |
string | Key wrapping encryption algorithm. See JWA RFC chapter 5 for details on supported algorithms |
Returns: string
string jwe string in serialized form