@astram/guard 0.4.0 → 0.5.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 (64) hide show
  1. package/dist/auth/auth.module.d.ts +6 -0
  2. package/dist/auth/auth.module.d.ts.map +1 -1
  3. package/dist/auth/auth.module.js +106 -15
  4. package/dist/auth/tokens.d.ts +9 -0
  5. package/dist/auth/tokens.d.ts.map +1 -1
  6. package/dist/auth/tokens.js +10 -1
  7. package/dist/authentication/log-email-sender.d.ts +13 -0
  8. package/dist/authentication/log-email-sender.d.ts.map +1 -0
  9. package/dist/authentication/log-email-sender.js +13 -0
  10. package/dist/authentication/mariadb-credential-writer.d.ts +16 -0
  11. package/dist/authentication/mariadb-credential-writer.d.ts.map +1 -0
  12. package/dist/authentication/mariadb-credential-writer.js +19 -0
  13. package/dist/authentication/mariadb-mfa-device-store.d.ts +16 -0
  14. package/dist/authentication/mariadb-mfa-device-store.d.ts.map +1 -0
  15. package/dist/authentication/mariadb-mfa-device-store.js +99 -0
  16. package/dist/authentication/mariadb-or-totp-verifier.d.ts +31 -0
  17. package/dist/authentication/mariadb-or-totp-verifier.d.ts.map +1 -0
  18. package/dist/authentication/mariadb-or-totp-verifier.js +48 -0
  19. package/dist/authentication/mariadb-profile-resolver.d.ts +24 -0
  20. package/dist/authentication/mariadb-profile-resolver.d.ts.map +1 -0
  21. package/dist/authentication/mariadb-profile-resolver.js +54 -0
  22. package/dist/authentication/mariadb-profile-writer.d.ts +18 -0
  23. package/dist/authentication/mariadb-profile-writer.d.ts.map +1 -0
  24. package/dist/authentication/mariadb-profile-writer.js +36 -0
  25. package/dist/authentication/mariadb-recovery-code-store.d.ts +47 -0
  26. package/dist/authentication/mariadb-recovery-code-store.d.ts.map +1 -0
  27. package/dist/authentication/mariadb-recovery-code-store.js +53 -0
  28. package/dist/authentication/mariadb-reset-token-store.d.ts +26 -0
  29. package/dist/authentication/mariadb-reset-token-store.d.ts.map +1 -0
  30. package/dist/authentication/mariadb-reset-token-store.js +43 -0
  31. package/dist/authentication/mariadb-session-sweeper.d.ts +33 -0
  32. package/dist/authentication/mariadb-session-sweeper.d.ts.map +1 -0
  33. package/dist/authentication/mariadb-session-sweeper.js +60 -0
  34. package/dist/config/app-config.d.ts +5 -7
  35. package/dist/config/app-config.d.ts.map +1 -1
  36. package/dist/config/app-config.js +24 -57
  37. package/dist/identity/auth-facts.controller.d.ts +24 -0
  38. package/dist/identity/auth-facts.controller.d.ts.map +1 -0
  39. package/dist/identity/auth-facts.controller.js +106 -0
  40. package/dist/identity/identity-actions.d.ts +22 -0
  41. package/dist/identity/identity-actions.d.ts.map +1 -0
  42. package/dist/identity/identity-actions.js +32 -0
  43. package/dist/identity/module-registry.bridge.d.ts +4 -0
  44. package/dist/identity/module-registry.bridge.d.ts.map +1 -0
  45. package/dist/identity/module-registry.bridge.js +43 -0
  46. package/dist/identity/permission-facts.adapter.d.ts +47 -0
  47. package/dist/identity/permission-facts.adapter.d.ts.map +1 -0
  48. package/dist/identity/permission-facts.adapter.js +108 -0
  49. package/dist/index.d.ts +3 -0
  50. package/dist/index.d.ts.map +1 -1
  51. package/dist/index.js +20 -2
  52. package/dist/migrations-dir.d.ts +2 -0
  53. package/dist/migrations-dir.d.ts.map +1 -0
  54. package/dist/migrations-dir.js +13 -0
  55. package/dist/module/shield-tokens.d.ts +6 -1
  56. package/dist/module/shield-tokens.d.ts.map +1 -1
  57. package/dist/module/shield-tokens.js +7 -1
  58. package/dist/module/shield.module.d.ts +17 -0
  59. package/dist/module/shield.module.d.ts.map +1 -1
  60. package/dist/module/shield.module.js +12 -0
  61. package/migrations/1710000000006-CreateAuthzSchema.cjs +53 -0
  62. package/migrations/1710000000007-ExtendPermissionAndRolePermission.cjs +66 -0
  63. package/migrations/1710000000008-CreateAccessBundleTables.cjs +49 -0
  64. package/package.json +5 -3
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+ /**
3
+ * AuthFactsController — the framework-DEFAULT `/identity/auth-facts` + `/identity/permissions-version`
4
+ * endpoints backing the frontend's permission-gated nav (the SDK's fact projection). Both are
5
+ * `@Public()` at the route level but SELF-SCOPED: principalId + tenantId come ONLY from the resolved
6
+ * bearer-token Principal (never a query/body param). Missing/invalid token → 401; an authorization
7
+ * store outage → 503 (never swallowed into an empty projection / fabricated version — that would
8
+ * fail-OPEN by letting a stale/empty view read as authoritative).
9
+ *
10
+ * FRAMEWORK-OWNED: mounted by the auth surface when `auth: true`; the consumer implements nothing.
11
+ */
12
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
13
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
14
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
15
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
16
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
17
+ };
18
+ var __metadata = (this && this.__metadata) || function (k, v) {
19
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
20
+ };
21
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
22
+ return function (target, key) { decorator(target, key, paramIndex); }
23
+ };
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ exports.AuthFactsController = void 0;
26
+ const common_1 = require("@nestjs/common");
27
+ const classification_decorator_js_1 = require("../enforcement/classification.decorator.js");
28
+ const tokens_js_1 = require("../request-auth/tokens.js");
29
+ const request_principal_js_1 = require("../request-auth/request-principal.js");
30
+ const tokens_js_2 = require("../auth/tokens.js");
31
+ const permission_facts_adapter_js_1 = require("./permission-facts.adapter.js");
32
+ let AuthFactsController = class AuthFactsController {
33
+ tokenBinder;
34
+ facts;
35
+ constructor(tokenBinder, facts) {
36
+ this.tokenBinder = tokenBinder;
37
+ this.facts = facts;
38
+ }
39
+ async getAuthFacts(authorization) {
40
+ const principal = await this.authenticate(authorization);
41
+ if (this.facts === undefined || this.facts === null) {
42
+ throw new common_1.HttpException({ error: 'authorization_unavailable' }, common_1.HttpStatus.SERVICE_UNAVAILABLE);
43
+ }
44
+ try {
45
+ return await this.facts.projectFor(principal.id, principal.tenantId, principal.isRoot);
46
+ }
47
+ catch (err) {
48
+ if (err instanceof permission_facts_adapter_js_1.AuthorizationUnavailableError) {
49
+ throw new common_1.HttpException({ error: 'authorization_unavailable' }, common_1.HttpStatus.SERVICE_UNAVAILABLE);
50
+ }
51
+ throw err;
52
+ }
53
+ }
54
+ async getPermissionsVersion(authorization) {
55
+ const principal = await this.authenticate(authorization);
56
+ if (this.facts === undefined || this.facts === null) {
57
+ throw new common_1.HttpException({ error: 'authorization_unavailable' }, common_1.HttpStatus.SERVICE_UNAVAILABLE);
58
+ }
59
+ try {
60
+ const version = await this.facts.currentVersionFor(principal.id, principal.tenantId);
61
+ return { version };
62
+ }
63
+ catch (err) {
64
+ if (err instanceof permission_facts_adapter_js_1.AuthorizationUnavailableError) {
65
+ throw new common_1.HttpException({ error: 'authorization_unavailable' }, common_1.HttpStatus.SERVICE_UNAVAILABLE);
66
+ }
67
+ throw err;
68
+ }
69
+ }
70
+ /** Resolve the bearer token → the caller's own Principal, or throw a generic 401. */
71
+ async authenticate(authorization) {
72
+ if (this.tokenBinder === undefined || this.tokenBinder === null) {
73
+ throw new common_1.HttpException({ error: 'unauthorized' }, common_1.HttpStatus.UNAUTHORIZED);
74
+ }
75
+ const principal = await (0, request_principal_js_1.resolveRequestPrincipal)(authorization, this.tokenBinder);
76
+ if (principal === null) {
77
+ throw new common_1.HttpException({ error: 'unauthorized' }, common_1.HttpStatus.UNAUTHORIZED);
78
+ }
79
+ return principal;
80
+ }
81
+ };
82
+ exports.AuthFactsController = AuthFactsController;
83
+ __decorate([
84
+ (0, classification_decorator_js_1.Public)(),
85
+ (0, common_1.Get)('auth-facts'),
86
+ __param(0, (0, common_1.Headers)('authorization')),
87
+ __metadata("design:type", Function),
88
+ __metadata("design:paramtypes", [String]),
89
+ __metadata("design:returntype", Promise)
90
+ ], AuthFactsController.prototype, "getAuthFacts", null);
91
+ __decorate([
92
+ (0, classification_decorator_js_1.Public)(),
93
+ (0, common_1.Get)('permissions-version'),
94
+ __param(0, (0, common_1.Headers)('authorization')),
95
+ __metadata("design:type", Function),
96
+ __metadata("design:paramtypes", [String]),
97
+ __metadata("design:returntype", Promise)
98
+ ], AuthFactsController.prototype, "getPermissionsVersion", null);
99
+ exports.AuthFactsController = AuthFactsController = __decorate([
100
+ (0, common_1.Controller)('identity'),
101
+ __param(0, (0, common_1.Optional)()),
102
+ __param(0, (0, common_1.Inject)(tokens_js_1.SHIELD_SESSION_TOKEN_BINDER)),
103
+ __param(1, (0, common_1.Optional)()),
104
+ __param(1, (0, common_1.Inject)(tokens_js_2.SHIELD_PERMISSION_FACTS)),
105
+ __metadata("design:paramtypes", [Object, Object])
106
+ ], AuthFactsController);
@@ -0,0 +1,22 @@
1
+ /**
2
+ * The fixed action vocabulary + module key for the framework's @astram/identity objects.
3
+ * Engine ObjectTypes carry no action list, so actions are synthesized here — the ONE source
4
+ * the module-registry bridge derives from. Permission keys are `identity:<typeKey>:<action>`.
5
+ * (Ported from astram3. `cross_tenant_grant` gets its own override — see below — every other
6
+ * type uses the CRUD verbs.)
7
+ */
8
+ export declare const MODULE_KEY = "identity";
9
+ export declare const IDENTITY_ACTIONS: readonly ["read", "create", "update", "delete"];
10
+ export type IdentityAction = (typeof IDENTITY_ACTIONS)[number];
11
+ /**
12
+ * `cross_tenant_grant`'s action vocabulary — NOT the CRUD verbs above. This is a
13
+ * framework-owned, authority-only object type (never CRUD'd through the RecordEngine);
14
+ * its three actions are the who-may-grant lifecycle questions the app's `authorize`
15
+ * closure answers for `CrossTenantGrantWriter` (offer -> 'share', accept -> 'accept',
16
+ * revoke -> 'revoke'). Mirrors astram3's `authz/actions.ts`'s `CROSS_TENANT_GRANT_ACTIONS`.
17
+ */
18
+ export declare const CROSS_TENANT_GRANT_ACTIONS: readonly ["share", "accept", "revoke"];
19
+ export type CrossTenantGrantAction = (typeof CROSS_TENANT_GRANT_ACTIONS)[number];
20
+ /** The action vocabulary for `typeKey` — the per-type override if one exists, else the default. */
21
+ export declare function actionsFor(typeKey: string): readonly string[];
22
+ //# sourceMappingURL=identity-actions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identity-actions.d.ts","sourceRoot":"","sources":["../../src/identity/identity-actions.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,aAAa,CAAC;AACrC,eAAO,MAAM,gBAAgB,iDAAkD,CAAC;AAChF,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE/D;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,wCAAyC,CAAC;AACjF,MAAM,MAAM,sBAAsB,GAAG,CAAC,OAAO,0BAA0B,CAAC,CAAC,MAAM,CAAC,CAAC;AAUjF,mGAAmG;AACnG,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAE7D"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CROSS_TENANT_GRANT_ACTIONS = exports.IDENTITY_ACTIONS = exports.MODULE_KEY = void 0;
4
+ exports.actionsFor = actionsFor;
5
+ /**
6
+ * The fixed action vocabulary + module key for the framework's @astram/identity objects.
7
+ * Engine ObjectTypes carry no action list, so actions are synthesized here — the ONE source
8
+ * the module-registry bridge derives from. Permission keys are `identity:<typeKey>:<action>`.
9
+ * (Ported from astram3. `cross_tenant_grant` gets its own override — see below — every other
10
+ * type uses the CRUD verbs.)
11
+ */
12
+ exports.MODULE_KEY = 'identity';
13
+ exports.IDENTITY_ACTIONS = ['read', 'create', 'update', 'delete'];
14
+ /**
15
+ * `cross_tenant_grant`'s action vocabulary — NOT the CRUD verbs above. This is a
16
+ * framework-owned, authority-only object type (never CRUD'd through the RecordEngine);
17
+ * its three actions are the who-may-grant lifecycle questions the app's `authorize`
18
+ * closure answers for `CrossTenantGrantWriter` (offer -> 'share', accept -> 'accept',
19
+ * revoke -> 'revoke'). Mirrors astram3's `authz/actions.ts`'s `CROSS_TENANT_GRANT_ACTIONS`.
20
+ */
21
+ exports.CROSS_TENANT_GRANT_ACTIONS = ['share', 'accept', 'revoke'];
22
+ /**
23
+ * Per-type action-vocabulary override. Every type not listed here defaults to
24
+ * {@link IDENTITY_ACTIONS} (the CRUD verbs).
25
+ */
26
+ const ACTIONS_BY_TYPE = {
27
+ cross_tenant_grant: exports.CROSS_TENANT_GRANT_ACTIONS,
28
+ };
29
+ /** The action vocabulary for `typeKey` — the per-type override if one exists, else the default. */
30
+ function actionsFor(typeKey) {
31
+ return ACTIONS_BY_TYPE[typeKey] ?? exports.IDENTITY_ACTIONS;
32
+ }
@@ -0,0 +1,4 @@
1
+ import type { ModuleRegistry } from '@astram/core';
2
+ import type { ObjectTypeInput } from '@astram/engine';
3
+ export declare function buildIdentityModuleRegistry(inputs: readonly ObjectTypeInput[]): ModuleRegistry;
4
+ //# sourceMappingURL=module-registry.bridge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module-registry.bridge.d.ts","sourceRoot":"","sources":["../../src/identity/module-registry.bridge.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,cAAc,EAIf,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAc,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAQlE,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,SAAS,eAAe,EAAE,GAAG,cAAc,CA4B9F"}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildIdentityModuleRegistry = buildIdentityModuleRegistry;
4
+ /**
5
+ * Bridge: engine ObjectTypes → a populated core ModuleRegistry. Ported from astram3 (framework
6
+ * now owns identity). Engine ObjectTypes describe physical tables; core's gates + the
7
+ * permission-facts projection need object types + ACTIONS + tiers + planes. ObjectTypes carry no
8
+ * action list, so we synthesize per-type actions (actionsFor). Every action is `gated` — nothing
9
+ * open unless reclassified. `register()` throws on duplicate typeKey/permissionKey.
10
+ */
11
+ const core_1 = require("@astram/core");
12
+ const engine_1 = require("@astram/engine");
13
+ const identity_actions_js_1 = require("./identity-actions.js");
14
+ function toObjectType(input) {
15
+ return typeof input === 'function' ? (0, engine_1.reflectObjectType)(input) : input;
16
+ }
17
+ function buildIdentityModuleRegistry(inputs) {
18
+ const regs = inputs.map(toObjectType);
19
+ const objectTypes = regs.map((r) => {
20
+ const a = r.access ?? {};
21
+ const access = {
22
+ ...(a.owned !== undefined ? { owned: a.owned } : {}),
23
+ ...(a.tenantScoped !== undefined ? { tenantScoped: a.tenantScoped } : {}),
24
+ ...(a.system !== undefined ? { system: a.system } : {}),
25
+ };
26
+ return {
27
+ typeKey: r.typeKey,
28
+ label: r.typeKey,
29
+ fields: r.fields.map((f) => ({ key: f.key, label: f.key })),
30
+ ...(Object.keys(access).length > 0 ? { access } : {}),
31
+ };
32
+ });
33
+ const actions = regs.flatMap((r) => (0, identity_actions_js_1.actionsFor)(r.typeKey).map((actionKey) => ({
34
+ actionKey,
35
+ typeKey: r.typeKey,
36
+ tier: 'gated',
37
+ plane: r.access?.plane ?? 'data',
38
+ })));
39
+ const metadata = { moduleKey: identity_actions_js_1.MODULE_KEY, objectTypes, actions };
40
+ const registry = (0, core_1.createModuleRegistry)();
41
+ registry.register(metadata);
42
+ return registry;
43
+ }
@@ -0,0 +1,47 @@
1
+ /**
2
+ * MariaDbPermissionFactsAdapter — the framework-DEFAULT source of a caller's coarse permission
3
+ * facts, backing `GET /identity/auth-facts` + `/identity/permissions-version`. Reads role ids from
4
+ * the caller's active in-effect postings (`shield_app`), the granted permission keys for those
5
+ * roles (`shield_authz.role_permission`), and the per-tenant permission version
6
+ * (`shield_authz.authz_permission_version`). Projects to `{ action, allowed:true }` facts (an
7
+ * absent fact is the fail-closed deny). A store outage THROWS AuthorizationUnavailableError —
8
+ * never a fabricated empty projection (that would silently read as "you have no grants").
9
+ */
10
+ import type { Pool } from 'mariadb';
11
+ export interface AuthFactDto {
12
+ readonly action: string;
13
+ readonly allowed: boolean;
14
+ readonly resource?: string;
15
+ readonly reasonCode?: string;
16
+ }
17
+ export interface AuthFactProjection {
18
+ readonly principalId: string;
19
+ readonly facts: readonly AuthFactDto[];
20
+ readonly projectedAt: number;
21
+ readonly permissionsVersion?: number;
22
+ }
23
+ /** A store/dependency outage while computing facts — the controller maps this to 503. */
24
+ export declare class AuthorizationUnavailableError extends Error {
25
+ constructor(message?: string);
26
+ }
27
+ export declare class MariaDbPermissionFactsAdapter {
28
+ private readonly pool;
29
+ private readonly listActions;
30
+ private readonly controlPlaneKeys;
31
+ private readonly now;
32
+ constructor(pool: Pool, listActions: () => readonly string[], controlPlaneKeys: readonly string[], now?: () => number);
33
+ projectFor(principalId: string, tenantId: string, isRoot: boolean): Promise<AuthFactProjection>;
34
+ currentVersionFor(_principalId: string, tenantId: string): Promise<number>;
35
+ private readRoleIdsForTenant;
36
+ private readGrantKeys;
37
+ private readVersion;
38
+ /**
39
+ * Expand wildcard grant keys against the registry's declared actions:
40
+ * 'identity' / 'identity:*' → every 'identity:' action
41
+ * 'identity:company:*' → every 'identity:company:<action>'
42
+ * Exact keys pass through. Bounded to listActions() so a wildcard can never grant an
43
+ * action that does not exist.
44
+ */
45
+ private expandGrantKeys;
46
+ }
47
+ //# sourceMappingURL=permission-facts.adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"permission-facts.adapter.d.ts","sourceRoot":"","sources":["../../src/identity/permission-facts.adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAEpC,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AACD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,SAAS,WAAW,EAAE,CAAC;IACvC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;CACtC;AAED,yFAAyF;AACzF,qBAAa,6BAA8B,SAAQ,KAAK;gBAC1C,OAAO,SAA8B;CAIlD;AAMD,qBAAa,6BAA6B;IAEtC,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IACjC,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAHH,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,MAAM,SAAS,MAAM,EAAE,EACpC,gBAAgB,EAAE,SAAS,MAAM,EAAE,EACnC,GAAG,GAAE,MAAM,MAAiB;IAGzC,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAqB/F,iBAAiB,CAAC,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;YASlE,oBAAoB;YAcpB,aAAa;YASb,WAAW;IAQzB;;;;;;OAMG;IACH,OAAO,CAAC,eAAe;CAaxB"}
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+ /**
3
+ * MariaDbPermissionFactsAdapter — the framework-DEFAULT source of a caller's coarse permission
4
+ * facts, backing `GET /identity/auth-facts` + `/identity/permissions-version`. Reads role ids from
5
+ * the caller's active in-effect postings (`shield_app`), the granted permission keys for those
6
+ * roles (`shield_authz.role_permission`), and the per-tenant permission version
7
+ * (`shield_authz.authz_permission_version`). Projects to `{ action, allowed:true }` facts (an
8
+ * absent fact is the fail-closed deny). A store outage THROWS AuthorizationUnavailableError —
9
+ * never a fabricated empty projection (that would silently read as "you have no grants").
10
+ */
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.MariaDbPermissionFactsAdapter = exports.AuthorizationUnavailableError = void 0;
13
+ /** A store/dependency outage while computing facts — the controller maps this to 503. */
14
+ class AuthorizationUnavailableError extends Error {
15
+ constructor(message = 'authorization_unavailable') {
16
+ super(message);
17
+ this.name = 'AuthorizationUnavailableError';
18
+ }
19
+ }
20
+ exports.AuthorizationUnavailableError = AuthorizationUnavailableError;
21
+ class MariaDbPermissionFactsAdapter {
22
+ pool;
23
+ listActions;
24
+ controlPlaneKeys;
25
+ now;
26
+ constructor(pool, listActions, controlPlaneKeys, now = Date.now) {
27
+ this.pool = pool;
28
+ this.listActions = listActions;
29
+ this.controlPlaneKeys = controlPlaneKeys;
30
+ this.now = now;
31
+ }
32
+ async projectFor(principalId, tenantId, isRoot) {
33
+ try {
34
+ const roleIds = await this.readRoleIdsForTenant(principalId, tenantId);
35
+ const granted = roleIds.length > 0 ? await this.readGrantKeys(roleIds) : [];
36
+ const expanded = this.expandGrantKeys(granted);
37
+ const keys = isRoot
38
+ ? [...new Set([...expanded, ...this.controlPlaneKeys])]
39
+ : expanded;
40
+ const permissionsVersion = await this.readVersion(tenantId);
41
+ return {
42
+ principalId,
43
+ facts: keys.map((action) => ({ action, allowed: true })),
44
+ projectedAt: this.now(),
45
+ permissionsVersion,
46
+ };
47
+ }
48
+ catch (err) {
49
+ if (err instanceof AuthorizationUnavailableError)
50
+ throw err;
51
+ throw new AuthorizationUnavailableError(err.message);
52
+ }
53
+ }
54
+ async currentVersionFor(_principalId, tenantId) {
55
+ try {
56
+ return await this.readVersion(tenantId);
57
+ }
58
+ catch (err) {
59
+ if (err instanceof AuthorizationUnavailableError)
60
+ throw err;
61
+ throw new AuthorizationUnavailableError(err.message);
62
+ }
63
+ }
64
+ async readRoleIdsForTenant(userUuid, companyUuid) {
65
+ const nowMs = this.now();
66
+ const rows = (await this.pool.query(`SELECT DISTINCT mp.mp_role_uuid AS role_uuid
67
+ FROM \`shield_app\`.\`company_membership\` cm
68
+ JOIN \`shield_app\`.\`membership_posting\` mp ON mp.mp_membership_uuid = cm.cm_uuid
69
+ WHERE cm.cm_user_uuid = ? AND cm.cm_company_uuid = ? AND cm.cm_is_active = 1
70
+ AND (mp.mp_effective_from_ms IS NULL OR mp.mp_effective_from_ms <= ?)
71
+ AND (mp.mp_effective_until_ms IS NULL OR mp.mp_effective_until_ms > ?)`, [userUuid, companyUuid, nowMs, nowMs]));
72
+ return rows.map((r) => r.role_uuid);
73
+ }
74
+ async readGrantKeys(roleIds) {
75
+ const placeholders = roleIds.map(() => '?').join(', ');
76
+ const rows = (await this.pool.query(`SELECT rp_perm_key FROM \`shield_authz\`.\`role_permission\` WHERE rp_role_uuid IN (${placeholders})`, [...roleIds]));
77
+ return rows.map((r) => r.rp_perm_key);
78
+ }
79
+ async readVersion(tenantId) {
80
+ const rows = (await this.pool.query('SELECT apv_version FROM `shield_authz`.`authz_permission_version` WHERE apv_tenant_uuid = ? LIMIT 1', [tenantId]));
81
+ return rows[0] !== undefined ? Number(rows[0].apv_version) : 0;
82
+ }
83
+ /**
84
+ * Expand wildcard grant keys against the registry's declared actions:
85
+ * 'identity' / 'identity:*' → every 'identity:' action
86
+ * 'identity:company:*' → every 'identity:company:<action>'
87
+ * Exact keys pass through. Bounded to listActions() so a wildcard can never grant an
88
+ * action that does not exist.
89
+ */
90
+ expandGrantKeys(grantKeys) {
91
+ const all = this.listActions();
92
+ const out = new Set();
93
+ for (const key of grantKeys) {
94
+ if (key.endsWith(':*') || key.indexOf(':') === -1) {
95
+ const prefix = key.endsWith(':*') ? key.slice(0, -1) : `${key}:`; // 'identity:*'→'identity:' ; 'identity'→'identity:'
96
+ for (const a of all)
97
+ if (a.startsWith(prefix))
98
+ out.add(a);
99
+ }
100
+ else {
101
+ if (all.includes(key))
102
+ out.add(key);
103
+ }
104
+ }
105
+ return [...out];
106
+ }
107
+ }
108
+ exports.MariaDbPermissionFactsAdapter = MariaDbPermissionFactsAdapter;
package/dist/index.d.ts CHANGED
@@ -14,6 +14,9 @@
14
14
  * Depends on `@astram/core` (workspace); PEER-depends on `@nestjs/common`,
