Gathering detailed insights and metrics for ts-jose
Gathering detailed insights and metrics for ts-jose
Gathering detailed insights and metrics for ts-jose
Gathering detailed insights and metrics for ts-jose
jose
JWA, JWS, JWE, JWT, JWK, JWKS for Node.js, Browser, Cloudflare Workers, Deno, Bun, and other Web-interoperable runtimes
node-jose
A JavaScript implementation of the JSON Object Signing and Encryption (JOSE) for current web browsers and node.js-based servers
@types/node-jose
TypeScript definitions for node-jose
jwks-rsa
Library to retrieve RSA public keys from a JWKS endpoint
npm install ts-jose
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
3 Stars
266 Commits
1 Watching
2 Branches
1 Contributors
Updated on 21 Oct 2024
TypeScript (99.44%)
Shell (0.56%)
Cumulative downloads
Total Downloads
Last day
-42.5%
1,665
Compared to previous day
Last week
0.9%
11,975
Compared to previous week
Last month
12.6%
50,787
Compared to previous month
Last year
628%
139,102
Compared to previous year
Wrap functions of JOSE in steady interface.
[!Note]
This package's version will FOLLOW the version of JOSE
Additional options
name | Description |
---|---|
kid | Using specific key in JWKS |
jti | Verify payload jti |
1// `key` must be JWK or JWKS. 2await JWT.verify(token, key, options); 3// Use embedded key instead given one. 4await JWT.verify(token, undefined, options);
Using JOSE options
name | Referrer |
---|---|
issuer | setIssuer |
audience | setAudience |
subject | setSubject |
exp | setExpirationTime |
jti | setJti |
notBefore | setNotBefore |
iat | setIssuedAt |
typ | Header |
kid | Header |
alg | Header |
Additional options
name | type | default | description |
---|---|---|---|
jwk | boolean | false | Whether embedded key to header |
1await JWT.sign(payload, key, options); // key must be JWK or JWKS
Additional options
name | Description |
---|---|
kid | Using specific key in JWKS |
enc | Encrypt algorithm |
alg | Key management algorithm |
1await JWT.decrypt(cypher, key, options);
Using JOSE options
name | Referrer |
---|---|
issuer | setIssuer |
audience | setAudience |
subject | setSubject |
exp | setExpirationTime |
jti | setJti |
notBefore | setNotBefore |
iat | setIssuedAt |
typ | Header |
kid | Header |
enc | Header |
alg | Header |
1await JWT.encrypt(payload, key, options);
You can sign pure string.
1await JWS.verify(data, key, options);
Only using below JWT.sign's options:
typ
kid
alg
jwk
1await JWS.sign('some-data', key, options);
You can encrypt pure string.
Additional options
Same as JWT.decrypt
1await JWE.decrypt(cypher, key, options);
Only using below JWT.encrypt's options:
kid
alg
enc
1await JWE.encrypt('some-data', key, options);
1// generate key 2const key: JWK = await JWK.generate('ES256', { 3 kid: 'some-id', 4 use: 'sig', 5 // crv: string, some algorithms need to add curve - EdDSA 6 // modulusLength: number, some algorithms need to add length - RSA 7}); 8 9// object to JWK 10const key: JWK = await JWK.fromObject({ 11 kid: 'some-id', 12 alg: 'ES256', 13 kty: 'EC', 14 crv: 'P-256', 15 x: '123', 16 y: '456', 17 d: '789', 18}); 19 20// JWK to object 21const keyObject: JWKObject = key.toObject(false); // true to output private object, default: false 22 23// private JWK to public JWK 24const newKey: JWK = await key.toPublic(); 25 26// get key's status 27key.isPrivate; 28 29// check key "id", "use", "alg" 30try { 31 // return `this` if all pass 32 key.getKey({ kid: 'some-id', use: 'sig', alg: 'ES256' }); 33} catch (err) { 34 // throw error if this key has different metadata from options 35}
1// object to JWKS 2const keys = await JWKS.fromObject({ 3 keys: [ 4 { 5 alg: 'ES256', 6 kty: 'EC', 7 x: '123', 8 y: '456', 9 }, 10 ], 11}); 12 13// get key from store in specific options 14try { 15 const key: JWK = keys.getKey({ kid: 'some-id', use: 'sig', alg: 'ES256' }); 16} catch (err) { 17 // throw error if not found 18} 19const key: JWK = keys.getKeyByKid('some-id'); 20const key: JWK = keys.getKeyByUse('sig'); 21const key: JWK = keys.getKeyByAlg('ES256'); 22const publicKeys = await keys.toPublic();
No vulnerabilities found.
Reason
12 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 10
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
packaging workflow detected
Details
Reason
Found 0/23 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More