@snyk/jwt-cli 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -7,17 +7,17 @@ Your other alternative is to run a full authentication and gateway stack when de
7
7
 
8
8
  **ATTENTION PLEASE:** This tool is designed to help you with local development only - it is probably not safe for generating production keys.
9
9
 
10
- ## Build
11
-
10
+ ## Install
11
+ `jwt-cli` can be installed via npm:
12
12
  ```shell
13
- $ make build
13
+ $ npm i -g @snyk/jwt-cli
14
14
  ```
15
15
 
16
16
  ## Create a JWT
17
17
  To create a token, first you're going to need some keys:
18
18
 
19
19
  ```shell
20
- $ ./bin/jwt keys
20
+ $ $ jwt keys
21
21
  writing jwt_private_key.pem ...
22
22
  writing jwt_public_key.pem ...
23
23
  writing jwt_jwks.json ...
@@ -30,10 +30,18 @@ It will also output your public key in JWK format in case you need to copy that
30
30
  Once you have some keys, you can create a token:
31
31
 
32
32
  ```shell
33
- $ ./bin/jwt create
33
+ $ jwt create
34
34
  eyJhbGciOiJSUzI1NiIsImtpZCI6Imp3dC1jbGkta2V5IiwidHlwIjoiSldUIn0.eyJhdWQiOiJodHRwOi8vbG9jYWxob3N0IiwiYXpwIjoiMWVmZmJlZTUtZGY4ZS00YWU4LTlhNGQtOTJlNGYwMWE4YjQ0IiwiZW50cyI6IiIsImV4cCI6MTY0NjU3OTE1MCwiaWF0IjoxNjQ2NTc5MDkwLCJpc3MiOiJodHRwOi8vbG9jYWxob3N0IiwicHR5cGUiOiJ1c2VyIiwic3ViIjoiZDExMDhiNmYtODM0OS00ZWQxLWI1ZTgtYWY0OTM4OWNiNWQwIn0.RfN5o30tVC-oNnoj5uDDH27TcUxSOFBXLwsd6hqJeYqm4AheV4F4OT5O9CbpK7V9WV3C41i5iN1L5WNjEOR2xtHxVb-nOmKWlwIN2_0B9s03A0FhSbeNKcKKU5K6umLL9f-H03X778i5LoArlOCrOBp6zywK8K8LIuDdGY8erY5ITs_1z8ABafakpZGlAvD2OuJdZX56zTRh_7yJ6lBGVeFWNgIoBK2QlEutVv4o9rWZUIZqsnte1SBu4tXXuk3ykSNrX4p2nFAP08Z-hg78C8ExBrAK7udxo0hdj7Dy27LF8YN0UzD7FD7dbGUyb9AMZk1Iy_lEhMUEQGHAUezq8Q
35
35
  ```
36
36
 
37
+ You can also serve the public key for your signed token via JWKS with:
38
+ ```shell
39
+ $ jwt serve
40
+ Starting JWKS server at port 80
41
+ ```
42
+
43
+ This will make a JWKS server available at [http://localhost/.well-known/jwks.json](http://localhost/.well-known/jwks.json).
44
+
37
45
  ## Validate your JWT
38
46
  Create some keys and a token then head over to [jwt.io](https://jwt.io).
39
47
 
@@ -46,7 +54,7 @@ You can get help with commands by using the in built help function, alternativel
46
54
 
47
55
  ### Keys
48
56
  ```shell
49
- ./bin/jwt help keys
57
+ $ jwt help keys
50
58
  NAME:
51
59
  jwt keys - create signing keys
52
60
 
@@ -59,12 +67,12 @@ OPTIONS:
59
67
 
60
68
  Example of changing the output path for files:
61
69
  ```shell
62
- ./bin/jwt keys --out some/other/path
70
+ $ jwt keys --out some/other/path
63
71
  ```
64
72
 
65
73
  ### Create
66
74
  ```shell
67
- .bin/jwt help create
75
+ $ jwt help create
68
76
  NAME:
69
77
  jwt create - create a jwt
70
78
 
@@ -78,7 +86,7 @@ OPTIONS:
78
86
 
79
87
  You can change the signing PEM with the following:
80
88
  ```shell
81
- ./bin/jwt create --pem some/other/path/private.pem
89
+ $ jwt create --pem some/other/path/private.pem
82
90
  ```
83
91
 
84
92
  You can change the claims in the JWT by creating a claims JSON file:
@@ -94,8 +102,24 @@ You can change the claims in the JWT by creating a claims JSON file:
94
102
 
95
103
  Once you have your claims in a json file, simply use the `--claims` flag to target it:
96
104
  ```shell
97
- ./bin/jwt create -claims jwt-claims.json
105
+ $ jwt create -claims jwt-claims.json
98
106
  ```
99
107
 
108
+ ### Serve
109
+ ```shell
110
+ $ jwt help serve
111
+ NAME:
112
+ jwt serve - serve a jwks server on a local port
113
+
114
+ USAGE:
115
+ jwt serve [command options] [arguments...]
116
+
117
+ OPTIONS:
118
+ --pem value, -p value relative path to the PEM file to serve as JWKS
119
+ --port value, --po value port to serve from (default: 80)
120
+
121
+ ```
100
122
 
123
+ ## Contributing
124
+ Checkout the [contribution guide](CONTRIBUTING.md).
101
125
 
Binary file
Binary file
Binary file
package/bin/jwt-linux-x64 CHANGED
Binary file
package/bin/jwt.exe CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snyk/jwt-cli",
3
- "version": "v0.1.0",
3
+ "version": "v0.3.0",
4
4
  "description": "jwt-cli is a little command line tool to create jwts locally",
5
5
  "bin": {
6
6
  "jwt": "bin/jwt"