15
15
  * `@nestjs/core`, `reflect-metadata`, `rxjs` so the host owns one copy of each.
16
16
  */
17
+ export { guardMigrationsDir } from './migrations-dir.js';
18
+ export { buildIdentityModuleRegistry } from './identity/module-registry.bridge.js';
19
+ export { MODULE_KEY, IDENTITY_ACTIONS, actionsFor } from './identity/identity-actions.js';
17
20
  export { ShieldModule, SHIELD_DECISION_AUTHORITY, type ShieldModuleOptions, type ShieldModuleAsyncOptions, type RecordAuthorizationInputs, } from './module/shield.module.js';
18
21
  export { Public, Classified, CLASSIFICATION_METADATA, DEFAULT_CLASSIFIED_ACTION, normalizeClassification, } from './enforcement/classification.decorator.js';
19
22
  export type { Classification } from './enforcement/classification.decorator.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EACL,YAAY,EACZ,yBAAyB,EACzB,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAI7B,KAAK,yBAAyB,GAC/B,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EACL,MAAM,EACN,UAAU,EACV,uBAAuB,EACvB,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,2CAA2C,CAAC;AACnD,YAAY,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAKhF,OAAO,EAAE,yBAAyB,EAAE,MAAM,+CAA+C,CAAC;AAC1F,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAA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AC3D,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAK9D,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,qBAAqB,GACtB,MAAM,2BAA2B,CAAC;AAKnC,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC"}
