Commit8507cb55Recorded29 Mar 2026Repositorysigil-jwt

Add README

Changed
 README.md | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)
Diff
README.mdadded
@@ -0,0 +1,52 @@
+1
# sigil-jwt
+2
+3
A [Sigil](https://codeberg.org/sigil/sigil) library for creating and verifying JSON Web Tokens (JWT) with HMAC-SHA256 signatures.
+4
+5
## Features
+6
+7
- **Token creation** -- sign claims with HS256
+8
- **Token verification** -- validate signature and expiration
+9
- **Unsafe decoding** -- inspect claims without verification (e.g. to select the correct key)
+10
- **Automatic timestamps** -- `iat` injected at creation, `exp` checked at decode
+11
+12
## Usage
+13
+14
Add `sigil-jwt` as a dependency in your `package.sgl`:
+15
+16
```scheme
+17
(from-git url: "codeberg:sigil/sigil-jwt" package: "sigil-jwt")
+18
```
+19
+20
Then create and verify tokens:
+21
+22
```scheme
+23
(import (sigil jwt))
+24
+25
;; Create a signed token
+26
(define token (jwt-encode '((sub . "user123")
+27
(exp . 1735689600))
+28
"my-secret"))
+29
+30
;; Verify and decode
+31
(define claims (jwt-decode token "my-secret"))
+32
;; => ((sub . "user123") (exp . 1735689600) (iat . ...))
+33
+34
;; Decode without verification
+35
(define claims (jwt-decode-unsafe token))
+36
```
+37
+38
## Dependencies
+39
+40
- sigil-stdlib
+41
- sigil-json
+42
+43
## Building
+44
+45
```bash
+46
sigil build --redirects dev-redirects.sgl
+47
sigil test
+48
```
+49
+50
## License
+51
+52
BSD-3-Clause