# cose-to-jwk

> COSE (RFC 8152) to JWK (RFC 7517) converter for node.js. Created for WebAuthn.

Latest version **1.1.0** (published 2018-06-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install cose-to-jwk
pnpm add cose-to-jwk
yarn add cose-to-jwk
bun add cose-to-jwk
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2018-06-01 |
| First published | 2018-03-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 85.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | Adam Powers |
| Maintainers | apowers313 |
| Keywords | cose, jwk, webauthn, fido2 |

## Links

- npm: https://www.npmjs.com/package/cose-to-jwk
- Repository: https://github.com/apowers313/cose-to-jwk
- Homepage: https://github.com/apowers313/cose-to-jwk#readme
- Issues: https://github.com/apowers313/cose-to-jwk/issues
- npm.io page: https://npm.io/package/cose-to-jwk

## Dependencies (1)

- [cbor](https://npm.io/package/cbor.md) ^4.0.0

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.1.0 (latest) — 2018-06-01
- 1.0.0 — 2018-03-05
- 0.9.0 — 2018-03-04

## README

## cose-to-jwk

[![Build Status](https://travis-ci.org/apowers313/cose-to-jwk.svg?branch=master)](https://travis-ci.org/apowers313/cose-to-jwk) [![Coverage Status](https://coveralls.io/repos/github/apowers313/cose-to-jwk/badge.svg?branch=master)](https://coveralls.io/github/apowers313/cose-to-jwk?branch=master)

This was created to convert [CBOR Object Signing and Encryption (COSE)](https://tools.ietf.org/html/rfc8152) to [JSON Web Key (JWK)](https://tools.ietf.org/html/rfc7517). I specifically needed this for [WebAuthn](https://www.w3.org/TR/webauthn/) and I'm using it with [jwk-to-pem](https://www.npmjs.com/package/jwk-to-pem) to create PEM strings that work with [Node.js's Crypto library](https://nodejs.org/api/crypto.html).

## Example

``` js
const coseToJwk = require("cose-to-jwk");

// Buffer, ArrayBuffer, Uint8Array, etc. also accepted
const coseArray = [
    0xA5, 0x01, 0x02, 0x03, 0x26, 0x20, 0x01, 0x21, 0x58, 0x20, 0xBB, 0x11, 0xCD, 0xDD, 0x6E, 0x9E,
    0x86, 0x9D, 0x15, 0x59, 0x72, 0x9A, 0x30, 0xD8, 0x9E, 0xD4, 0x9F, 0x36, 0x31, 0x52, 0x42, 0x15,
    0x96, 0x12, 0x71, 0xAB, 0xBB, 0xE2, 0x8D, 0x7B, 0x73, 0x1F, 0x22, 0x58, 0x20, 0xDB, 0xD6, 0x39,
    0x13, 0x2E, 0x2E, 0xE5, 0x61, 0x96, 0x5B, 0x83, 0x05, 0x30, 0xA6, 0xA0, 0x24, 0xF1, 0x09, 0x88,
    0x88, 0xF3, 0x13, 0x55, 0x05, 0x15, 0x92, 0x11, 0x84, 0xC8, 0x6A, 0xCA, 0xC3
];

var jwk = coseToJwk(coseArray);
```

Notes:
* This currently only supports ECDSA and RSA. GitHub pull requests or issues for other crypto suites are welcome.
* This doesn't do any other COSE things (signing, decrypting, etc.)
* This could probably use more testing (although it's not very sophisticated)

---
_Source: https://npm.io/package/cose-to-jwk · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
