The GeneralSign class is a utility for creating General JWS objects.
example
Usage
const jws = await new jose.GeneralSign(
new TextEncoder().encode(
'It’s a dangerous business, Frodo, going out your door.'
)
)
.addSignature(ecPrivateKey)
.setProtectedHeader({ alg: 'ES256' })
.addSignature(rsaPrivateKey)
.setProtectedHeader({ alg: 'PS256' })
.sign()
console.log(jws)
• new GeneralSign(payload
)
Name | Type | Description |
---|---|---|
payload |
Uint8Array |
Binary representation of the payload to sign. |
▸ addSignature(key
, options?
): Signature
Adds an additional signature for the General JWS object.
Name | Type | Description |
---|---|---|
key |
KeyLike | Uint8Array |
Private Key or Secret to sign the individual JWS signature with. |
options? |
SignOptions |
JWS Sign options. |
▸ sign(): Promise
<GeneralJWS
>
Signs and resolves the value of the General JWS object.
Promise
<GeneralJWS
>