| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 2dc4c22 commit a7bae60
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,6 @@ | |||
| 1 | 1 | { | |
| 2 | 2 | "name": "solid-oidc", | |
| 3 | - "version": "0.0.6", | ||
| 3 | + "version": "0.0.7", | ||
| 4 | 4 | "description": "Minimal, zero-build, zero-dependency Solid-OIDC client for browsers", | |
| 5 | 5 | "type": "module", | |
| 6 | 6 | "main": "solid-oidc.js", | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -98,6 +98,16 @@ async function verifyJWT(token, jwksUri, options = {}) { | |||
| 98 | 98 | if (!aud.includes(options.audience)) throw new Error('Audience mismatch') | |
| 99 | 99 | } | |
| 100 | 100 | ||
| 101 | + // Time-based claims (exp, nbf) with 60s clock skew tolerance | ||
| 102 | + const now = Math.floor(Date.now() / 1000) | ||
| 103 | + const skew = 60 | ||
| 104 | + if (typeof payload.exp === 'number' && now - skew > payload.exp) { | ||
| 105 | + throw new Error('Token expired') | ||
| 106 | + } | ||
| 107 | + if (typeof payload.nbf === 'number' && now + skew < payload.nbf) { | ||
| 108 | + throw new Error('Token not yet valid') | ||
| 109 | + } | ||
| 110 | + | ||
| 101 | 111 | // Fetch JWKS and find matching key | |
| 102 | 112 | const response = await fetch(jwksUri) | |
| 103 | 113 | if (!response.ok) throw new Error(`JWKS fetch failed: ${response.status}`) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments