You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+56-1Lines changed: 56 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,29 @@
1
1
## Zig-jwt
2
2
3
-
A JWT library for zig.
3
+
A JWT (JSON Web Token) library for zig.
4
4
5
5
6
6
### Env
7
7
8
8
- Zig >= 0.14.0-dev.2851+b074fb7dd
9
9
10
10
11
+
### What the heck is a JWT?
12
+
13
+
JWT.io has [a great introduction](https://jwt.io/introduction) to JSON Web Tokens.
14
+
15
+
In short, it's a signed JSON object that does something useful (for example, authentication). It's commonly used for `Bearer` tokens in Oauth 2. A token is made of three parts, separated by `.`'s. The first two parts are JSON objects, that have been [base64url](https://datatracker.ietf.org/doc/html/rfc4648) encoded. The last part is the signature, encoded the same way.
16
+
17
+
The first part is called the header. It contains the necessary information for verifying the last part, the signature. For example, which encryption method was used for signing and what key was used.
18
+
19
+
The part in the middle is the interesting bit. It's called the Claims and contains the actual stuff you care about. Refer to [RFC 7519](https://datatracker.ietf.org/doc/html/rfc7519) for information about reserved keys and the proper way to add your own.
20
+
21
+
22
+
### What's in the box?
23
+
24
+
This library supports the parsing and verification as well as the generation and signing of JWTs. Current supported signing algorithms are HMAC SHA, RSA, RSA-PSS, and ECDSA, though hooks are present for adding your own.
25
+
26
+
11
27
### Adding zig-jwt as a dependency
12
28
13
29
Add the dependency to your project:
@@ -102,6 +118,45 @@ The JWT library have signing methods:
0 commit comments