output json in example

This commit is contained in:
AJ ONeal 2018-11-19 08:53:52 -07:00
parent c551f1a6b3
commit 1d050b5991
3 changed files with 14 additions and 2 deletions

View File

@ -13,8 +13,20 @@ ECDSA tools. Lightweight. Zero Dependencies. Universal compatibility.
* PEM-to-JWK
```js
var eckles = require('eckles');
var pem = require('fs').readFileSync('./fixtures/privkey-ec-p256.sec1.pem', 'ascii')
eckles.import({ pem: pem }).then(function (jwk) {
console.log(jwk);
/*
{
"kty": "EC",
"crv": "P-256",
"d": "iYydo27aNGO9DBUWeGEPD8oNi1LZDqfxPmQlieLBjVQ",
"x": "IT1SWLxsacPiE5Z16jkopAn8_-85rMjgyCokrnjDft4",
"y": "mP2JwOAOdMmXuwpxbKng3KZz27mz-nKWIlXJ3rzSGMo"
}
*/
});
```

View File

@ -10,5 +10,5 @@ var infile = process.argv[2];
var keypem = fs.readFileSync(infile, 'ascii');
eckles.import({ pem: keypem }).then(function (jwk) {
console.log(jwk);
console.log(JSON.stringify(jwk, null, 2));
});

View File

@ -1,6 +1,6 @@
{
"name": "eckles",
"version": "0.1.0",
"version": "0.1.1",
"description": "A focused, zero-dependency library for perfect universal ECDSA P-256 (prime256v1, secp256r1) and P-384 (secp384r1) support.",
"main": "index.js",
"bin": {