v2.0.0: remove old deps, light cleanup

This commit is contained in:
AJ ONeal 2018-12-16 03:08:59 -07:00
parent 7580d700bf
commit 3db8b49929
2 changed files with 27 additions and 19 deletions

View File

@ -1,4 +1,5 @@
# rsa-compat.js # [rsa-compat.js](https://git.coolaj86.com/coolaj86/rsa-compat.js)
!["Lifetime Downloads"](https://img.shields.io/npm/dt/rsa-compat.svg "Lifetime Download Count can't be shown") !["Lifetime Downloads"](https://img.shields.io/npm/dt/rsa-compat.svg "Lifetime Download Count can't be shown")
!["Monthly Downloads"](https://img.shields.io/npm/dm/rsa-compat.svg "Monthly Download Count can't be shown") !["Monthly Downloads"](https://img.shields.io/npm/dm/rsa-compat.svg "Monthly Download Count can't be shown")
!["Weekly Downloads"](https://img.shields.io/npm/dw/rsa-compat.svg "Weekly Download Count can't be shown") !["Weekly Downloads"](https://img.shields.io/npm/dw/rsa-compat.svg "Weekly Download Count can't be shown")
@ -7,9 +8,6 @@
JavaScript RSA utils that work on Windows, Mac, and Linux with or without C compiler JavaScript RSA utils that work on Windows, Mac, and Linux with or without C compiler
This now uses node-native RSA key generation and lightweight, zero-dependency solutions for key conversion.
However, it also optionally depends on `ursa` and `forge` for backwards compatibility with older node versions.
This was built for the [ACME.js](https://git.coolaj86.com/coolaj86/acme.js) and This was built for the [ACME.js](https://git.coolaj86.com/coolaj86/acme.js) and
[Greenlock.js](https://git.coolaj86.com/coolaj86/greenlock.js) **Let's Encrypt** clients [Greenlock.js](https://git.coolaj86.com/coolaj86/greenlock.js) **Let's Encrypt** clients
and is particularly suitable for building **certbot**-like clients. and is particularly suitable for building **certbot**-like clients.
@ -24,6 +22,8 @@ node.js
npm install --save rsa-compat npm install --save rsa-compat
``` ```
If you need compatibility with older versions of node, you may need to `npm install --save ursa-optional node-forge`.
### CLI ### CLI
```bash ```bash
@ -80,16 +80,9 @@ Here's what the object might look like:
, n: '/*base64 modulus n = pq*/' , n: '/*base64 modulus n = pq*/'
, e: '/*base64 exponent (usually 65537)*/' , e: '/*base64 exponent (usually 65537)*/'
} }
, _ursa: '/*undefined or intermediate ursa object*/'
, _ursaPublic: '/*undefined or intermediate ursa object*/'
, _forge: '/*undefined or intermediate forge object*/'
, _forgePublic: '/*undefined or intermediate forge object*/'
} }
``` ```
NOTE: this object is JSON safe as _ursa and _forge will be ignored
See http://crypto.stackexchange.com/questions/6593/what-data-is-saved-in-rsa-private-key to learn a little more about the meaning of the specific fields in the JWK. See http://crypto.stackexchange.com/questions/6593/what-data-is-saved-in-rsa-private-key to learn a little more about the meaning of the specific fields in the JWK.
# API Summary # API Summary
@ -106,6 +99,7 @@ See http://crypto.stackexchange.com/questions/6593/what-data-is-saved-in-rsa-pri
* (deprecated `RSA.signJws(keypair, payload, nonce)`) * (deprecated `RSA.signJws(keypair, payload, nonce)`)
* `RSA.generateCsrPem(keypair, names)` * `RSA.generateCsrPem(keypair, names)`
* `RSA.generateCsrDerWeb64(keypair, names)` * `RSA.generateCsrDerWeb64(keypair, names)`
* `RSA.thumbprint(keypair)`
`keypair` can be any object with any of these keys `publicKeyPem, privateKeyPem, publicKeyJwk, privateKeyJwk` `keypair` can be any object with any of these keys `publicKeyPem, privateKeyPem, publicKeyJwk, privateKeyJwk`
@ -195,6 +189,21 @@ The result looks like this:
} }
``` ```
### RSA.thumbprint(keypair)
Generates a JWK thumbprint.
`RSA.thumbprint(keypair)`:
```javascript
var thumb = RSA.thumbprint(keypair);
console.log(thumb);
```
```
// kK4OXp5CT1FEkHi6WkegldmeTJecSTyJN-DxZ91nQ30
```
### RSA.generateCsr*(keypair, names) ### RSA.generateCsr*(keypair, names)
You can generate the CSR in human-readable or binary / base64 formats: You can generate the CSR in human-readable or binary / base64 formats:
@ -257,9 +266,12 @@ but it does matter.
# ChangeLog: # ChangeLog:
* v2.0.0
* remove ursa and node-forge as strict dependencies
* v1.9.0 * v1.9.0
* consistently handle key generation across node crypto, ursa, and forge * consistently handle key generation across node crypto, ursa, and forge
* move all other operations to rasha.js and rsa-csr.js * move all other operations to rasha.js and rsa-csr.js
* bugfix non-standard JWKs output (which *mostly* worked)
* v1.4.0 * v1.4.0
* remove ursa as dependency (just causes confusion), but note in docs * remove ursa as dependency (just causes confusion), but note in docs
* drop node < v6 support * drop node < v6 support

View File

@ -1,6 +1,6 @@
{ {
"name": "rsa-compat", "name": "rsa-compat",
"version": "1.9.0", "version": "2.0.0",
"description": "RSA utils that work on Windows, Mac, and Linux with or without C compiler", "description": "RSA utils that work on Windows, Mac, and Linux with or without C compiler",
"main": "index.js", "main": "index.js",
"bin": { "bin": {
@ -33,13 +33,9 @@
"url": "https://git.coolaj86.com/coolaj86/rsa-compat.js/issues" "url": "https://git.coolaj86.com/coolaj86/rsa-compat.js/issues"
}, },
"homepage": "https://git.coolaj86.com/coolaj86/rsa-compat.js#readme", "homepage": "https://git.coolaj86.com/coolaj86/rsa-compat.js#readme",
"dependencies": {
"node-forge": "^0.7.6"
},
"optionalDependencies": {
"ursa-optional": "^0.9.10"
},
"trulyOptionalDependencies": { "trulyOptionalDependencies": {
"buffer-v6-polyfill": "^1.0.3" "buffer-v6-polyfill": "^1.0.3",
"node-forge": "^0.7.6",
"ursa-optional": "^0.9.10"
} }
} }