@snyk/jwt-cli 0.3.0 → 0.3.1
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 +28 -1
- package/bin/jwt-darwin-arm64 +0 -0
- package/bin/jwt-darwin-x64 +0 -0
- package/bin/jwt-linux-arm64 +0 -0
- package/bin/jwt-linux-x64 +0 -0
- package/bin/jwt.exe +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,6 +13,11 @@ Your other alternative is to run a full authentication and gateway stack when de
|
|
|
13
13
|
$ npm i -g @snyk/jwt-cli
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
+
or the Go toolchain:
|
|
17
|
+
```shell
|
|
18
|
+
go install github.com/snyk/jwt-cli/cmd@v0.3.0
|
|
19
|
+
```
|
|
20
|
+
|
|
16
21
|
## Create a JWT
|
|
17
22
|
To create a token, first you're going to need some keys:
|
|
18
23
|
|
|
@@ -43,7 +48,29 @@ Starting JWKS server at port 80
|
|
|
43
48
|
This will make a JWKS server available at [http://localhost/.well-known/jwks.json](http://localhost/.well-known/jwks.json).
|
|
44
49
|
|
|
45
50
|
## Validate your JWT
|
|
46
|
-
|
|
51
|
+
|
|
52
|
+
You can quickly print a tokens claims using `jq`:
|
|
53
|
+
```shell
|
|
54
|
+
$ jq -R 'split(".") | .[0],.[1] | @base64d | fromjson' <<< "eyJhbGciOiJSUzI1NiIsImtpZCI6Imp3dC1jbGkta2V5IiwidHlwIjoiSldUIn0.eyJhdWQiOiJodHRwOi8vbG9jYWxob3N0IiwiYXpwIjoiMWVmZmJlZTUtZGY4ZS00YWU4LTlhNGQtOTJlNGYwMWE4YjQ0IiwiZW50cyI6IiIsImV4cCI6MTY0NjU3OTE1MCwiaWF0IjoxNjQ2NTc5MDkwLCJpc3MiOiJodHRwOi8vbG9jYWxob3N0IiwicHR5cGUiOiJ1c2VyIiwic3ViIjoiZDExMDhiNmYtODM0OS00ZWQxLWI1ZTgtYWY0OTM4OWNiNWQwIn0.RfN5o30tVC-oNnoj5uDDH27TcUxSOFBXLwsd6hqJeYqm4AheV4F4OT5O9CbpK7V9WV3C41i5iN1L5WNjEOR2xtHxVb-nOmKWlwIN2_0B9s03A0FhSbeNKcKKU5K6umLL9f-H03X778i5LoArlOCrOBp6zywK8K8LIuDdGY8erY5ITs_1z8ABafakpZGlAvD2OuJdZX56zTRh_7yJ6lBGVeFWNgIoBK2QlEutVv4o9rWZUIZqsnte1SBu4tXXuk3ykSNrX4p2nFAP08Z-hg78C8ExBrAK7udxo0hdj7Dy27LF8YN0UzD7FD7dbGUyb9AMZk1Iy_lEhMUEQGHAUezq8Q"
|
|
55
|
+
{
|
|
56
|
+
"alg": "RS256",
|
|
57
|
+
"kid": "jwt-cli-key",
|
|
58
|
+
"typ": "JWT"
|
|
59
|
+
}
|
|
60
|
+
{
|
|
61
|
+
"aud": "http://localhost",
|
|
62
|
+
"azp": "1effbee5-df8e-4ae8-9a4d-92e4f01a8b44",
|
|
63
|
+
"ents": "",
|
|
64
|
+
"exp": 1646579150,
|
|
65
|
+
"iat": 1646579090,
|
|
66
|
+
"iss": "http://localhost",
|
|
67
|
+
"ptype": "user",
|
|
68
|
+
"sub": "d1108b6f-8349-4ed1-b5e8-af49389cb5d0"
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Additionally there is an online tool at [jwt.io](https://jwt.io) which can
|
|
73
|
+
validate signatures.
|
|
47
74
|
|
|
48
75
|
Copy in your token then either copy in the contents of your public key PEM file or your JWK.
|
|
49
76
|
|
package/bin/jwt-darwin-arm64
CHANGED
|
Binary file
|
package/bin/jwt-darwin-x64
CHANGED
|
Binary file
|
package/bin/jwt-linux-arm64
CHANGED
|
Binary file
|
package/bin/jwt-linux-x64
CHANGED
|
Binary file
|
package/bin/jwt.exe
CHANGED
|
Binary file
|