@snyk/jwt-cli 0.1.0 → 0.2.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 +11 -10
- package/package.json +1 -1
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
|
-
##
|
|
11
|
-
|
|
10
|
+
## Install
|
|
11
|
+
`jwt-cli` can be installed via npm:
|
|
12
12
|
```shell
|
|
13
|
-
$
|
|
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
|
-
$
|
|
20
|
+
$ $ jwt keys
|
|
21
21
|
writing jwt_private_key.pem ...
|
|
22
22
|
writing jwt_public_key.pem ...
|
|
23
23
|
writing jwt_jwks.json ...
|
|
@@ -30,7 +30,7 @@ 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
|
-
$
|
|
33
|
+
$ jwt create
|
|
34
34
|
eyJhbGciOiJSUzI1NiIsImtpZCI6Imp3dC1jbGkta2V5IiwidHlwIjoiSldUIn0.eyJhdWQiOiJodHRwOi8vbG9jYWxob3N0IiwiYXpwIjoiMWVmZmJlZTUtZGY4ZS00YWU4LTlhNGQtOTJlNGYwMWE4YjQ0IiwiZW50cyI6IiIsImV4cCI6MTY0NjU3OTE1MCwiaWF0IjoxNjQ2NTc5MDkwLCJpc3MiOiJodHRwOi8vbG9jYWxob3N0IiwicHR5cGUiOiJ1c2VyIiwic3ViIjoiZDExMDhiNmYtODM0OS00ZWQxLWI1ZTgtYWY0OTM4OWNiNWQwIn0.RfN5o30tVC-oNnoj5uDDH27TcUxSOFBXLwsd6hqJeYqm4AheV4F4OT5O9CbpK7V9WV3C41i5iN1L5WNjEOR2xtHxVb-nOmKWlwIN2_0B9s03A0FhSbeNKcKKU5K6umLL9f-H03X778i5LoArlOCrOBp6zywK8K8LIuDdGY8erY5ITs_1z8ABafakpZGlAvD2OuJdZX56zTRh_7yJ6lBGVeFWNgIoBK2QlEutVv4o9rWZUIZqsnte1SBu4tXXuk3ykSNrX4p2nFAP08Z-hg78C8ExBrAK7udxo0hdj7Dy27LF8YN0UzD7FD7dbGUyb9AMZk1Iy_lEhMUEQGHAUezq8Q
|
|
35
35
|
```
|
|
36
36
|
|
|
@@ -46,7 +46,7 @@ You can get help with commands by using the in built help function, alternativel
|
|
|
46
46
|
|
|
47
47
|
### Keys
|
|
48
48
|
```shell
|
|
49
|
-
|
|
49
|
+
$ jwt help keys
|
|
50
50
|
NAME:
|
|
51
51
|
jwt keys - create signing keys
|
|
52
52
|
|
|
@@ -59,7 +59,7 @@ OPTIONS:
|
|
|
59
59
|
|
|
60
60
|
Example of changing the output path for files:
|
|
61
61
|
```shell
|
|
62
|
-
|
|
62
|
+
$ jwt keys --out some/other/path
|
|
63
63
|
```
|
|
64
64
|
|
|
65
65
|
### Create
|
|
@@ -78,7 +78,7 @@ OPTIONS:
|
|
|
78
78
|
|
|
79
79
|
You can change the signing PEM with the following:
|
|
80
80
|
```shell
|
|
81
|
-
|
|
81
|
+
$ jwt create --pem some/other/path/private.pem
|
|
82
82
|
```
|
|
83
83
|
|
|
84
84
|
You can change the claims in the JWT by creating a claims JSON file:
|
|
@@ -94,8 +94,9 @@ You can change the claims in the JWT by creating a claims JSON file:
|
|
|
94
94
|
|
|
95
95
|
Once you have your claims in a json file, simply use the `--claims` flag to target it:
|
|
96
96
|
```shell
|
|
97
|
-
|
|
97
|
+
$ jwt create -claims jwt-claims.json
|
|
98
98
|
```
|
|
99
99
|
|
|
100
|
-
|
|
100
|
+
## Contributing
|
|
101
|
+
Checkout the [contribution guide](CONTRIBUTING.md).
|
|
101
102
|
|