@kindgi/authz 0.1.4 → 0.1.5

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.
package/dist/check.d.ts CHANGED
@@ -64,5 +64,21 @@ export interface AuthzCheckBinding {
64
64
  * API layer to strip rows a caller can't read.
65
65
  */
66
66
  checkBatch(principal: Principal, action: Action, resources: readonly ResourceRef[], ctx?: AuthzCheckContext): Promise<readonly Decision[]>;
67
+ /**
68
+ * The ids of every object of `type` the principal may `action`, after
69
+ * its downscope, and only those its `onBehalfOf` may too (OpenFGA
70
+ * `ListObjects`). For a guard compiled into a query, such as which
71
+ * projects' memory a caller reads. Optional: without it, callers fall
72
+ * back to `checkBatch` over the objects they can enumerate.
73
+ */
74
+ listObjects?(principal: Principal, action: Action, type: ResourceRef['type'], ctx?: AuthzCheckContext): Promise<readonly string[]>;
75
+ /**
76
+ * Optional. Whether `resource` belongs to project `projectId` in the
77
+ * principal's tenant: its `parent` is that project (an agent, a flow, a
78
+ * run, …), or its `scope` is (a secret, an env). The API layer asks it
79
+ * to hold an API key limited to a project to that project's resources.
80
+ * Without it, such a key reaches only the project itself.
81
+ */
82
+ inProject?(principal: Principal, resource: ResourceRef, projectId: string, ctx?: AuthzCheckContext): Promise<boolean>;
67
83
  }
68
84
  //# sourceMappingURL=check.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../src/check.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAElE,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,YAAY,GAAG,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,WAAW,EAAE,EACjC,GAAG,CAAC,EAAE,iBAAiB,GACtB,OAAO,CAAC,SAAS,QAAQ,EAAE,CAAC,CAAC;IAEhC;;;;;;OAMG;IACH,WAAW,CAAC,CACV,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,EACzB,GAAG,CAAC,EAAE,iBAAiB,GACtB,OAAO,CAAC,SAAS,MAAM,EAAE,CAAC,CAAC;IAE9B;;;;;;OAMG;IACH,SAAS,CAAC,CACR,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,WAAW,EACrB,SAAS,EAAE,MAAM,EACjB,GAAG,CAAC,EAAE,iBAAiB,GACtB,OAAO,CAAC,OAAO,CAAC,CAAC;CACrB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kindgi/authz",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "Kindgi™ authorization shape. The public vocabulary and interfaces of Kindgi's authorization stack: Action verbs (read/write/execute/…), ObjectType enum (agent/flow/tool/…), ResourceRef, Principal (who is calling, with delegation and downscoping), the AuthzCheckBinding decision-point interface and its Decision (allow/deny + reason), FGA tuple builders and the TupleEnqueueHook outbox contract, the 403 DenyPayload shape, and reviewer roles. Types and pure functions — no runtime state. The FGA store, the check implementation and the tuple worker are supplied by the deployment.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -28,7 +28,7 @@
28
28
  "README.md"
29
29
  ],
30
30
  "dependencies": {
31
- "@kindgi/types": "0.1.4"
31
+ "@kindgi/types": "0.1.5"
32
32
  },
33
33
  "engines": {
34
34
  "node": ">=22.12.0"
package/src/check.ts CHANGED
@@ -93,4 +93,32 @@ export interface AuthzCheckBinding {
93
93
  resources: readonly ResourceRef[],
94
94
  ctx?: AuthzCheckContext,
95
95
  ): Promise<readonly Decision[]>;
96
+
97
+ /**
98
+ * The ids of every object of `type` the principal may `action`, after
99
+ * its downscope, and only those its `onBehalfOf` may too (OpenFGA
100
+ * `ListObjects`). For a guard compiled into a query, such as which
101
+ * projects' memory a caller reads. Optional: without it, callers fall
102
+ * back to `checkBatch` over the objects they can enumerate.
103
+ */
104
+ listObjects?(
105
+ principal: Principal,
106
+ action: Action,
107
+ type: ResourceRef['type'],
108
+ ctx?: AuthzCheckContext,
109
+ ): Promise<readonly string[]>;
110
+
111
+ /**
112
+ * Optional. Whether `resource` belongs to project `projectId` in the
113
+ * principal's tenant: its `parent` is that project (an agent, a flow, a
114
+ * run, …), or its `scope` is (a secret, an env). The API layer asks it
115
+ * to hold an API key limited to a project to that project's resources.
116
+ * Without it, such a key reaches only the project itself.
117
+ */
118
+ inProject?(
119
+ principal: Principal,
120
+ resource: ResourceRef,
121
+ projectId: string,
122
+ ctx?: AuthzCheckContext,
123
+ ): Promise<boolean>;
96
124
  }