diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..97c3e07 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +node_modules +.*.sw* diff --git a/README.md b/README.md index a67d988..85131d3 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,7 @@ so you should only script to the documented syntax. ;) * Convert: `keypairs ./priv.pem` * Sign: `keypairs ./priv.pem sign https://example.com/ '{"sub":"jon@example.com"}'` * Verify: `keypairs verify 'xxxxx.yyyyy.zzzzz'` +* Decode: `keypairs decode 'xxxxx.yyyyy.zzzzz'` ## Generate a New Key @@ -130,8 +131,22 @@ keypairs priv.json priv.pem +**Syntax**: + ```bash -keypairs ./priv.pem sign https://example.com/ '{"sub":"jon@example.com"}' 1h +keypairs [key] sign [issuer url] [exp] [nbf] +``` + +_Note: The issuer url can be omitted if it's already included among the claims._ + +Example: + +```bash +keypairs ./priv.pem sign https://example.com/ '{"sub":"jon@example.com"}' 1h -5m +``` + +```bash +keypairs '{"kty":"EC",...}' sign https://example.com/ '{"sub":"jon@example.com"}' 1h -5m ``` ## Verify a JWT (Token) diff --git a/package.json b/package.json index 3425171..75a0109 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,10 @@ "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" ], + "files": [ + "CLI.md", + "bin/keypairs.js" + ], "scripts": { "test": "node test.js" }, @@ -28,6 +31,7 @@ "author": "AJ ONeal (https://coolaj86.com/)", "license": "MPL-2.0", "dependencies": { - "keypairs": "1.x", + "keyfetch": "1.x", + "keypairs": "1.x" } }