package/dist/index.js CHANGED
@@ -16,8 +16,26 @@
16
16
  * `@nestjs/core`, `reflect-metadata`, `rxjs` so the host owns one copy of each.
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.InvalidGrantError = exports.GrantNotPermittedError = exports.SHIELD_CROSS_TENANT_GRANT_WRITER = exports.CrossTenantGrantWriter = exports.SHIELD_CROSS_TENANT_GRANT_PORT = exports.MariaDbCrossTenantGrantAdapter = exports.makeShareDeleteCascade = exports.ShareStoreUnavailableError = exports.ShareNotPermittedError = exports.SHIELD_RECORD_SHARE_WRITER = exports.RecordShareWriter = exports.SHIELD_RECORD_SHARE_PORT = exports.MariaDbRecordShareAdapter = exports.SHIELD_RECORD_RULE_PORT = exports.MariaDbRecordPermissionRuleAdapter = exports.SHIELD_CLOCK = exports.SHIELD_REFRESH_HASHER = exports.SHIELD_TOKEN_GENERATOR = exports.systemClockProvider = exports.refreshHasherProvider = exports.cryptoTokenGeneratorProvider = exports.SystemClock = exports.Sha256RefreshTokenHasher = exports.CryptoTokenGenerator = exports.SHIELD_HOT_SESSION_STORE = exports.RedisHotSessionStore = exports.SHIELD_SESSION_RECORD_STORE = exports.MariaDbSessionRecordStore = exports.SHIELD_PASSWORD_HASHER = exports.argon2idHasherProvider = exports.Argon2idPasswordHasher = exports.stubDecisionAuthority = exports.GlobalEnforcementGuard = exports.NO_SESSION_FACTS = exports.SHIELD_SESSION_FACTS_ALS = exports.extractBearerToken = exports.principalFromClaims = exports.resolveRequestPrincipal = exports.SessionTokenBinder = exports.SHIELD_SESSION_TOKEN_BINDER = exports.CatalogGatabilityError = exports.CatalogReconciler = exports.OperationInventoryScanner = exports.normalizeClassification = exports.DEFAULT_CLASSIFIED_ACTION = exports.CLASSIFICATION_METADATA = exports.Classified = exports.Public = exports.SHIELD_DECISION_AUTHORITY = exports.ShieldModule = void 0;
20
- exports.AccountController = exports.generateRecoveryCodes = exports.buildOtpauthUri = exports.generateTotpSecret = exports.PendingMfaStore = exports.AuthController = exports.SHIELD_SESSION_FACTS_PROJECTOR = exports.hmacSha1 = exports.resolveTotpVerifier = exports.makeDefaultTotpVerifier = exports.AuthModule = exports.PersistenceModule = exports.MariaDbCredentialResolver = exports.SHIELD_TOTP_VERIFIER_OVERRIDE = exports.SHIELD_MFA_DEVICE_STORE = exports.SHIELD_AUDIT_SINK = exports.SHIELD_SESSION_SWEEPER = exports.SHIELD_PROFILE_WRITER = exports.SHIELD_RECOVERY_CODE_STORE = exports.SHIELD_EMAIL_SENDER = exports.SHIELD_RESET_TOKEN_STORE = exports.SHIELD_CREDENTIAL_WRITER = exports.SHIELD_SESSION_AUTHORITY = exports.SHIELD_AUTHENTICATOR = exports.SHIELD_PROFILE_RESOLVER = exports.SHIELD_CREDENTIAL_RESOLVER = exports.SHIELD_REDIS = exports.SHIELD_DB_POOL = exports.DEFAULT_REDIS_URL = exports.DEFAULT_DB_CONFIG = exports.assertRefreshHmacKey = exports.loadRefreshHmacKey = exports.loadSessionLifetimes = exports.loadRedisConfig = exports.loadDbConfig = exports.SCHEMA_SVC_POOL_HARD_CAP = exports.DEFAULT_POOL_BUDGET = exports.evaluatePoolBudget = exports.loadPoolBudget = exports.loadAppConfig = exports.APP_CONFIG = exports.assertPoolBudget = exports.BootSequence = exports.buildRecordAuthorization = exports.SHIELD_OPERATION_AUTHORITY_PORT = exports.ManifestOperationAuthorityAdapter = exports.GrantStoreUnavailableError = void 0;
19
+ exports.MariaDbCrossTenantGrantAdapter = exports.makeShareDeleteCascade = exports.ShareStoreUnavailableError = exports.ShareNotPermittedError = exports.SHIELD_RECORD_SHARE_WRITER = exports.RecordShareWriter = exports.SHIELD_RECORD_SHARE_PORT = exports.MariaDbRecordShareAdapter = exports.SHIELD_RECORD_RULE_PORT = exports.MariaDbRecordPermissionRuleAdapter = exports.SHIELD_CLOCK = exports.SHIELD_REFRESH_HASHER = exports.SHIELD_TOKEN_GENERATOR = exports.systemClockProvider = exports.refreshHasherProvider = exports.cryptoTokenGeneratorProvider = exports.SystemClock = exports.Sha256RefreshTokenHasher = exports.CryptoTokenGenerator = exports.SHIELD_HOT_SESSION_STORE = exports.RedisHotSessionStore = exports.SHIELD_SESSION_RECORD_STORE = exports.MariaDbSessionRecordStore = exports.SHIELD_PASSWORD_HASHER = exports.argon2idHasherProvider = exports.Argon2idPasswordHasher = exports.stubDecisionAuthority = exports.GlobalEnforcementGuard = exports.NO_SESSION_FACTS = exports.SHIELD_SESSION_FACTS_ALS = exports.extractBearerToken = exports.principalFromClaims = exports.resolveRequestPrincipal = exports.SessionTokenBinder = exports.SHIELD_SESSION_TOKEN_BINDER = exports.CatalogGatabilityError = exports.CatalogReconciler = exports.OperationInventoryScanner = exports.normalizeClassification = exports.DEFAULT_CLASSIFIED_ACTION = exports.CLASSIFICATION_METADATA = exports.Classified = exports.Public = exports.SHIELD_DECISION_AUTHORITY = exports.ShieldModule = exports.actionsFor = exports.IDENTITY_ACTIONS = exports.MODULE_KEY = exports.buildIdentityModuleRegistry = exports.guardMigrationsDir = void 0;
20
+ exports.buildOtpauthUri = exports.generateTotpSecret = exports.PendingMfaStore = exports.AuthController = exports.SHIELD_SESSION_FACTS_PROJECTOR = exports.hmacSha1 = exports.resolveTotpVerifier = exports.makeDefaultTotpVerifier = exports.AuthModule = exports.PersistenceModule = exports.MariaDbCredentialResolver = exports.SHIELD_TOTP_VERIFIER_OVERRIDE = exports.SHIELD_MFA_DEVICE_STORE = exports.SHIELD_AUDIT_SINK = exports.SHIELD_SESSION_SWEEPER = exports.SHIELD_PROFILE_WRITER = exports.SHIELD_RECOVERY_CODE_STORE = exports.SHIELD_EMAIL_SENDER = exports.SHIELD_RESET_TOKEN_STORE = exports.SHIELD_CREDENTIAL_WRITER = exports.SHIELD_SESSION_AUTHORITY = exports.SHIELD_AUTHENTICATOR = exports.SHIELD_PROFILE_RESOLVER = exports.SHIELD_CREDENTIAL_RESOLVER = exports.SHIELD_REDIS = exports.SHIELD_DB_POOL = exports.DEFAULT_REDIS_URL = exports.DEFAULT_DB_CONFIG = exports.assertRefreshHmacKey = exports.loadRefreshHmacKey = exports.loadSessionLifetimes = exports.loadRedisConfig = exports.loadDbConfig = exports.SCHEMA_SVC_POOL_HARD_CAP = exports.DEFAULT_POOL_BUDGET = exports.evaluatePoolBudget = exports.loadPoolBudget = exports.loadAppConfig = exports.APP_CONFIG = exports.assertPoolBudget = exports.BootSequence = exports.buildRecordAuthorization = exports.SHIELD_OPERATION_AUTHORITY_PORT = exports.ManifestOperationAuthorityAdapter = exports.GrantStoreUnavailableError = exports.InvalidGrantError = exports.GrantNotPermittedError = exports.SHIELD_CROSS_TENANT_GRANT_WRITER = exports.CrossTenantGrantWriter = exports.SHIELD_CROSS_TENANT_GRANT_PORT = void 0;
21
+ exports.AccountController = exports.generateRecoveryCodes = void 0;
22
+ // Framework authz migrations (shield_authz DDL — permission / role_permission /
23
+ // authz_permission_version). Absolute path a consumer's `@astram/migrate` setup merges in.
24
+ var migrations_dir_js_1 = require("./migrations-dir.js");
25
+ Object.defineProperty(exports, "guardMigrationsDir", { enumerable: true, get: function () { return migrations_dir_js_1.guardMigrationsDir; } });
26
+ // The identity module-registry BRIDGE (engine ObjectTypes → a populated core
27
+ // ModuleRegistry) + the identity action vocabulary. Exported so `@astram/identity`
28
+ // (which depends on `@astram/guard` — the sanctioned graph direction) can build the
29
+ // registry from its OWN `identityObjects` and project the permission-key universe it
30
+ // passes back into `ShieldModule.forRoot({ identityActionKeys, identityControlPlaneKeys })`.
31
+ // Guard NEVER imports `@astram/identity`; the keys reach the auth-facts adapter ONLY as
32
+ // runtime option values the consumer threads in.
33
+ var module_registry_bridge_js_1 = require("./identity/module-registry.bridge.js");
34
+ Object.defineProperty(exports, "buildIdentityModuleRegistry", { enumerable: true, get: function () { return module_registry_bridge_js_1.buildIdentityModuleRegistry; } });
35
+ var identity_actions_js_1 = require("./identity/identity-actions.js");
36
+ Object.defineProperty(exports, "MODULE_KEY", { enumerable: true, get: function () { return identity_actions_js_1.MODULE_KEY; } });
37
+ Object.defineProperty(exports, "IDENTITY_ACTIONS", { enumerable: true, get: function () { return identity_actions_js_1.IDENTITY_ACTIONS; } });
38
+ Object.defineProperty(exports, "actionsFor", { enumerable: true, get: function () { return identity_actions_js_1.actionsFor; } });
21
39
  // The single registration seam.
