@azlib/identity 0.2.1 → 0.3.0

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 (70) hide show
  1. package/README.md +119 -54
  2. package/dist/cookie-header-DptIxRmW.mjs +76 -0
  3. package/dist/cookie-header-DptIxRmW.mjs.map +1 -0
  4. package/dist/cookie-header-Dqd5k5BU.cjs +115 -0
  5. package/dist/cookie-header-LFWHKQ04.d.cts +86 -0
  6. package/dist/cookie-header-LFWHKQ04.d.cts.map +1 -0
  7. package/dist/cookie-header-LFWHKQ04.d.mts +86 -0
  8. package/dist/cookie-header-LFWHKQ04.d.mts.map +1 -0
  9. package/dist/{errors-CBbiRO2n.d.cts → errors-0Zh7EG06.d.cts} +4 -2
  10. package/dist/errors-0Zh7EG06.d.cts.map +1 -0
  11. package/dist/{errors-_OcodtdV.d.mts → errors-DVDEUk9-.d.mts} +4 -2
  12. package/dist/errors-DVDEUk9-.d.mts.map +1 -0
  13. package/dist/express.d.cts +3 -3
  14. package/dist/express.d.cts.map +1 -1
  15. package/dist/express.d.mts +3 -3
  16. package/dist/express.d.mts.map +1 -1
  17. package/dist/express.mjs.map +1 -1
  18. package/dist/{identity-Bz9RDOvT.mjs → identity-D0qyca_c.mjs} +37 -3
  19. package/dist/identity-D0qyca_c.mjs.map +1 -0
  20. package/dist/{identity-4eP45YIP.cjs → identity-Yz1BVkrM.cjs} +46 -0
  21. package/dist/{identity-router-D1xJ5H7y.d.cts → identity-router-BiratpJR.d.mts} +3 -3
  22. package/dist/identity-router-BiratpJR.d.mts.map +1 -0
  23. package/dist/{identity-router-tj3-teBI.d.mts → identity-router-D4oqYI60.d.cts} +3 -3
  24. package/dist/identity-router-D4oqYI60.d.cts.map +1 -0
  25. package/dist/{identity-service---OTann1.d.cts → identity-service-DE0Ffguz.d.cts} +3 -3
  26. package/dist/{identity-service---OTann1.d.cts.map → identity-service-DE0Ffguz.d.cts.map} +1 -1
  27. package/dist/{identity-service-WpOKb0MK.d.mts → identity-service-JtsoA6lv.d.mts} +3 -3
  28. package/dist/{identity-service-WpOKb0MK.d.mts.map → identity-service-JtsoA6lv.d.mts.map} +1 -1
  29. package/dist/identity-store-BRRahxcS.d.cts.map +1 -1
  30. package/dist/identity-store-BRRahxcS.d.mts.map +1 -1
  31. package/dist/index-CsYqHPvK.d.cts +54 -0
  32. package/dist/index-CsYqHPvK.d.cts.map +1 -0
  33. package/dist/index-LhSdoWEP.d.mts +54 -0
  34. package/dist/index-LhSdoWEP.d.mts.map +1 -0
  35. package/dist/index.cjs +11 -1
  36. package/dist/index.d.cts +4 -3
  37. package/dist/index.d.mts +4 -3
  38. package/dist/index.mjs +3 -2
  39. package/dist/logger-CcCHJVVe.mjs.map +1 -1
  40. package/dist/nestjs.d.cts +3 -3
  41. package/dist/nestjs.d.cts.map +1 -1
  42. package/dist/nestjs.d.mts +3 -3
  43. package/dist/nestjs.d.mts.map +1 -1
  44. package/dist/nestjs.mjs.map +1 -1
  45. package/dist/next.cjs +285 -0
  46. package/dist/next.d.cts +58 -0
  47. package/dist/next.d.cts.map +1 -0
  48. package/dist/next.d.mts +58 -0
  49. package/dist/next.d.mts.map +1 -0
  50. package/dist/next.mjs +274 -0
  51. package/dist/next.mjs.map +1 -0
  52. package/dist/node.cjs +18 -19
  53. package/dist/node.d.cts +5 -4
  54. package/dist/node.d.cts.map +1 -1
  55. package/dist/node.d.mts +5 -4
  56. package/dist/node.d.mts.map +1 -1
  57. package/dist/node.mjs +10 -20
  58. package/dist/node.mjs.map +1 -1
  59. package/dist/test-utils.mjs.map +1 -1
  60. package/package.json +7 -7
  61. package/schema/model.ts +110 -22
  62. package/dist/errors-CBbiRO2n.d.cts.map +0 -1
  63. package/dist/errors-_OcodtdV.d.mts.map +0 -1
  64. package/dist/identity-Bz9RDOvT.mjs.map +0 -1
  65. package/dist/identity-router-D1xJ5H7y.d.cts.map +0 -1
  66. package/dist/identity-router-tj3-teBI.d.mts.map +0 -1
  67. package/dist/index-CpufYgyn.d.cts +0 -30
  68. package/dist/index-CpufYgyn.d.cts.map +0 -1
  69. package/dist/index-CpufYgyn.d.mts +0 -30
  70. package/dist/index-CpufYgyn.d.mts.map +0 -1
