Skip to main content
Module

x/jose/index.ts>GeneralSign

"JSON Web Almost Everything" - JWA, JWS, JWE, JWT, JWK, JWKS with no dependencies using runtime's native crypto in Node.js, Browser, Cloudflare Workers, Electron, and Deno.
Extremely Popular
Go to Latest
class GeneralSign
import { GeneralSign } from "https://deno.land/x/jose@v4.8.3/index.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.