22
40
  var shield_module_js_1 = require("./module/shield.module.js");
23
41
  Object.defineProperty(exports, "ShieldModule", { enumerable: true, get: function () { return shield_module_js_1.ShieldModule; } });
@@ -0,0 +1,2 @@
1
+ export declare const guardMigrationsDir: string;
2
+ //# sourceMappingURL=migrations-dir.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migrations-dir.d.ts","sourceRoot":"","sources":["../src/migrations-dir.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,kBAAkB,EAAE,MAA4C,CAAC"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.guardMigrationsDir = void 0;
4
+ /**
5
+ * Absolute path to the framework authz migration files (`packages/guard/migrations`).
6
+ *
7
+ * The consuming app resolves this (via `@astram/migrate`) to MERGE guard's authz migrations
8
+ * with @astram/identity's + its own. Resolved relative to THIS compiled module's directory:
9
+ * `dist/migrations-dir.js` → `../migrations` (the migrations dir sits beside `dist/`, at the
10
+ * package root, published via package.json `files`).
11
+ */
12
+ const node_path_1 = require("node:path");
13
+ exports.guardMigrationsDir = (0, node_path_1.join)(__dirname, '..', 'migrations');
@@ -10,6 +10,11 @@
10
10
  * ADR-0001 decision entry both the global enforcement guard and the engine's
