@drmhse/authos-node 0.1.1 → 0.1.3

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.
Files changed (2) hide show
  1. package/README.md +24 -0
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -42,6 +42,30 @@ console.log(verified.claims);
42
42
  // }
43
43
  ```
44
44
 
45
+ ### TypeScript Integration
46
+
47
+ The `req.auth` type is automatically augmented when you import from `@drmhse/authos-node/express`. No manual setup required!
48
+
49
+ ```ts
50
+ import { createAuthMiddleware } from '@drmhse/authos-node/express';
51
+
52
+ // TypeScript knows about req.auth automatically
53
+ app.get('/profile', requireAuth(), (req, res) => {
54
+ const userId = req.auth?.claims.sub; // ✓ Typed correctly
55
+ res.json({ userId });
56
+ });
57
+ ```
58
+
59
+ If you need access to the token claims type directly:
60
+
61
+ ```ts
62
+ import { TokenClaims, VerifiedToken } from '@drmhse/authos-node';
63
+
64
+ function processUser(auth: VerifiedToken) {
65
+ console.log(auth.claims.email);
66
+ }
67
+ ```
68
+
45
69
  ### Express Middleware
46
70
 
47
71
  Protect your Express routes with AuthOS authentication:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drmhse/authos-node",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Node.js server adapter for AuthOS authentication - Express middleware and token verification",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -58,7 +58,7 @@
58
58
  }
59
59
  },
60
60
  "dependencies": {
61
- "@drmhse/sso-sdk": "^0.3.3"
61
+ "@drmhse/sso-sdk": "^0.3.8"
62
62
  },
63
63
  "devDependencies": {
64
64
  "@types/express": "^5.0.0",