JavaScript digital signature libraries

Updated Nov 2026

JavaScript digital signature libraries sign data with a private key and verify the signature with the matching public key. A verified signature shows that the data came from the key holder and has not changed since signing. These libraries sign the login tokens, API requests, software releases, and certificates that apps and services exchange.

Popularity

jose has the most monthly downloads in this comparison, at 878.5M.

LibraryMonthly downloadsStarsLast releaseLicense
jose
878.5M
7.9KNov 2026MIT
node-jws
483.8M
721Dec 2025MIT
node-jwa
481.7M
103May 2025MIT
jsonwebtoken
317.9M
18.2KDec 2025MIT
Forge
211.3M
5.4KNov 2026(BSD-3-Clause OR GPL-2.0)
TweetNaCl.js
195.3M
1.9KFeb 2020Unlicense
@noble/curves
188.7M
972Aug 2026MIT
@peculiar/x509
85.7M
137Oct 2026MIT
Downloads: npm, last thirty days. Stars and releases: GitHub. Amber: no release in over a year.

Libraries and code examples

Provides JSON Web Signature and JSON Web Token APIs.

Downloads / mo
878.5M
Stars
7.9K
Last release
6.2.17
License
MIT

Strengths

  • Supports general JSON signatures. Use GeneralSign to produce a signed JSON JWS envelope.
  • Imports existing PEM keys. Load supported public or private keys with the import helpers.

Limitations

  • Algorithms depend on the runtime. Select an algorithm supported by the target runtime.
  • Private keys start non-extractable. Set extractable when generated private keys must be exported.

Quickstart

From README.md
$ npm install jose
import * as jose from "jose";

const { privateKey } = await jose.generateKeyPair("ES256");
const token = await new jose.SignJWT({ sub: "example" })
  .setProtectedHeader({ alg: "ES256" })
  .sign(privateKey);
console.log(token);

jose examples

From open-source projects on GitHub

Implements JSON Web Signatures.

Downloads / mo
483.8M
Stars
721
Last release
4.0.1
License
MIT

Strengths

  • Synchronous and streaming APIs. Sign with jws.sign, or stream large payloads through jws.createSign.

Limitations

  • No certificate chain signing. Certificate chain signing and verifying fall outside the library.

Quickstart

From readme.md
$ npm install jws
const fs = require("node:fs");
const jws = require("jws");
const privateKey = fs.readFileSync("private.key");
const signature = jws.sign({
  header: { alg: "RS256" }, payload: "example", privateKey,
});

node-jws examples

From open-source projects on GitHub

Implements the JSON Web Algorithms that JWS signing uses.

Downloads / mo
481.7M
Stars
103
Last release
2.0.1
License
MIT

Strengths

  • Returns sign and verify methods. Pick an algorithm such as HS256 to get its sign and verify functions.

Limitations

  • Invalid algorithm names throw. An unknown or miscased algorithm name throws a TypeError.

Quickstart

From README.md
$ npm install jwa
const fs = require("node:fs");
const jwa = require("jwa");
const privateKey = fs.readFileSync("ecdsa-p521-private.pem");
const ecdsa = jwa("ES512");
const signature = ecdsa.sign("very important stuff", privateKey);

node-jwa examples

From open-source projects on GitHub

jsonwebtoken

Signs and verifies JSON Web Tokens with symmetric or asymmetric keys.

Downloads / mo
317.9M
Stars
18.2K
Last release
9.0.3
License
MIT

Strengths

  • Checks expiration, audience, and issuer. jwt.verify returns the payload only after the signature and claims pass.
  • Accepts readable expiry times. Set expiresIn in seconds or as a time-span string.

Quickstart

From README.md
$ npm install jsonwebtoken
const fs = require('node:fs');
const jwt = require('jsonwebtoken');
const privateKey = fs.readFileSync('private.key');
const token = jwt.sign({ foo: 'bar' }, privateKey, { algorithm: 'RS256' });

jsonwebtoken examples

From open-source projects on GitHub
export function parseToken(token: string, secret: any) {
  try {
    return jwt.verify(token, secret);
  } catch {
    return null;
  }
}

Provides RSA and Ed25519 key generation and signature operations.

Downloads / mo
211.3M
Stars
5.4K
Last release
1.4.3
License
(BSD-3-Clause OR GPL-2.0)

Strengths

  • Builds certificate-backed signed messages. Create PKCS signed data with certificates and authenticated attributes.
  • Imports existing PEM public keys. Use publicKeyFromPem to load a PEM-encoded RSA public key.

