docs/jws/flattened/sign/classes/FlattenedSign.md
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.
Builds and signs Flattened JWS objects.
This class is exported (as a named export) from the main 'jose' module entry point as well as
from its subpath export 'jose/jws/flattened/sign'.
const jws = await new jose.FlattenedSign(
new TextEncoder().encode('Itβs a dangerous business, Frodo, going out your door.'),
)
.setProtectedHeader({ alg: 'ES256' })
.sign(privateKey)
console.log(jws)
βΈ new FlattenedSign(payload): FlattenedSign
Creates a Flattened JWS signer.
| Parameter | Type | Description |
|---|---|---|
payload | Uint8Array | Binary representation of the payload to sign. |
FlattenedSign
βΈ setProtectedHeader(protectedHeader): this
Sets the JWS Protected Header. May only be called once.
| Parameter | Type | Description |
|---|---|---|
protectedHeader | JWSHeaderParameters | JWS Protected Header. |
this
βΈ setUnprotectedHeader(unprotectedHeader): this
Sets the JWS Unprotected Header. May only be called once.
| Parameter | Type | Description |
|---|---|---|
unprotectedHeader | JWSHeaderParameters | JWS Unprotected Header. |
this
βΈ sign(key, options?): Promise<FlattenedJWS>
Signs the payload as a Flattened JWS.
| Parameter | Type | Description |
|---|---|---|
key | KeyInput | Private key or shared secret. See Algorithm Key Requirements. |
options? | SignOptions | JWS Sign options. |