1.7.1 • Published 2 months ago

cose-kit v1.7.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

This is an early prototype of a RFC8152 COSE library for node.js.

It is inspired by and uses panva/jose.

Example:

const { importJWK } = require('jose');
const { coseVerify }  = require('cose-kit');

const key = await importJWK(jwk);

const cose = Buffer.from(coseHEX, 'hex');

const { isValid } = await coseVerify(cose, key);

Multi-signature:

const { importJWK } = require('jose');
const { coseVerifyMultiSignature }  = require('cose-kit');

const key = await importJWK(jwk);

const cose = Buffer.from(coseHEX, 'hex');

const { isValid } = await coseVerifyMultiSignature(cose, [ key ]);

X509 certificates:

const { coseVerifyX509 }  = require('cose-kit');

const caRoots = [
  `-----BEGIN CERTIFICATE-----...`
];

const cose = Buffer.from(coseHEX, 'hex');

const { isValid } = await coseVerifyX509(cose, caRoots);

Signing a payload:

const { importJWK } = require('jose');
const { coseSign }  = require('cose-kit');

const key = await importJWK(jwk);

const cose = await coseSign(
  { alg: 'ES256' },
  { ctyp: 0 },
  Buffer.from('hello world', 'utf8'),
  key
);

Using COSE keys:

const { coseSign, importCOSEKey }  = require('cose-kit');
const key = await importCOSEKey(coseKey);
const cose = await coseSign(
  { alg: 'ES256' },
  { ctyp: 0 },
  Buffer.from('hello world', 'utf8'),
  key
);

Credits

License

MIT

1.7.1

2 months ago

2.0.1

2 months ago

2.0.0

2 months ago

1.7.0

6 months ago

1.6.1

6 months ago

1.6.0

6 months ago

1.5.0

6 months ago

1.4.0

6 months ago

1.3.0

7 months ago

1.2.0

7 months ago

1.1.2

7 months ago

1.1.1

7 months ago

1.1.0

7 months ago