The maintainer has not written a description at the source.
Repo cisco/node-jose, read from GitHub 14 min ago. cisco has not joined Take My Repo.
cisco/node-jose is a public repo on GitHub by cisco. It declares the Apache-2.0 license on GitHub. It is written mainly in JavaScript, has 721 stars and last changed on 2024-08-12. Nobody has reviewed it on Take My Repo yet, which says nothing about its quality. Read from GitHub on 2026-11-24.
In the maintainer's words. Shown from GitHub; Take My Repo does not keep a copy.
A JavaScript implementation of the JSON Object Signing and Encryption (JOSE) for current web browsers and node.js-based servers. This library implements (wherever possible) all algorithms, formats, and options in JWS, JWE, JWK, and JWA and uses native cryptographic support (WebCrypto API or node.js' "crypto" module) where feasible.
To install the latest from NPM:
npm install node-jose
Or to install a specific release:
npm install node-jose@0.3.0
Alternatively, the latest unpublished code can be installed directly from the repository:
npm install git+https://github.com/cisco/node-jose.git
Require the library as normal:
var jose = require('node-jose');
This library uses Promises for nearly every operation.
This library supports Browserify and Webpack. To use in a web browser, require('node-jose') and bundle with the rest of your app.
The content to be signed/encrypted -- or returned from being verified/decrypted -- are Buffer objects.
The jose.JWK namespace deals with JWK and JWK-sets.
jose.JWK.Key is a logical representation of a JWK, and is the "raw" entry point for various cryptographic operations (e.g., sign, verify, encrypt, decrypt).jose.JWK.KeyStore represents a collection of Keys.Creating a JWE or JWS ultimately require one or more explicit Key objects.
Processing a JWE or JWS relies on a KeyStore.
To create an empty keystore:
keystore = jose.JWK.createKeyStore();
To import a JWK-set as a keystore:
// {input} is a String or JSON object representing the JWK-set
jose.JWK.asKeyStore(input).
then(function(result) {
// {result} is a jose.JWK.KeyStore
keystore = result;
});
To export the public keys of a keystore as a JWK-set:
output = keystore.toJSON();
To export all the keys of a keystore:
output = keystore.toJSON(true);
To retrieve a key from a keystore:
// by 'kid'
key = keystore.get(kid);
This retrieves the first key that matches the given {kid}. If multiple keys have the same {kid}, you can further narrow what to retrieve:
// ... and by 'kty'
key = keystore.get(kid, { kty: 'RSA' });
// ... and by 'use'
key = keystore.get(kid, { use: 'enc' });
// ... and by 'alg'
key = keystore.get(kid, { use: 'RSA-OAEP' });
// ... and by 'kty' and 'use'
key = keystore.get(kid, { kty: 'RSA', use: 'enc' });
// same as above, but with a single {props} argument
key = keystore.get({ kid: kid, kty: 'RSA', use: 'enc' });
To retrieve all the keys from a keystore:
everything = keystore.all();
all() can be filtered much like get():
// filter by 'kid'
everything = keystore.all({ kid: kid });
// filter by 'kty'
everything = keystore.all({ kty: 'RSA' });
// filter by 'use'
everything = keystore.all({ use: 'enc' });
// filter by 'alg'
everything = keystore.all({ alg: 'RSA-OAEP' });
// filter by 'kid' + 'kty' + 'alg'
everything = keystore.all({ kid: kid, kty: 'RSA', alg: 'RSA-OAEP' });
To import an existing Key (as a JSON object or Key instance):
// input is either a:
// * jose.JWK.Key to copy from; or
// * JSON object representing a JWK; or
keystore.add(input).
then(function(result) {
// {result} is a jose.JWK.Key
key = result;
});
To import and existing Key from a PEM or DER:
// input is either a:
// * String serialization of a JSON JWK/(base64-encoded) PEM/(binary-encoded) DER
// * Buffer of a JSON JWK/(base64-encoded) PEM/(binary-encoded) DER
// form is either a:
// * "json" for a JSON stringified JWK
// * "private" for a DER encoded 'raw' private key
// * "pkcs8" for a DER encoded (unencrypted!) PKCS8 private key
// * "public" for a DER encoded SPKI public key (alternate to 'spki')
// * "spki" for a DER encoded SPKI public key
// * "pkix" for a DER encoded PKIX X.509 certificate
// * "x509" for a DER encoded PKIX X.509 certificate
// * "pem" for a PEM encoded of PKCS8 / SPKI / PKIX
keystore.add(input, form).
then(function(result) {
// {result} is a jose.JWK.Key
});
To generate a new Key:
// first argument is the key type (kty)
// second is the key size (in bits) or named curve ('crv') for "EC"
keystore.generate("oct", 256).
then(function(result) {
// {result} is a jose.JWK.Key
key = result;
});
// ... with properties
var props = {
kid: 'gBdaS-G8RLax2qgObTD94w',
alg: 'A256GCM',
use: 'enc'
};
keystore.generate("oct", 256, props).
then(function(result) {
// {result} is a jose.JWK.Key
key = result;
});
To remove a Key from its Keystore:
keystore.remove(key);
// NOTE: key.keystore does not change!!
To create a single "stand alone" key:
jose.JWK.createKey("oct", 256, { alg: "A256GCM" }).
then(function(result) {
// {result} is a jose.JWK.Key
// {result.keystore} is a unique jose.JWK.KeyStore
});
To import a single Key:
// where input is either a:
// * jose.JWK.Key instance
// * JSON Object representation of a JWK
jose.JWK.asKey(input).
then(function(result) {
// {result} is a jose.JWK.Key
// {result.keystore} is a unique jose.JWK.KeyStore
});
// where input is either a:
// * String serialization of a JSON JWK/(base64-encoded) PEM/(binary-encoded) DER
// * Buffer of a JSON JWK/(base64-encoded) PEM/(binary-encoded) DER
// form is either a:
// * "json" for a JSON stringified JWK
// * "pkcs8" for a DER encoded (unencrypted!) PKCS8 private key
// * "spki" for a DER encoded SPKI public key
// * "pkix" for a DER encoded PKIX X.509 certificate
// * "x509" for a DER encoded PKIX X.509 certificate
// * "pem" for a PEM encoded of PKCS8 / SPKI / PKIX
jose.JWK.asKey(input, form).
then(function(result) {
// {result} is a jose.JWK.Key
// {result.keystore} is a unique jose.JWK.KeyStore
});
To export the public portion of a Key as a JWK:
var output = key.toJSON();
To export the public and private portions of a Key:
var output = key.toJSON(true);
To get or calculate a RFC 7638 thumbprint for a key:
// where hash is a supported algorithm, currently one of:
// * SHA-1
// * SHA-256
// * SHA-384
// * SHA-512
key.thumbprint(hash).
then(function(print) {
// {print} is a Buffer containing the thumbprint binary value
});
When importing or generating a key that does not have a "kid" defined, a "SHA-256" thumbprint is calculated and used as the "kid".
When signing content, the key is expected to meet one of the following:
"kty":"oct")"kty":"EC" or "kty":"RSA") key pairWhen verifying content, the key is expected to meet one of the following:
"kty":"oct")"kty":"EC" or "kty":"RSA") key pairAt its simplest, to create a JWS:
// {input} is a Buffer
jose.JWS.createSign(key).
update(input).
final().
then(function(result) {
// {result} is a JSON object -- JWS using the JSON General Serialization
});
The JWS is signed using the preferred algorithm appropriate for the given Key. The preferred algorithm is the first item returned by key.algorithms("sign").
To create a JWS using another serialization format:
jose.JWS.createSign({ format: 'flattened' }, key).
update(input).
final().
then(function(result) {
// {result} is a JSON object -- JWS using the JSON Flattened Serialization
});
jose.JWS.createSign({ format: 'compact' }, key).
update(input).
final().
then(function(result) {
// {result} is a String -- JWS using the Compact Serialization
});
To create a JWS using a specific algorithm:
jose.JWS.createSign({ fields: { alg: 'PS256' } }, key).
update(input).
final().
then(function(result) {
// ....
});
To create a JWS for a specified content type:
jose.JWS.createSign({ fields: { cty: 'jwk+json' } }, key).
update(input).
final().
then(function(result) {
// ....
});
To create a JWS from String content:
jose.JWS.createSign(key).
update(input, "utf8").
final().
then(function(result) {
// ....
});
To create a JWS with multiple signatures:
// {keys} is an Array of jose.JWK.Key instances
jose.JWS.createSign(keys).
update(input).
final().
then(function(result) {
// ....
});
To verify a JWS, and retrieve the payload:
jose.JWS.createVerify(keystore).
verify(input).
then(function(result) {
// {result} is a Object with:
// * header: the combined 'protected' and 'unprotected' header members
// * payload: Buffer of the signed content
// * signature: Buffer of the verified signature
// * key: The key used to verify the signature
});
To verify using an implied Key:
// {key} can be:
// * jose.JWK.Key
// * JSON object representing a JWK
jose.JWS.createVerify(key).
verify(input).
then(function(result) {
// ...
});
To verify using a key embedded in the JWS:
jose.JWS.createVerify().
verify(input, { allowEmbeddedKey: true }).
then(function(result) {
// ...
});
Alternatively, a cached createVerify() can be configured to allow an embedded key:
var verifier = jose.JWS.createVerify({ allowEmbeddedKey: true });
verifier.verify(input).
then(function(result) {
// ...
});
The key can be embedded using either 'jwk' or 'x5c', and can be located in either the JWS Unprotected Header or JWS Protected Header.
NOTE: verify() will use the embedded key (if found and permitted) instead of any other key.
To restrict what signature algorithms are allowed when verifying, add the algorithms member to the options Object. The algorithms member is either a string or an array of strings, where the string value(s) can be one of the following:
"*": accept all supported algorithms<alg name> (e.g., "PS256"): accept the specific algorithm (can have a single '*' to match a range of algorithms)!<alg name> (e.g., "!RS256"): do not accept the specific algorithm (can have a single '*' to match a range of algorithms)The negation is intended to be used with the wildcard accept string, and disallow takes precedence over allowed.
To only accept RSA-PSS sigatures:
cisco/node-jose is a public repo on GitHub by cisco. Its maker has not written a description.
It declares the Apache-2.0 license on GitHub.
Its maker has not tagged a system, so it is unknown here. Its README says what it needs.
Open "Take it" on its page: Take My Repo writes an install plan for your machine and hands it to your AI agent (Claude Code, Codex or Cursor), which asks you before each step. Take My Repo has not tested it on any machine.
Its last change on GitHub was on 2024-08-12. GitHub counts 75 open issues and pull requests. Take My Repo does not judge from that whether it is maintained.
Nobody has reviewed it on Take My Repo yet, which says nothing about its quality.
Take My Repo cannot say: it does not audit code and has not run node-jose. What is known comes from GitHub. It declares the Apache-2.0 license on GitHub. Its last change was on 2024-08-12. It has 721 stars, which measure popularity, not safety. Nobody has reviewed it on Take My Repo yet, which says nothing about its quality. Read the source before you run it. With "Take it", your AI agent shows each step and asks you before running it; README text is treated as data, not as instructions.