forked from coolaj86/eckles.js
v0.7.2: update docs
This commit is contained in:
parent
882cc4b859
commit
ea13bda056
50
README.md
50
README.md
|
@ -3,16 +3,13 @@ eckles.js
|
|||
|
||||
ECDSA tools. Lightweight. Zero Dependencies. Universal compatibility.
|
||||
|
||||
> I _just_ cleaned up the PEM-to-JWK functionality enough to publish.
|
||||
> I also have the JWK-to-PEM functionality _mostly_ built, but not enough to publish.
|
||||
* [x] PEM-to-JWK
|
||||
* [ ] JWK-to-PEM (partial)
|
||||
|
||||
* P-256 (prime256v1, secp256r1)
|
||||
* P-384 (secp384r1)
|
||||
* SPKI/PKIX
|
||||
* PKCS#8
|
||||
* SEC1/X9.62
|
||||
* PEM-to-JWK
|
||||
* JWK-to-PEM
|
||||
### PEM-to-JWK
|
||||
|
||||
* [x] SEC1/X9.62, PKCS#8, SPKI/PKIX
|
||||
* [x] P-256 (prime256v1, secp256r1), P-384 (secp384r1)
|
||||
|
||||
```js
|
||||
var eckles = require('eckles');
|
||||
|
@ -20,25 +17,40 @@ var pem = require('fs').readFileSync('./fixtures/privkey-ec-p256.sec1.pem', 'asc
|
|||
|
||||
eckles.import({ pem: pem }).then(function (jwk) {
|
||||
console.log(jwk);
|
||||
/*
|
||||
{
|
||||
"kty": "EC",
|
||||
"crv": "P-256",
|
||||
"d": "iYydo27aNGO9DBUWeGEPD8oNi1LZDqfxPmQlieLBjVQ",
|
||||
"x": "IT1SWLxsacPiE5Z16jkopAn8_-85rMjgyCokrnjDft4",
|
||||
"y": "mP2JwOAOdMmXuwpxbKng3KZz27mz-nKWIlXJ3rzSGMo"
|
||||
}
|
||||
*/
|
||||
});
|
||||
```
|
||||
|
||||
```js
|
||||
{
|
||||
"kty": "EC",
|
||||
"crv": "P-256",
|
||||
"d": "iYydo27aNGO9DBUWeGEPD8oNi1LZDqfxPmQlieLBjVQ",
|
||||
"x": "IT1SWLxsacPiE5Z16jkopAn8_-85rMjgyCokrnjDft4",
|
||||
"y": "mP2JwOAOdMmXuwpxbKng3KZz27mz-nKWIlXJ3rzSGMo"
|
||||
}
|
||||
```
|
||||
|
||||
### JWK-to-PEM
|
||||
|
||||
* [x] SEC1/X9.62
|
||||
* [x] P-256 (prime256v1, secp256r1), P-384 (secp384r1)
|
||||
|
||||
|
||||
```js
|
||||
eckles.export({ jwk: jwk }).then(function (pem) {
|
||||
// PEM in pkcs#8 format
|
||||
// PEM in sec1 (x9.62) format
|
||||
console.log(pem);
|
||||
});
|
||||
```
|
||||
|
||||
```
|
||||
-----BEGIN EC PRIVATE KEY-----
|
||||
MHcCAQEEIImMnaNu2jRjvQwVFnhhDw/KDYtS2Q6n8T5kJYniwY1UoAoGCCqGSM49
|
||||
AwEHoUQDQgAEIT1SWLxsacPiE5Z16jkopAn8/+85rMjgyCokrnjDft6Y/YnA4A50
|
||||
yZe7CnFsqeDcpnPbubP6cpYiVcnevNIYyg==
|
||||
-----END EC PRIVATE KEY-----
|
||||
```
|
||||
|
||||
<!--
|
||||
```js
|
||||
eckles.exportSEC1(jwk).then(function (pem) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "eckles",
|
||||
"version": "0.7.1",
|
||||
"version": "0.7.2",
|
||||
"description": "PEM-to-JWK and JWK-to-PEM for ECDSA keys in a lightweight, zero-dependency library focused on perfect universal compatibility.",
|
||||
"homepage": "https://git.coolaj86.com/coolaj86/eckles.js",
|
||||
"main": "index.js",
|
||||
|
|
Loading…
Reference in New Issue