@medi-car-bd/mcb-shared-auth 0.0.10 → 0.0.13

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.
@@ -1,3 +1,11 @@
1
+ /**
2
+ * The user shape that token utilities accept.
3
+ *
4
+ * `role` and `tenantId` are authorization claims, not decoration: `authorize`
5
+ * reads `role` and every client scopes data by `tenantId`, so they must survive
6
+ * both initial issuance and refresh rotation. Persistence shape (Prisma) allows
7
+ * nulls; the signed payload omits empty values.
8
+ */
1
9
  export interface AccessTokenPayload {
2
10
  sub: string;
3
11
  email: string;
package/dist/types/jwt.js CHANGED
@@ -1,2 +1,10 @@
1
1
  "use strict";
2
+ /**
3
+ * The user shape that token utilities accept.
4
+ *
5
+ * `role` and `tenantId` are authorization claims, not decoration: `authorize`
6
+ * reads `role` and every client scopes data by `tenantId`, so they must survive
7
+ * both initial issuance and refresh rotation. Persistence shape (Prisma) allows
8
+ * nulls; the signed payload omits empty values.
9
+ */
2
10
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,6 +1,10 @@
1
1
  import type { TokenConfig } from "../types";
2
2
  /**
3
3
  * Generate a new access token
4
+ *
5
+ * `role` and `tenantId` are signed into the payload because clients authorize
6
+ * and scope data from the token alone, without a database round trip. Empty
7
+ * values are omitted rather than serialized as null.
4
8
  */
5
9
  export declare const generateAccessToken: (user: {
6
10
  id: string;
@@ -7,6 +7,10 @@ exports.generateAccessToken = void 0;
7
7
  const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
8
8
  /**
9
9
  * Generate a new access token
10
+ *
11
+ * `role` and `tenantId` are signed into the payload because clients authorize
12
+ * and scope data from the token alone, without a database round trip. Empty
13
+ * values are omitted rather than serialized as null.
10
14
  */
11
15
  const generateAccessToken = (user, config, jti) => {
12
16
  const payload = {
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@medi-car-bd/mcb-shared-auth",
3
- "version": "0.0.10",
3
+ "version": "0.0.13",
4
4
  "description": "Shared authentication module for MCB applications",
5
+ "packageManager": "pnpm@10.18.0",
5
6
  "main": "dist/index.js",
6
7
  "types": "dist/index.d.ts",
7
8
  "publishConfig": {
@@ -58,6 +59,6 @@
58
59
  },
59
60
  "repository": {
60
61
  "type": "git",
61
- "url": "git+https://github.com/Medi-Car-BD/mcb-shared-auth"
62
+ "url": "git+https://github.com/mcb-org/mcb-shared-auth.git"
62
63
  }
63
64
  }