Gathering detailed insights and metrics for cose-js
Gathering detailed insights and metrics for cose-js
Gathering detailed insights and metrics for cose-js
Gathering detailed insights and metrics for cose-js
npm install cose-js
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
29 Stars
182 Commits
25 Forks
3 Watching
9 Branches
10 Contributors
Updated on 04 Mar 2024
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
143.3%
1,292
Compared to previous day
Last week
15.8%
7,854
Compared to previous week
Last month
234%
26,697
Compared to previous month
Last year
-7.6%
159,845
Compared to previous year
JavaScript implementation of COSE, RFC8152
1const cose = require('cose-js'); 2try { 3 const plaintext = 'Important message!'; 4 const headers = { 5 p: { alg: 'SHA-256_64' }, 6 u: { kid: 'our-secret' } 7 }; 8 const recipent = { 9 key: Buffer.from('231f4c4d4d3051fdc2ec0a3851d5b383', 'hex') 10 }; 11 const buf = await cose.mac.create(headers, plaintext, recipent); 12 console.log('MACed message: ' + buf.toString('hex')); 13} catch (error) { 14 console.log(error); 15}
1const cose = require('cose-js'); 2try { 3 const key = Buffer.from('231f4c4d4d3051fdc2ec0a3851d5b383', 'hex'); 4 const COSEMessage = Buffer.from('d18443a10104a1044a6f75722d73656372657472496d706f7274616e74206d65737361676521488894981d4aa5d614', 'hex'); 5 const buf = await cose.mac.read(COSEMessage, key); 6 console.log('Verified message: ' + buf.toString('utf8')); 7} catch (error) { 8 console.log(error); 9}
1const cose = require('cose-js'); 2try { 3 const plaintext = 'Important message!'; 4 const headers = { 5 p: { alg: 'ES256' }, 6 u: { kid: '11' } 7 }; 8 const signer = { 9 key: { 10 d: Buffer.from('6c1382765aec5358f117733d281c1c7bdc39884d04a45a1e6c67c858bc206c19', 'hex') 11 } 12 }; 13 const buf = await cose.sign.create(headers, plaintext, signer); 14 console.log('Signed message: ' + buf.toString('hex')); 15} catch (error) { 16 console.log(error); 17}
1const cose = require('cose-js'); 2try { 3 const verifier = { 4 key: { 5 x: Buffer.from('143329cce7868e416927599cf65a34f3ce2ffda55a7eca69ed8919a394d42f0f', 'hex'), 6 y: Buffer.from('60f7f1a780d8a783bfb7a2dd6b2796e8128dbbcef9d3d168db9529971a36e7b9', 'hex') 7 } 8 }; 9 const COSEMessage = Buffer.from('d28443a10126a10442313172496d706f7274616e74206d6573736167652158404c2b6b66dfedc4cfef0f221cf7ac7f95087a4c4245fef0063a0fd4014b670f642d31e26d38345bb4efcdc7ded3083ab4fe71b62a23f766d83785f044b20534f9', 'hex'); 10 const buf = await cose.sign.verify(COSEMessage, verifier); 11 console.log('Verified message: ' + buf.toString('utf8')); 12} catch (error) { 13 console.log(error); 14}
1const cose = require('cose-js'); 2try { 3 const plaintext = 'Secret message!'; 4 const headers = { 5 p: { alg: 'A128GCM' }, 6 u: { kid: 'our-secret' } 7 }; 8 const recipient = { 9 key: Buffer.from('231f4c4d4d3051fdc2ec0a3851d5b383', 'hex') 10 }; 11 const buf = await cose.encrypt.create(headers, plaintext, recipient); 12 console.log('Encrypted message: ' + buf.toString('hex')); 13} catch (error) { 14 console.log(error); 15}
1const cose = require('cose-js'); 2try { 3 const key = Buffer.from('231f4c4d4d3051fdc2ec0a3851d5b383', 'hex'); 4 const COSEMessage = Buffer.from('d8608443a10101a2044a6f75722d736563726574054c291a40271067ff57b1623c30581f23b663aaf9dfb91c5a39a175118ad7d72d416385b1b610e28b3b3fd824a397818340a040', 'hex'); 5 const buf = await cose.encrypt.read(COSEMessage, key); 6 console.log('Protected message: ' + buf.toString('utf8')); 7} catch (error) { 8 console.log(error); 9}
npm install cose-js --save
npm test
No vulnerabilities found.
Reason
no vulnerabilities detected
Reason
no dangerous workflow patterns detected
Reason
tokens are read-only in GitHub workflows
Reason
license file detected
Details
Reason
all dependencies are pinned
Details
Reason
no binaries found in the repo
Reason
update tool detected
Details
Reason
GitHub code reviews found for 6 commits out of the last 30 -- score normalized to 2
Details
Reason
0 commit(s) out of 30 and 0 issue activity out of 21 found in the last 90 days -- score normalized to 0
Reason
no badge detected
Reason
branch protection not enabled on development/release branches
Details
Reason
security policy file not detected
Reason
project is not fuzzed
Score
Last Scanned on 2022-08-15
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