package/schema/model.ts CHANGED
@@ -33,22 +33,62 @@ export const identitySchemaModel: SchemaModel = {
33
33
  description: "Core user accounts.",
34
34
  columns: [
35
35
  { name: "user_id", description: "Primary key.", nullable: false },
36
- { name: "email", description: "Unique, case-insensitive login email.", nullable: false },
37
- { name: "display_name", description: "Optional display name.", nullable: true },
38
- { name: "status", description: "active | disabled | locked.", nullable: false },
39
- { name: "email_verified_at", description: "When email was verified.", nullable: true },
40
- { name: "auth_version", description: "Token invalidation counter.", nullable: false },
41
- { name: "created_at", description: "Creation timestamp.", nullable: false },
42
- { name: "updated_at", description: "Last update timestamp.", nullable: false },
36
+ {
37
+ name: "email",
38
+ description: "Unique, case-insensitive login email.",
39
+ nullable: false,
40
+ },
41
+ {
42
+ name: "display_name",
43
+ description: "Optional display name.",
44
+ nullable: true,
45
+ },
46
+ {
47
+ name: "status",
48
+ description: "active | disabled | locked.",
49
+ nullable: false,
50
+ },
51
+ {
52
+ name: "email_verified_at",
53
+ description: "When email was verified.",
54
+ nullable: true,
55
+ },
56
+ {
57
+ name: "auth_version",
58
+ description: "Token invalidation counter.",
59
+ nullable: false,
60
+ },
61
+ {
62
+ name: "created_at",
63
+ description: "Creation timestamp.",
64
+ nullable: false,
65
+ },
66
+ {
67
+ name: "updated_at",
68
+ description: "Last update timestamp.",
69
+ nullable: false,
70
+ },
43
71
  ],
44
72
  },
45
73
  {
46
74
  name: "identity_credentials",
47
75
  description: "Password hashes, one per user.",
48
76
  columns: [
49
- { name: "user_id", description: "FK to identity_users.", nullable: false },
50
- { name: "password_hash", description: "Algorithm-tagged hash.", nullable: false },
51
- { name: "updated_at", description: "Last update timestamp.", nullable: false },
77
+ {
78
+ name: "user_id",
79
+ description: "FK to identity_users.",
80
+ nullable: false,
81
+ },
82
+ {
83
+ name: "password_hash",
84
+ description: "Algorithm-tagged hash.",
85
+ nullable: false,
86
+ },
87
+ {
88
+ name: "updated_at",
89
+ description: "Last update timestamp.",
90
+ nullable: false,
91
+ },
52
92
  ],
53
93
  },
