Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/jose/jws/general/sign.ts>GeneralSign

"JSON Web Almost Everything" - JWA, JWS, JWE, JWT, JWK, JWKS for Node.js, Browser, Cloudflare Workers, Deno, Bun, and other Web-interoperable runtimes.
Extremely Popular
Go to Latest
class GeneralSign
import { GeneralSign } from "https://deno.land/x/jose@v4.11.2/jws/general/sign.ts";

The GeneralSign class is a utility for creating General JWS objects.

Examples

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)

Constructors

new
GeneralSign(payload: Uint8Array)

Properties

private
_payload: Uint8Array
private
_signatures: IndividualSignature[]

Methods

addSignature(key: KeyLike | Uint8Array, options?: SignOptions): Signature

Adds an additional signature for the General JWS object.

sign(): Promise<GeneralJWS>

Signs and resolves the value of the General JWS object.