Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 893bccd8d5 | |||
| 2a8b5d7981 | |||
| 9c3fc08a57 | |||
| 02a32b88e3 |
@ -74,7 +74,9 @@ args.forEach(function (arg) {
|
||||
console.error("EC keys do not have bit lengths such as '" + opts.modulusLength + "'. Choose either the P-256 or P-384 'curve' instead.");
|
||||
process.exit(1);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if ('rsa' === larg) {
|
||||
set('kty', "RSA");
|
||||
if (opts.namedCurve) {
|
||||
@ -234,6 +236,9 @@ function guess(txt, filename) {
|
||||
return true;
|
||||
}
|
||||
} catch(e) {
|
||||
if (setJwt(txt.trim())) {
|
||||
return true;
|
||||
}
|
||||
try {
|
||||
var jwk = Eckles.importSync({ pem: txt });
|
||||
// pem._string = txt;
|
||||
@ -532,7 +537,7 @@ function writeFile(name, key, priv) {
|
||||
} catch(e) {
|
||||
// the file does not exist (or cannot be accessed)
|
||||
}
|
||||
fs.writeFileSync(name, key);
|
||||
fs.writeFileSync(name, key + "\n");
|
||||
if (overwrite) {
|
||||
console.info("Overwrote " + (priv ? "private" : "public") + " key at '" + name + "'");
|
||||
} else {
|
||||
|
||||
42
package-lock.json
generated
Normal file
42
package-lock.json
generated
Normal file
@ -0,0 +1,42 @@
|
||||
{
|
||||
"name": "keypairs-cli",
|
||||
"version": "1.2.4",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"@coolaj86/urequest": {
|
||||
"version": "1.3.7",
|
||||
"resolved": "https://registry.npmjs.org/@coolaj86/urequest/-/urequest-1.3.7.tgz",
|
||||
"integrity": "sha512-PPrVYra9aWvZjSCKl/x1pJ9ZpXda1652oJrPBYy5rQumJJMkmTBN3ux+sK2xAUwVvv2wnewDlaQaHLxLwSHnIA=="
|
||||
},
|
||||
"eckles": {
|
||||
"version": "1.4.1",
|
||||
"resolved": "https://registry.npmjs.org/eckles/-/eckles-1.4.1.tgz",
|
||||
"integrity": "sha512-auWyk/k8oSkVHaD4RxkPadKsLUcIwKgr/h8F7UZEueFDBO7BsE4y+H6IMUDbfqKIFPg/9MxV6KcBdJCmVVcxSA=="
|
||||
},
|
||||
"keyfetch": {
|
||||
"version": "1.1.8",
|
||||
"resolved": "https://registry.npmjs.org/keyfetch/-/keyfetch-1.1.8.tgz",
|
||||
"integrity": "sha512-a8E1E25mHiv2zZnrBM6WNfQi4hG43TgVg1JG/D61WiTBAM07OJzSuy3j00H2pWPF6MCofBmA+KTzSu145nZWuA==",
|
||||
"requires": {
|
||||
"@coolaj86/urequest": "^1.3.6",
|
||||
"eckles": "^1.4.0",
|
||||
"rasha": "^1.2.1"
|
||||
}
|
||||
},
|
||||
"keypairs": {
|
||||
"version": "1.2.12",
|
||||
"resolved": "https://registry.npmjs.org/keypairs/-/keypairs-1.2.12.tgz",
|
||||
"integrity": "sha512-zYjYdDvo7G4AIkkZVM3WEJBTRUIrFzYswYNqCxcCPHUsgbBBdewSHAH1CiaQ+VA6Yb7BLEPIv8gFrRz5wJrgsw==",
|
||||
"requires": {
|
||||
"eckles": "^1.4.1",
|
||||
"rasha": "^1.2.4"
|
||||
}
|
||||
},
|
||||
"rasha": {
|
||||
"version": "1.2.4",
|
||||
"resolved": "https://registry.npmjs.org/rasha/-/rasha-1.2.4.tgz",
|
||||
"integrity": "sha512-GsIwKv+hYSumJyK9wkTDaERLwvWaGYh1WuI7JMTBISfYt13TkKFU/HFzlY4n72p8VfXZRUYm0AqaYhkZVxOC3Q=="
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,11 +1,10 @@
|
||||
{
|
||||
"name": "keypairs-cli",
|
||||
"version": "1.2.1",
|
||||
"version": "1.2.5",
|
||||
"description": "CLI for Keypairs.js",
|
||||
"homepage": "https://git.coolaj86.com/coolaj86/keypairs-cli.js",
|
||||
"main": "bin/keypairs-cli.js",
|
||||
"files": [
|
||||
"CLI.md",
|
||||
"bin/keypairs.js"
|
||||
],
|
||||
"scripts": {
|
||||
@ -31,7 +30,7 @@
|
||||
"author": "AJ ONeal <coolaj86@gmail.com> (https://coolaj86.com/)",
|
||||
"license": "MPL-2.0",
|
||||
"dependencies": {
|
||||
"keyfetch": "1.x",
|
||||
"keypairs": "1.x"
|
||||
"keyfetch": "^1.1.8",
|
||||
"keypairs": "^1.2.12"
|
||||
}
|
||||
}
|
||||
|
||||
15
test.sh
Normal file
15
test.sh
Normal file
@ -0,0 +1,15 @@
|
||||
set -e
|
||||
echo ""
|
||||
echo ""
|
||||
node bin/keypairs-cli.js gen > ./fixture.ec.jwk.json 2> ./fixture.ec.jwk.pub.json
|
||||
node bin/keypairs-cli.js ./fixture.ec.jwk.json pkcs8 > fixture.ec.pem
|
||||
node bin/keypairs-cli.js ./fixture.ec.pem > ./fixture.ec.jwk.json
|
||||
|
||||
node bin/keypairs-cli.js gen rsa > ./fixture.rsa.jwk.json 2> ./fixture.rsa.jwk.pub.json
|
||||
node bin/keypairs-cli.js ./fixture.rsa.jwk.json pkcs1 > fixture.rsa.pem
|
||||
node bin/keypairs-cli.js ./fixture.rsa.pem > ./fixture.rsa.jwk.json
|
||||
|
||||
node bin/keypairs-cli.js ./fixture.ec.jwk.json sign https://localhost:4080 '{}' 3d > works.txt;
|
||||
node bin/keypairs-cli.js ./fixture.ec.jwk.pub.json decode works.txt
|
||||
#node bin/keypairs-cli.js ./fixture.ec.jwk.pub.json decode works.txt
|
||||
node bin/keypairs-cli.js ./fixture.ec.jwk.json sign https://localhost:4080 '{}' 3d > works.txt;
|
||||
Loading…
x
Reference in New Issue
Block a user