@drmhse/authos-node 0.1.2 → 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 +17 -14
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -44,22 +44,25 @@ console.log(verified.claims);
44
44
 
45
45
  ### TypeScript Integration
46
46
 
47
- To get type support for `req.auth` in Express, you can extend the Request interface or use our utility type:
47
+ The `req.auth` type is automatically augmented when you import from `@drmhse/authos-node/express`. No manual setup required!
48
48
 
49
49
  ```ts
50
- import { Request } from 'express';
51
- import { TokenClaims } from '@drmhse/authos-node';
52
-
53
- // Extend Express Request
54
- declare global {
55
- namespace Express {
56
- interface Request {
57
- auth?: {
58
- claims: TokenClaims;
59
- token: string;
60
- };
61
- }
62
- }
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);
63
66
  }
64
67
  ```
65
68
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drmhse/authos-node",
3
- "version": "0.1.2",
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",