11
11
  * permission-gate stage consult. Provided app-wide by `ShieldModule.forRoot()`
12
12
  * (default: the deny-by-default stub; overridable via the `decisionAuthority` option).
13
+ *
14
+ * DEFINED IN `@astram/core` and RE-EXPORTED here for back-compat — moved there so
15
+ * `@astram/engine` can consume the same token WITHOUT importing `@astram/guard` (which
16
+ * depends on engine — a guard-local token created an engine ↔ guard cycle). Both packages
17
+ * now import the ONE symbol from core, so it stays a single DI identity across the app.
13
18
  */
14
- export declare const SHIELD_DECISION_AUTHORITY: unique symbol;
19
+ export { SHIELD_DECISION_AUTHORITY } from '@astram/core';
15
20
  //# sourceMappingURL=shield-tokens.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"shield-tokens.d.ts","sourceRoot":"","sources":["../../src/module/shield-tokens.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,eAAsC,CAAC"}
1
+ {"version":3,"file":"shield-tokens.d.ts","sourceRoot":"","sources":["../../src/module/shield-tokens.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;;;;GAUG;AACH,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC"}
@@ -13,5 +13,11 @@ exports.SHIELD_DECISION_AUTHORITY = void 0;
13
13
  * ADR-0001 decision entry both the global enforcement guard and the engine's
14
14
  * permission-gate stage consult. Provided app-wide by `ShieldModule.forRoot()`
15
15
  * (default: the deny-by-default stub; overridable via the `decisionAuthority` option).
16
+ *
17
+ * DEFINED IN `@astram/core` and RE-EXPORTED here for back-compat — moved there so
18
+ * `@astram/engine` can consume the same token WITHOUT importing `@astram/guard` (which
19
+ * depends on engine — a guard-local token created an engine ↔ guard cycle). Both packages
20
+ * now import the ONE symbol from core, so it stays a single DI identity across the app.
16
21
  */
17
- exports.SHIELD_DECISION_AUTHORITY = Symbol('SHIELD_DECISION_AUTHORITY');
22
+ var core_1 = require("@astram/core");
23
+ Object.defineProperty(exports, "SHIELD_DECISION_AUTHORITY", { enumerable: true, get: function () { return core_1.SHIELD_DECISION_AUTHORITY; } });
@@ -138,6 +138,14 @@ export interface ShieldModuleOptions {
138
138
  * `auth: true`.
139
139
  */
140
140
  readonly rootIds?: readonly string[];
141
+ /**
142
+ * The identity permission-key universe for the auth-facts projection. Pass
143
+ * `identityAuthActionKeys` from `@astram/identity` when `auth: true` to light up the
144
+ * permission-gated admin nav. Only consulted when `auth: true`.
145
+ */
146
+ readonly identityActionKeys?: readonly string[];
147
+ /** The control-plane subset — pass `identityControlPlaneKeys` from `@astram/identity`. */
148
+ readonly identityControlPlaneKeys?: readonly string[];
141
149
  /**
142
150
  * OPTIONAL eager session-facts projector (ADR-0011) — see
143
151
  * {@link AuthModuleOptions.sessionFactsProjector}. Threaded straight through to
@@ -224,6 +232,15 @@ export interface ShieldModuleAsyncOptions {
224
232
  * then threaded exactly like the static case. Only consulted when `auth: true`.
225
233
  */
226
234
  readonly rootIds?: readonly string[];
235
+ /**
236
+ * The identity permission-key universe for the auth-facts projection — see
237
+ * {@link ShieldModuleOptions.identityActionKeys}. STATIC here (like the other seams): a
238
+ * registration-time collaborator threaded into the statically-composed {@link AuthModule}
239
+ * import. Only consulted when `auth: true`.
240
+ */
241
+ readonly identityActionKeys?: readonly string[];
242
+ /** The control-plane subset — see {@link ShieldModuleOptions.identityControlPlaneKeys}. */
243
+ readonly identityControlPlaneKeys?: readonly string[];
227
244
  /**
228
245
  * OPTIONAL eager session-facts projector — see {@link ShieldModuleOptions.sessionFactsProjector}.
229
246
  * STATIC here (like the other seams): a registration-time collaborator threaded into the
@@ -1 +1 @@
1
- {"version":3,"file":"shield.module.d.ts","sourceRoot":"","sources":["../../src/module/shield.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,aAAa,EAAiB,MAAM,gBAAgB,CAAC;AAOnF,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAQvE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,uCAAuC,CAAC;AACvF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,KAAK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AAwB,GAAG,aAAa;CA2FtE"}
@@ -188,6 +188,12 @@ let ShieldModule = ShieldModule_1 = class ShieldModule {
188
188
  ...(options.mfaDeviceStore ? { mfaDeviceStore: options.mfaDeviceStore } : {}),
189
189
  ...(options.totpVerifier ? { totpVerifier: options.totpVerifier } : {}),
190
190
  ...(options.rootIds ? { rootIds: options.rootIds } : {}),
191
+ ...(options.identityActionKeys
192
+ ? { identityActionKeys: options.identityActionKeys }
193
+ : {}),
194
+ ...(options.identityControlPlaneKeys
195
+ ? { identityControlPlaneKeys: options.identityControlPlaneKeys }
196
+ : {}),
191
197
  ...(options.sessionFactsProjector
192
198
  ? { sessionFactsProjector: options.sessionFactsProjector }
193
199
  : {}),
@@ -293,6 +299,12 @@ let ShieldModule = ShieldModule_1 = class ShieldModule {
293
299
  ...(options.mfaDeviceStore ? { mfaDeviceStore: options.mfaDeviceStore } : {}),
294
300
  ...(options.totpVerifier ? { totpVerifier: options.totpVerifier } : {}),
295
301
  ...(options.rootIds ? { rootIds: options.rootIds } : {}),
302
+ ...(options.identityActionKeys
303
+ ? { identityActionKeys: options.identityActionKeys }
304
+ : {}),
305
+ ...(options.identityControlPlaneKeys
306
+ ? { identityControlPlaneKeys: options.identityControlPlaneKeys }
307
+ : {}),
296
308
  ...(options.sessionFactsProjector
297
309
  ? { sessionFactsProjector: options.sessionFactsProjector }
298
310
  : {}),