Limitations

  • Signed-data verification is unfinished. PKCS signed-data verification remains unimplemented; use another verifier for those messages.
  • Synchronous RSA generation blocks execution. Use asynchronous key generation when the event loop must stay responsive.

Quickstart

From README.md
$ npm install node-forge
const forge = require("node-forge");
const ed25519 = forge.pki.ed25519;
const keypair = ed25519.generateKeyPair();
const signature = ed25519.sign({
  message: "test", encoding: "utf8", privateKey: keypair.privateKey,
});

Forge examples

From open-source projects on GitHub

TweetNaCl.js

Ports the TweetNaCl cryptography library to JavaScript.

Downloads / mo
195.3M
Stars
1.9K
Last release
1.0.3
License
Unlicense

Strengths

  • Signs with Ed25519. Generate a key pair with nacl.sign.keyPair and sign byte arrays.
  • Bundles encryption with signing. The same package covers authenticated encryption, hashing, and random bytes.

Quickstart

From README.md
$ npm install tweetnacl
const nacl = require("tweetnacl");
const keypair = nacl.sign.keyPair();
const message = new Uint8Array([1, 2, 3]);
const signature = nacl.sign.detached(message, keypair.secretKey);

TweetNaCl.js examples

From open-source projects on GitHub

@noble/curves

Provides ECDSA, EdDSA, Schnorr, and BLS signing primitives.

Downloads / mo
188.7M
Stars
972
Last release
2.4.0
License
MIT

Strengths

  • Supports several curve signature schemes. Use ECDSA, EdDSA, Schnorr, or BLS through the curve modules.
  • Can sign already-hashed messages. Set prehash=false when passing an existing ECDSA digest.

Limitations

  • Hashes ECDSA messages by default. Disable prehash when the application already supplies the required digest.
  • DER signatures need explicit configuration. Specify the DER format when verifying DER-encoded ECDSA signatures.

Quickstart

From README.md
$ npm install @noble/curves
import { ed25519 } from '@noble/curves/ed25519.js';
const { secretKey, publicKey } = ed25519.keygen();
const msg = new TextEncoder().encode('hello noble');
const sig = ed25519.sign(msg, secretKey);

@noble/curves examples

From open-source projects on GitHub

@peculiar/x509

Generates X.509 certificates and certificate requests and validates certificate chains in TypeScript or JavaScript.

Downloads / mo
85.7M
Stars
137
Last release
3.1.0
License
MIT

Strengths

  • Creates and verifies certificates. Issue, parse, and verify certificates, requests, and revocation lists with WebCrypto.

Limitations

  • Needs a Reflect polyfill. Import reflect-metadata or another Reflect polyfill at the entry point.

Quickstart

From self-signed.example.ts
$ npm install @peculiar/x509 reflect-metadata
import "reflect-metadata";
import * as x509 from "@peculiar/x509";

const algorithm = { name: "ECDSA", namedCurve: "P-256", hash: "SHA-256" };
const keys = await crypto.subtle.generateKey(algorithm, false, ["sign", "verify"]);
const cert = await x509.X509CertificateGenerator.createSelfSigned({
  name: "CN=Example Root CA, O=Example Org, C=US", keys, signingAlgorithm: algorithm,
});

@peculiar/x509 examples

From open-source projects on GitHub

FAQ

jsonwebtoken is a Node.js implementation of JSON Web Tokens built on node-jws. Its verify function returns the decoded payload only when the signature and any expiration, audience, or issuer checks are valid.

Forge, published on npm as node-forge, is a pure JavaScript toolkit for RSA keys, signatures, signed-data messages, and certificates.

A JSON Web Signature (JWS) signs any payload, while a JSON Web Token (JWT) is a set of claims that usually travels inside a JWS. node-jws produces the signatures that jsonwebtoken builds its tokens on.

jose covers JWS, JWT, and encrypted JWE messages across Node.js, browsers, and other web runtimes through WebCrypto. jsonwebtoken targets Node.js and signs and verifies JWTs only.

TweetNaCl.js is a port of the TweetNaCl cryptography library to JavaScript for browsers and Node.js. Its nacl.sign functions create and verify signatures with a public and secret key pair.

jose JWS signing creates signed messages, while its JWE support handles encrypted messages. Forge separately exposes signing/verifying and encryption/decryption APIs.

For coding agents

Found your digital signature library? Help your agent use it.

Connect Exa so your coding agent can find the library’s documentation, check its API, and look up implementations while you build.

Run in your terminal

claude plugin install exa@claude-plugins-official