54
94
  {
@@ -56,11 +96,31 @@ export const identitySchemaModel: SchemaModel = {
56
96
  description: "Server-side refresh sessions with hashed tokens.",
57
97
  columns: [
58
98
  { name: "session_id", description: "Primary key.", nullable: false },
59
- { name: "user_id", description: "FK to identity_users.", nullable: false },
60
- { name: "refresh_token_hash", description: "Hash of the active refresh token.", nullable: false },
61
- { name: "created_at", description: "Creation timestamp.", nullable: false },
62
- { name: "expires_at", description: "Expiry timestamp.", nullable: false },
63
- { name: "revoked_at", description: "Set when rotated or revoked.", nullable: true },
99
+ {
100
+ name: "user_id",
101
+ description: "FK to identity_users.",
102
+ nullable: false,
103
+ },
104
+ {
105
+ name: "refresh_token_hash",
106
+ description: "Hash of the active refresh token.",
107
+ nullable: false,
108
+ },
109
+ {
110
+ name: "created_at",
111
+ description: "Creation timestamp.",
112
+ nullable: false,
113
+ },
114
+ {
115
+ name: "expires_at",
116
+ description: "Expiry timestamp.",
117
+ nullable: false,
118
+ },
119
+ {
120
+ name: "revoked_at",
121
+ description: "Set when rotated or revoked.",
122
+ nullable: true,
123
+ },
64
124
  ],
65
125
  },
66
126
  {
@@ -69,31 +129,59 @@ export const identitySchemaModel: SchemaModel = {
69
129
  columns: [
70
130
  { name: "role_id", description: "Primary key.", nullable: false },
71
131
  { name: "name", description: "Unique role name.", nullable: false },
72
- { name: "description", description: "Optional description.", nullable: true },
132
+ {
133
+ name: "description",
134
+ description: "Optional description.",
135
+ nullable: true,
136
+ },
73
137
  ],
74
138
  },
75
139
  {
76
140
  name: "identity_user_roles",
77
141
  description: "User-to-role assignments.",
78
142
  columns: [
79
- { name: "user_id", description: "FK to identity_users.", nullable: false },
80
- { name: "role_id", description: "FK to identity_roles.", nullable: false },
143
+ {
144
+ name: "user_id",
145
+ description: "FK to identity_users.",
146
+ nullable: false,
147
+ },
148
+ {
149
+ name: "role_id",
150
+ description: "FK to identity_roles.",
151
+ nullable: false,
152
+ },
81
153
  ],
82
154
  },
83
155
  {
84
156
  name: "identity_role_permissions",
85
157
  description: "Permissions granted to roles.",
86
158
  columns: [
87
- { name: "role_id", description: "FK to identity_roles.", nullable: false },
88
- { name: "permission", description: "Permission string.", nullable: false },
159
+ {
160
+ name: "role_id",
161
+ description: "FK to identity_roles.",
162
+ nullable: false,
163
+ },
164
+ {
165
+ name: "permission",
166
+ description: "Permission string.",
167
+ nullable: false,
168
+ },
89
169
  ],
90
170
  },
91
171
  {
92
172
  name: "identity_user_permissions",
93
173
  description: "Permissions granted directly to users.",
94
174
  columns: [
95
- { name: "user_id", description: "FK to identity_users.", nullable: false },
96
- { name: "permission", description: "Permission string.", nullable: false },
175
+ {
176
+ name: "user_id",
177
+ description: "FK to identity_users.",
178
+ nullable: false,
179
+ },
180
+ {
181
+ name: "permission",
182
+ description: "Permission string.",
183
+ nullable: false,
184
+ },
97
185
  ],
98
186
  },
99
187
  ],
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors-CBbiRO2n.d.cts","names":[],"sources":["../core/authorization.ts","../core/logger.ts","../core/notification.ts","../core/config.ts","../core/audit.ts","../core/token-service.ts","../core/session-state.ts","../core/oauth/oauth-provider.ts","../core/oauth/oauth-service.ts","../core/errors.ts"],"mappings":";;;;;;UAMiB,qBAAqB;EACpC,WAAW;;EAEX;;EAEA,WAAW;;;;;;;;KASD,WAAW,wBACrB,SAAS,qBAAqB,qCACL;;UAGV,yBAAyB;;EAExC,aAAa;;EAEb,SAAS,WAAW;;;UAIL;EACf;;EAEA;;;;;;;;iBAcoB,sBAAsB,qBAC1C,aAAa,yBAAyB,YACtC,SAAS,qBAAqB,aAC7B,QAAQ;;iBAuBW,aAAa,qBACjC,aAAa,yBAAyB,YACtC,SAAS,qBAAqB,aAC7B;;;;;;;;;;;;;;;;;;UChEc;EACf,MAAM,iBAAiB,OAAO;EA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EAKA;;EAEA;;;UAIe;EACf;EACA;;;;;;UAOe;;;;;WAKN;;;;;;EAOT,sBAAsB,QAAQ;;;;;EAM9B,aAAa,QAAQ,qBAAqB,QAAQ;;;;;EAMlD,cAAc,QAAQ,cAAc,QAAQ;;;;;UCvE7B;;EAEf;;;;;EAKA;;;UAIe;;EAEf;;EAEA;;;;;EAKA;;EAEA;;EAEA;;;UAIe;;WAEN;;;;;EAMT,sBAAsB,sBAAsB,qBAAqB,oBAAoB;;;;;;;;EASrF,eAAe,sBAAsB,QAAQ,sBAAsB,QAAQ;;;cAIhE,mCAAmC;EAClC,YAAA;;;cAOD,gCAAgC;EAAA;;;UAQ5B;EACf,oBAAoB;EACpB,QAAQ;EACR,OAAO;EACP,aAAa;EACb,OAAO;;;;;;;iBAQO,mBAAmB,MAAM,mBAAmB;;;;;;;;;;cC9E/C,sBAAsB;;WAExB;;WAEA;EAEG,YAAA,cAAc,iBAAiB;;;cAShC,4BAA4B;EAC3B,YAAA;;;cAMD,gCAAgC;EAAA;;;cAOhC,oCAAoC;EAAA;;;cAWpC,0BAA0B;EACzB,YAAA;;;cAMD,6BAA6B;EAC5B,YAAA;;;cAMD,uBAAuB;EACtB,YAAA;;;cAMD,gCAAgC;EAC/B,YAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors-_OcodtdV.d.mts","names":[],"sources":["../core/authorization.ts","../core/logger.ts","../core/notification.ts","../core/config.ts","../core/audit.ts","../core/token-service.ts","../core/session-state.ts","../core/oauth/oauth-provider.ts","../core/oauth/oauth-service.ts","../core/errors.ts"],"mappings":";;;;;;UAMiB,qBAAqB;EACpC,WAAW;;EAEX;;EAEA,WAAW;;;;;;;;KASD,WAAW,wBACrB,SAAS,qBAAqB,qCACL;;UAGV,yBAAyB;;EAExC,aAAa;;EAEb,SAAS,WAAW;;;UAIL;EACf;;EAEA;;;;;;;;iBAcoB,sBAAsB,qBAC1C,aAAa,yBAAyB,YACtC,SAAS,qBAAqB,aAC7B,QAAQ;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EACP,cAAc;;;;;;;;;;;UCDC;EACf;;EAEA;EACA;;EAEA;EACA;EACA;;;;;;UAOe;;EAEf;EACA;;EAEA;EACA;;;UAIe;;EAEf;;;;;EAKA;;EAEA;;;UAIe;EACf;EACA;;;;;;UAOe;;;;;WAKN;;;;;;EAOT,sBAAsB,QAAQ;;;;;EAM9B,aAAa,QAAQ,qBAAqB,QAAQ;;;;;EAMlD,cAAc,QAAQ,cAAc,QAAQ;;;;;UCvE7B;;EAEf;;;;;EAKA;;;UAIe;;EAEf;;EAEA;;;;;EAKA;;EAEA;;EAEA;;;UAIe;;WAEN;;;;;EAMT,sBAAsB,sBAAsB,qBAAqB,oBAAoB;;;;;;;;EASrF,eAAe,sBAAsB,QAAQ,sBAAsB,QAAQ;;;cAIhE,mCAAmC;EAClC,YAAA;;;cAOD,gCAAgC;EAAA;;;UAQ5B;EACf,oBAAoB;EACpB,QAAQ;EACR,OAAO;EACP,aAAa;EACb,OAAO;;;;;;;iBAQO,mBAAmB,MAAM,mBAAmB;;;;;;;;;;cC9E/C,sBAAsB;;WAExB;;WAEA;EAEG,YAAA,cAAc,iBAAiB;;;cAShC,4BAA4B;EAC3B,YAAA;;;cAMD,gCAAgC;EAAA;;;cAOhC,oCAAoC;EAAA;;;cAWpC,0BAA0B;EACzB,YAAA;;;cAMD,6BAA6B;EAC5B,YAAA;;;cAMD,uBAAuB;EACtB,YAAA;;;cAMD,gCAAgC;EAC/B,YAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"identity-Bz9RDOvT.mjs","names":[],"sources":["../core/config.ts","../core/authorization.ts","../core/session-state.ts","../core/oauth/oauth-service.ts","../schema/model.ts"],"sourcesContent":["import { IdentityConfigError } from \"./errors\";\nimport type { IdentityLogger } from \"./logger\";\nimport { resolveLogger } from \"./logger\";\nimport type { NotificationService } from \"./notification\";\nimport type { IdentityEvent } from \"./types\";\n\n/**\n * Pluggable override points for advanced consumers. All are optional; sensible Node\n * defaults are supplied by the runtime entry (`@azlib/identity/node`).\n */\nexport interface IdentityOverrides {\n /** Returns the current time. Override in tests for deterministic clocks. */\n now?: () => Date;\n /** Generates a unique id (user ids, session ids). Defaults to `crypto.randomUUID`. */\n generateId?: () => string;\n /**\n * Lifecycle hook invoked for every audit event (registration, login, refresh, etc.).\n * Use it to forward events to your own logging/analytics pipeline. It must never throw\n * for normal operation; failures are swallowed so auditing cannot break auth flows.\n */\n onEvent?: (event: IdentityEvent) => void | Promise<void>;\n}\n\n/** Account lockout policy applied after repeated failed logins. */\nexport interface LockoutConfig {\n /**\n * How many consecutive failed login attempts are allowed before the account is\n * temporarily locked. Set to 0 to disable lockout. Default 10.\n */\n maxFailedAttempts: number;\n /**\n * How long (in seconds) a locked account is blocked before automatic unlock.\n * Default 900 (15 minutes). Set to 0 for permanent lock (manual unlock required).\n */\n durationSeconds: number;\n}\n\n/** Raw configuration accepted from consumers. */\nexport interface IdentityConfigInput {\n /**\n * Secret used to sign and verify access tokens (HMAC). Must be at least 32 characters.\n * Provide via environment, never hardcode.\n */\n accessTokenSecret: string;\n /** Access-token lifetime in seconds. Default 900 (15 minutes). */\n accessTokenTtlSeconds?: number;\n /** Refresh-token lifetime in seconds. Default 1209600 (14 days). */\n refreshTokenTtlSeconds?: number;\n /** Token issuer (`iss`). Default `azlib-identity`. */\n issuer?: string;\n /** Token audience (`aud`). Optional. */\n audience?: string;\n /** scrypt cost parameter `N`. Default 16384. */\n passwordScryptCost?: number;\n /**\n * Account lockout policy. Omit or set `maxFailedAttempts: 0` to disable. Default: 10\n * attempts, 15-minute lockout.\n */\n lockout?: Partial<LockoutConfig>;\n /**\n * Pluggable notification service for email verification, password reset, and SMS 2FA.\n * Omit if you do not need these features.\n */\n notifications?: NotificationService;\n /**\n * Logger used throughout the package. Pass your own `IdentityLogger` to route\n * diagnostic output to Winston, Pino, or any other provider. Pass `false` to silence\n * all logging. Defaults to a console-based logger when omitted.\n */\n logger?: IdentityLogger | false;\n /** Override points for clock and id generation. */\n overrides?: IdentityOverrides;\n}\n\n/** Fully resolved, validated configuration used internally. */\nexport interface IdentityConfig {\n accessTokenSecret: string;\n accessTokenTtlSeconds: number;\n refreshTokenTtlSeconds: number;\n issuer: string;\n audience: string | undefined;\n passwordScryptCost: number;\n lockout: LockoutConfig;\n notifications: NotificationService | undefined;\n /** Resolved logger; never `false` — `false` becomes {@link noopLogger}. */\n logger: IdentityLogger;\n now: () => Date;\n generateId: () => string;\n onEvent: ((event: IdentityEvent) => void | Promise<void>) | undefined;\n}\n\nconst MIN_SECRET_LENGTH = 32;\n\nconst defaultGenerateId = (): string => globalThis.crypto.randomUUID();\nconst defaultNow = (): Date => new Date();\n\n/**\n * Validates and applies defaults to consumer-provided configuration.\n * Throws {@link IdentityConfigError} when required values are missing or invalid.\n */\nexport function resolveIdentityConfig(input: IdentityConfigInput): IdentityConfig {\n if (!input.accessTokenSecret || input.accessTokenSecret.length < MIN_SECRET_LENGTH) {\n throw new IdentityConfigError(\n `accessTokenSecret must be at least ${MIN_SECRET_LENGTH} characters.`,\n );\n }\n\n const accessTokenTtlSeconds = input.accessTokenTtlSeconds ?? 900;\n const refreshTokenTtlSeconds = input.refreshTokenTtlSeconds ?? 60 * 60 * 24 * 14;\n const passwordScryptCost = input.passwordScryptCost ?? 16384;\n\n if (accessTokenTtlSeconds <= 0) {\n throw new IdentityConfigError(\"accessTokenTtlSeconds must be positive.\");\n }\n if (refreshTokenTtlSeconds <= accessTokenTtlSeconds) {\n throw new IdentityConfigError(\n \"refreshTokenTtlSeconds must be greater than accessTokenTtlSeconds.\",\n );\n }\n if ((passwordScryptCost & (passwordScryptCost - 1)) !== 0) {\n throw new IdentityConfigError(\"passwordScryptCost must be a power of two.\");\n }\n\n return {\n accessTokenSecret: input.accessTokenSecret,\n accessTokenTtlSeconds,\n refreshTokenTtlSeconds,\n issuer: input.issuer ?? \"azlib-identity\",\n audience: input.audience,\n passwordScryptCost,\n lockout: {\n maxFailedAttempts: input.lockout?.maxFailedAttempts ?? 10,\n durationSeconds: input.lockout?.durationSeconds ?? 900,\n },\n now: input.overrides?.now ?? defaultNow,\n generateId: input.overrides?.generateId ?? defaultGenerateId,\n onEvent: input.overrides?.onEvent,\n notifications: input.notifications,\n logger: resolveLogger(input.logger),\n };\n}\n","import type { AuthenticatedIdentity, Permission } from \"./types\";\n\n/**\n * Context passed to authorization checks. `resource` is an opaque consumer-supplied\n * object (e.g. a loaded document) used by ownership/relationship policies.\n */\nexport interface AuthorizationContext<TResource = unknown> {\n principal: AuthenticatedIdentity;\n /** The action being attempted, typically a permission string. */\n action: string;\n /** The target resource, if any. */\n resource?: TResource;\n}\n\n/**\n * A policy rule returns:\n * - `true` to allow,\n * - `false`/`undefined` to abstain (deny-by-default unless another rule allows),\n * It must never throw for normal \"denied\" outcomes.\n */\nexport type PolicyRule<TResource = unknown> = (\n context: AuthorizationContext<TResource>,\n) => boolean | undefined | Promise<boolean | undefined>;\n\n/** A named requirement combining a required permission and optional ownership policy. */\nexport interface AuthorizationRequirement<TResource = unknown> {\n /** Permission the principal must hold. Omit to rely solely on policies. */\n permission?: Permission;\n /** Optional ownership/relationship rule evaluated against the resource. */\n policy?: PolicyRule<TResource>;\n}\n\n/** Result of an authorization decision. */\nexport interface AuthorizationDecision {\n allowed: boolean;\n /** Non-sensitive reason for diagnostics/audit. */\n reason: string;\n}\n\nconst hasPermission = (\n principal: AuthenticatedIdentity,\n permission: Permission,\n): boolean => principal.permissions.includes(permission);\n\n/**\n * Evaluates a requirement using deny-by-default semantics:\n * 1. If a `permission` is required and the principal lacks it, deny.\n * 2. If a `policy` is provided, it must return `true` to allow.\n * 3. If neither is provided, deny (nothing explicitly granted access).\n */\nexport async function evaluateAuthorization<TResource = unknown>(\n requirement: AuthorizationRequirement<TResource>,\n context: AuthorizationContext<TResource>,\n): Promise<AuthorizationDecision> {\n const { permission, policy } = requirement;\n\n if (permission !== undefined && !hasPermission(context.principal, permission)) {\n return { allowed: false, reason: \"missing-permission\" };\n }\n\n if (policy) {\n const result = await policy(context);\n if (result !== true) {\n return { allowed: false, reason: \"policy-denied\" };\n }\n return { allowed: true, reason: \"policy-allowed\" };\n }\n\n if (permission !== undefined) {\n return { allowed: true, reason: \"permission-granted\" };\n }\n\n return { allowed: false, reason: \"no-grant\" };\n}\n\n/** Convenience boolean form of {@link evaluateAuthorization}. */\nexport async function isAuthorized<TResource = unknown>(\n requirement: AuthorizationRequirement<TResource>,\n context: AuthorizationContext<TResource>,\n): Promise<boolean> {\n return (await evaluateAuthorization(requirement, context)).allowed;\n}\n","import type { IdentityConfig } from \"./config\";\nimport type { IdentityStore } from \"./identity-store\";\nimport type { TokenService } from \"./token-service\";\nimport type { AuthResult, AuthenticatedIdentity, IdentityUser } from \"./types\";\n\n/** Dependencies shared by the register/login/refresh flows. */\nexport interface SessionDeps {\n config: IdentityConfig;\n store: IdentityStore;\n tokenService: TokenService;\n}\n\n/**\n * Builds the runtime principal for a user by reading their roles and permissions from\n * the store. Returns the shape attached to authenticated requests.\n */\nexport async function hydratePrincipal(\n store: IdentityStore,\n user: IdentityUser,\n): Promise<AuthenticatedIdentity> {\n const [roles, permissions] = await Promise.all([\n store.listRolesForUser(user.userId),\n store.listPermissionsForUser(user.userId),\n ]);\n\n return {\n userId: user.userId,\n email: user.email,\n displayName: user.displayName,\n status: user.status,\n emailVerified: user.emailVerifiedAt !== null,\n roles: roles.map((role) => role.name),\n permissions: [...permissions],\n };\n}\n\n/**\n * Issues a fresh token pair for a user and persists a new refresh session\n * (storing only the hash of the refresh token).\n */\nexport async function issueSession(\n deps: SessionDeps,\n user: IdentityUser,\n): Promise<AuthResult> {\n const { config, store, tokenService } = deps;\n const now = config.now();\n\n const principal = await hydratePrincipal(store, user);\n const access = await tokenService.issueAccessToken(user.userId, user.authVersion);\n const sessionId = config.generateId();\n const refresh = tokenService.createRefreshToken(sessionId);\n\n const refreshExpiresAt = new Date(now.getTime() + config.refreshTokenTtlSeconds * 1000);\n await store.createSession({\n sessionId,\n userId: user.userId,\n refreshTokenHash: refresh.hash,\n createdAt: now,\n expiresAt: refreshExpiresAt,\n });\n\n return {\n user: principal,\n tokens: {\n accessToken: access.token,\n refreshToken: refresh.token,\n accessTokenExpiresAt: access.expiresAt,\n refreshTokenExpiresAt: refreshExpiresAt,\n },\n };\n}\n","import type { AuditLogger } from \"../audit\";\nimport type { IdentityConfig } from \"../config\";\nimport type { IdentityStore } from \"../identity-store\";\nimport { issueSession, type SessionDeps } from \"../session-state\";\nimport type { AuthResult, OAuthLinkedAccount } from \"../types\";\nimport type { OAuthProvider } from \"./oauth-provider\";\n\n/** Result of {@link OAuthService.buildAuthorizationUrl}. */\nexport interface OAuthAuthorizationUrl {\n /** The full provider authorization URL to redirect the user to. */\n url: string;\n /**\n * An opaque CSRF-prevention state value. Store this in a signed cookie or server\n * session and pass it as `expectedState` when calling {@link OAuthService.handleCallback}.\n */\n state: string;\n}\n\n/** Parameters for {@link OAuthService.handleCallback}. */\nexport interface OAuthCallbackParams {\n /** The authorization code received from the provider callback query string. */\n code: string;\n /** The `state` value received from the provider callback query string. */\n state: string;\n /**\n * The expected state value previously returned by {@link OAuthService.buildAuthorizationUrl}.\n * The callback will be rejected when they do not match (CSRF protection).\n */\n expectedState: string;\n /** The same redirect URI that was used in the authorization request. */\n redirectUri: string;\n /** Optional scopes to override for this callback's code exchange. */\n scopes?: string[];\n}\n\n/** The OAuth2 / OIDC surface of the identity service. */\nexport interface OAuthService {\n /** Returns the registered provider names, e.g. `[\"google\", \"microsoft\"]`. */\n readonly providers: readonly string[];\n\n /**\n * Builds the authorization URL for the given provider. Redirect the user's browser to\n * the returned `url`, then store `state` for later verification.\n */\n buildAuthorizationUrl(providerName: string, redirectUri: string, scopes?: string[]): OAuthAuthorizationUrl;\n\n /**\n * Handles the provider callback after user consent. Verifies state, exchanges the code\n * for tokens, resolves or provisions a local user, and returns a full auth result.\n *\n * Throws {@link OAuthProviderNotFoundError} for unknown providers.\n * Throws a generic {@link IdentityError} when state mismatches (CSRF guard).\n */\n handleCallback(providerName: string, params: OAuthCallbackParams): Promise<AuthResult>;\n}\n\n/** Thrown when an OAuth operation targets an unregistered provider name. */\nexport class OAuthProviderNotFoundError extends Error {\n constructor(providerName: string) {\n super(`No OAuth provider registered with name \"${providerName}\".`);\n this.name = \"OAuthProviderNotFoundError\";\n }\n}\n\n/** Thrown when the callback state does not match the expected state (CSRF guard). */\nexport class OAuthStateMismatchError extends Error {\n constructor() {\n super(\"OAuth state mismatch. The callback may have been replayed or tampered with.\");\n this.name = \"OAuthStateMismatchError\";\n }\n}\n\n/** Dependencies for {@link createOAuthService}. */\nexport interface OAuthServiceDeps {\n providers: readonly OAuthProvider[];\n config: IdentityConfig;\n store: IdentityStore;\n sessionDeps: SessionDeps;\n audit: AuditLogger;\n}\n\n/**\n * Creates the OAuth2 / OIDC service. Wire into the identity service by passing configured\n * provider instances (e.g. `createGoogleOAuthProvider(...)`) to the `oauth.providers` list\n * in {@link IdentityConfigInput}.\n */\nexport function createOAuthService(deps: OAuthServiceDeps): OAuthService {\n const { providers, config, store, sessionDeps, audit } = deps;\n\n const providerMap = new Map<string, OAuthProvider>();\n for (const p of providers) {\n providerMap.set(p.name, p);\n }\n\n function getProvider(name: string): OAuthProvider {\n const p = providerMap.get(name);\n if (!p) throw new OAuthProviderNotFoundError(name);\n return p;\n }\n\n return {\n get providers() {\n return [...providerMap.keys()];\n },\n\n buildAuthorizationUrl(providerName, redirectUri, scopes) {\n const provider = getProvider(providerName);\n const state = config.generateId();\n const url = provider.buildAuthorizationUrl({ redirectUri, state, scopes });\n return { url, state };\n },\n\n async handleCallback(providerName, params) {\n // CSRF guard — must be the first check.\n if (params.state !== params.expectedState) {\n throw new OAuthStateMismatchError();\n }\n\n const provider = getProvider(providerName);\n\n // Exchange the authorization code for provider tokens.\n const tokens = await provider.exchangeCode({\n code: params.code,\n redirectUri: params.redirectUri,\n });\n\n // Fetch normalized user info from the provider.\n const userInfo = await provider.fetchUserInfo(tokens);\n\n const now = config.now();\n\n // 1. Look up by OAuth link (returning user).\n if (store.findUserByOAuthId) {\n const linkedUser = await store.findUserByOAuthId(providerName, userInfo.providerUserId);\n if (linkedUser) {\n await audit.record(\"user.login.succeeded\", linkedUser.userId, {\n email: linkedUser.email,\n provider: providerName,\n });\n return issueSession(sessionDeps, linkedUser);\n }\n }\n\n // 2. Look up by email (existing local account — link the provider).\n if (userInfo.email) {\n const existingUser = await store.findUserByEmail(userInfo.email);\n if (existingUser) {\n await linkOAuthAccount(store, existingUser.userId, providerName, userInfo, now);\n await audit.record(\"user.oauth.linked\", existingUser.userId, {\n provider: providerName,\n providerUserId: userInfo.providerUserId,\n });\n await audit.record(\"user.login.succeeded\", existingUser.userId, {\n email: existingUser.email,\n provider: providerName,\n });\n return issueSession(sessionDeps, existingUser);\n }\n }\n\n // 3. Provision a new local user and link the provider.\n const newUser = await store.createUser({\n userId: config.generateId(),\n email: userInfo.email ?? `oauth:${providerName}:${userInfo.providerUserId}`,\n displayName: userInfo.displayName,\n status: \"active\",\n authVersion: 0,\n createdAt: now,\n updatedAt: now,\n });\n await linkOAuthAccount(store, newUser.userId, providerName, userInfo, now);\n await audit.record(\"user.registered\", newUser.userId, {\n provider: providerName,\n providerUserId: userInfo.providerUserId,\n });\n await audit.record(\"user.oauth.linked\", newUser.userId, {\n provider: providerName,\n providerUserId: userInfo.providerUserId,\n });\n await audit.record(\"user.login.succeeded\", newUser.userId, {\n email: newUser.email,\n provider: providerName,\n });\n return issueSession(sessionDeps, newUser);\n },\n };\n}\n\nasync function linkOAuthAccount(\n store: IdentityStore,\n userId: string,\n provider: string,\n userInfo: { providerUserId: string; email: string | null; displayName: string | null },\n now: Date,\n): Promise<void> {\n if (!store.createOAuthLink) return; // Store does not support OAuth links — skip silently.\n\n const link: OAuthLinkedAccount = {\n userId,\n provider,\n providerUserId: userInfo.providerUserId,\n email: userInfo.email,\n displayName: userInfo.displayName,\n linkedAt: now,\n };\n await store.createOAuthLink(link);\n}\n","/**\n * Logical description of the relational schema `@azlib/identity` expects.\n *\n * Concrete DDL is shipped alongside this module:\n * - `@azlib/identity/schema/postgres.sql`\n * - `@azlib/identity/schema/mysql.sql`\n * - `@azlib/identity/schema/sqlite.sql`\n * - `@azlib/identity/schema/prisma.schema`\n *\n * This object is documentation-as-data so consumers and tooling can introspect the\n * expected tables without parsing SQL.\n */\nexport interface SchemaColumn {\n name: string;\n description: string;\n nullable: boolean;\n}\n\nexport interface SchemaTable {\n name: string;\n description: string;\n columns: readonly SchemaColumn[];\n}\n\nexport interface SchemaModel {\n tables: readonly SchemaTable[];\n}\n\nexport const identitySchemaModel: SchemaModel = {\n tables: [\n {\n name: \"identity_users\",\n description: \"Core user accounts.\",\n columns: [\n { name: \"user_id\", description: \"Primary key.\", nullable: false },\n { name: \"email\", description: \"Unique, case-insensitive login email.\", nullable: false },\n { name: \"display_name\", description: \"Optional display name.\", nullable: true },\n { name: \"status\", description: \"active | disabled | locked.\", nullable: false },\n { name: \"email_verified_at\", description: \"When email was verified.\", nullable: true },\n { name: \"auth_version\", description: \"Token invalidation counter.\", nullable: false },\n { name: \"created_at\", description: \"Creation timestamp.\", nullable: false },\n { name: \"updated_at\", description: \"Last update timestamp.\", nullable: false },\n ],\n },\n {\n name: \"identity_credentials\",\n description: \"Password hashes, one per user.\",\n columns: [\n { name: \"user_id\", description: \"FK to identity_users.\", nullable: false },\n { name: \"password_hash\", description: \"Algorithm-tagged hash.\", nullable: false },\n { name: \"updated_at\", description: \"Last update timestamp.\", nullable: false },\n ],\n },\n {\n name: \"identity_sessions\",\n description: \"Server-side refresh sessions with hashed tokens.\",\n columns: [\n { name: \"session_id\", description: \"Primary key.\", nullable: false },\n { name: \"user_id\", description: \"FK to identity_users.\", nullable: false },\n { name: \"refresh_token_hash\", description: \"Hash of the active refresh token.\", nullable: false },\n { name: \"created_at\", description: \"Creation timestamp.\", nullable: false },\n { name: \"expires_at\", description: \"Expiry timestamp.\", nullable: false },\n { name: \"revoked_at\", description: \"Set when rotated or revoked.\", nullable: true },\n ],\n },\n {\n name: \"identity_roles\",\n description: \"Named roles.\",\n columns: [\n { name: \"role_id\", description: \"Primary key.\", nullable: false },\n { name: \"name\", description: \"Unique role name.\", nullable: false },\n { name: \"description\", description: \"Optional description.\", nullable: true },\n ],\n },\n {\n name: \"identity_user_roles\",\n description: \"User-to-role assignments.\",\n columns: [\n { name: \"user_id\", description: \"FK to identity_users.\", nullable: false },\n { name: \"role_id\", description: \"FK to identity_roles.\", nullable: false },\n ],\n },\n {\n name: \"identity_role_permissions\",\n description: \"Permissions granted to roles.\",\n columns: [\n { name: \"role_id\", description: \"FK to identity_roles.\", nullable: false },\n { name: \"permission\", description: \"Permission string.\", nullable: false },\n ],\n },\n {\n name: \"identity_user_permissions\",\n description: \"Permissions granted directly to users.\",\n columns: [\n { name: \"user_id\", description: \"FK to identity_users.\", nullable: false },\n { name: \"permission\", description: \"Permission string.\", nullable: false },\n ],\n },\n ],\n};\n"],"mappings":";;;AA2FA,MAAM,oBAAoB;AAE1B,MAAM,0BAAkC,WAAW,OAAO,WAAW;AACrE,MAAM,mCAAyB,IAAI,KAAK;;;;;AAMxC,SAAgB,sBAAsB,OAA4C;CAChF,IAAI,CAAC,MAAM,qBAAqB,MAAM,kBAAkB,SAAS,mBAC/D,MAAM,IAAI,oBACR,sCAAsC,kBAAkB,aAC1D;CAGF,MAAM,wBAAwB,MAAM,yBAAyB;CAC7D,MAAM,yBAAyB,MAAM,0BAA0B,OAAU,KAAK;CAC9E,MAAM,qBAAqB,MAAM,sBAAsB;CAEvD,IAAI,yBAAyB,GAC3B,MAAM,IAAI,oBAAoB,yCAAyC;CAEzE,IAAI,0BAA0B,uBAC5B,MAAM,IAAI,oBACR,oEACF;CAEF,KAAK,qBAAsB,qBAAqB,OAAQ,GACtD,MAAM,IAAI,oBAAoB,4CAA4C;CAG5E,OAAO;EACL,mBAAmB,MAAM;EACzB;EACA;EACA,QAAQ,MAAM,UAAU;EACxB,UAAU,MAAM;EAChB;EACA,SAAS;GACP,mBAAmB,MAAM,SAAS,qBAAqB;GAC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AAM;GACnE;IAAE,MAAM;IAAW,aAAa;IAAyB,UAAU;GAAM;GACzE;IAAE,MAAM;IAAsB,aAAa;IAAqC,UAAU;GAAM;GAChG;IAAE,MAAM;IAAc,aAAa;IAAuB,UAAU;GAAM;GAC1E;IAAE,MAAM;IAAc,aAAa;IAAqB,UAAU;GAAM;GACxE;IAAE,MAAM;IAAc,aAAa;IAAgC,UAAU;GAAK;EACpF;CACF;CACA;EACE,MAAM;EACN,aAAa;EACb,SAAS;GACP;IAAE,MAAM;IAAW,aAAa;IAAgB,UAAU;GAAM;GAChE;IAAE,MAAM;IAAQ,aAAa;IAAqB,UAAU;GAAM;GAClE;IAAE,MAAM;IAAe,aAAa;IAAyB,UAAU;GAAK;EAC9E;CACF;CACA;EACE,MAAM;EACN,aAAa;EACb,SAAS,CACP;GAAE,MAAM;GAAW,aAAa;GAAyB,UAAU;EAAM,GACzE;GAAE,MAAM;GAAW,aAAa;GAAyB,UAAU;EAAM,CAC3E;CACF;CACA;EACE,MAAM;EACN,aAAa;EACb,SAAS,CACP;GAAE,MAAM;GAAW,aAAa;GAAyB,UAAU;EAAM,GACzE;GAAE,MAAM;GAAc,aAAa;GAAsB,UAAU;EAAM,CAC3E;CACF;CACA;EACE,MAAM;EACN,aAAa;EACb,SAAS,CACP;GAAE,MAAM;GAAW,aAAa;GAAyB,UAAU;EAAM,GACzE;GAAE,MAAM;GAAc,aAAa;GAAsB,UAAU;EAAM,CAC3E;CACF;AACF,EACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"identity-router-D1xJ5H7y.d.cts","names":[],"sources":["../core/express/identity-router.ts"],"mappings":";;;;;UAeiB;;EAEf;;EAEA;;;;;EAKA;;EAEA;;EAEA;;EAEA;;;;;UAMe;;;;;;;;;;;;EAYf;IAA0B,QAAQ;;;;;;;;;;EAUlC;;;;;;;;;;;;;;EAeA;;;;;;;;;;;;;;EAeA,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAsIK,qBACd,SAAS,iBACT,UAAS,wBACR;;;;;;;;;;;;;;;iBAkUa,qBACd;EAAW,SAAS;KAClB,cAAc,KAAK,SAAS,KAAK,UAAU,MAAM"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"identity-router-tj3-teBI.d.mts","names":[],"sources":["../core/express/identity-router.ts"],"mappings":";;;;;UAeiB;;EAEf;;EAEA;;;;;EAKA;;EAEA;;EAEA;;EAEA;;;;;UAMe;;;;;;;;;;;;EAYf;IAA0B,QAAQ;;;;;;;;;;EAUlC;;;;;;;;;;;;;;EAeA;;;;;;;;;;;;;;EAeA,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAsIK,qBACd,SAAS,iBACT,UAAS,wBACR;;;;;;;;;;;;;;;iBAkUa,qBACd;EAAW,SAAS;KAClB,cAAc,KAAK,SAAS,KAAK,UAAU,MAAM"}
@@ -1,30 +0,0 @@
1
- //#region schema/model.d.ts
2
- /**
3
- * Logical description of the relational schema `@azlib/identity` expects.
4
- *
5
- * Concrete DDL is shipped alongside this module:
6
- * - `@azlib/identity/schema/postgres.sql`
7
- * - `@azlib/identity/schema/mysql.sql`
8
- * - `@azlib/identity/schema/sqlite.sql`
9
- * - `@azlib/identity/schema/prisma.schema`
10
- *
11
- * This object is documentation-as-data so consumers and tooling can introspect the
12
- * expected tables without parsing SQL.
13
- */
14
- interface SchemaColumn {
15
- name: string;
16
- description: string;
17
- nullable: boolean;
18
- }
19
- interface SchemaTable {
20
- name: string;
21
- description: string;
22
- columns: readonly SchemaColumn[];
23
- }
24
- interface SchemaModel {
25
- tables: readonly SchemaTable[];
26
- }
27
- declare const identitySchemaModel: SchemaModel;
28
- //#endregion
29
- export { identitySchemaModel as t };
30
- //# sourceMappingURL=index-CpufYgyn.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-CpufYgyn.d.cts","names":[],"sources":["../schema/model.ts"],"mappings":";;;;;;;;;;;;;UAYiB;EACf;EACA;EACA;;UAGe;EACf;EACA;EACA,kBAAkB;;UAGH;EACf,iBAAiB;;cAGN,qBAAqB"}
@@ -1,30 +0,0 @@
1
- //#region schema/model.d.ts
2
- /**
3
- * Logical description of the relational schema `@azlib/identity` expects.
4
- *
5
- * Concrete DDL is shipped alongside this module:
6
- * - `@azlib/identity/schema/postgres.sql`
7
- * - `@azlib/identity/schema/mysql.sql`
8
- * - `@azlib/identity/schema/sqlite.sql`
9
- * - `@azlib/identity/schema/prisma.schema`
10
- *
11
- * This object is documentation-as-data so consumers and tooling can introspect the
12
- * expected tables without parsing SQL.
13
- */
14
- interface SchemaColumn {
15
- name: string;
16
- description: string;
17
- nullable: boolean;
18
- }
19
- interface SchemaTable {
20
- name: string;
21
- description: string;
22
- columns: readonly SchemaColumn[];
23
- }
24
- interface SchemaModel {
25
- tables: readonly SchemaTable[];
26
- }
27
- declare const identitySchemaModel: SchemaModel;
28
- //#endregion
29
- export { identitySchemaModel as t };
30
- //# sourceMappingURL=index-CpufYgyn.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-CpufYgyn.d.mts","names":[],"sources":["../schema/model.ts"],"mappings":";;;;;;;;;;;;;UAYiB;EACf;EACA;EACA;;UAGe;EACf;EACA;EACA,kBAAkB;;UAGH;EACf,iBAAiB;;cAGN,qBAAqB"}