@janssenproject/cedarling_wasm 0.0.275 → 0.0.276

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/README.md CHANGED
@@ -89,6 +89,16 @@ export class Cedarling {
89
89
  * makes authorization decision based on the [`Request`]
90
90
  */
91
91
  authorize(request: any): Promise<AuthorizeResult>;
92
+ /**
93
+ * Authorize request for unsigned principals.
94
+ * makes authorization decision based on the [`RequestUnsigned`]
95
+ */
96
+ authorize_unsigned(request: any): Promise<AuthorizeResult>;
97
+ /**
98
+ * Authorize multi-issuer request.
99
+ * Makes authorization decision based on multiple JWT tokens from different issuers
100
+ */
101
+ authorize_multi_issuer(request: any): Promise<MultiIssuerAuthorizeResult>;
92
102
  /**
93
103
  * Get logs and remove them from the storage.
94
104
  * Returns `Array` of `Map`
@@ -139,6 +149,10 @@ export class AuthorizeResult {
139
149
  * Result of authorization where principal is `Jans::User`
140
150
  */
141
151
  person?: AuthorizeResultResponse;
152
+ /**
153
+ * Get result for a specific principal
154
+ */
155
+ principal(principal: string): AuthorizeResultResponse | undefined;
142
156
  /**
143
157
  * Result of authorization
144
158
  * true means `ALLOW`
@@ -153,6 +167,31 @@ export class AuthorizeResult {
153
167
  request_id: string;
154
168
  }
155
169
 
170
+ /**
171
+ * A WASM wrapper for the Rust `cedarling::MultiIssuerAuthorizeResult` struct.
172
+ * Represents the result of a multi-issuer authorization request.
173
+ */
174
+ export class MultiIssuerAuthorizeResult {
175
+ /**
176
+ * Convert `MultiIssuerAuthorizeResult` to json string value
177
+ */
178
+ json_string(): string;
179
+ /**
180
+ * Result of Cedar policy authorization
181
+ */
182
+ response: AuthorizeResultResponse;
183
+ /**
184
+ * Result of authorization
185
+ * true means `ALLOW`
186
+ * false means `Deny`
187
+ */
188
+ decision: boolean;
189
+ /**
190
+ * Request ID of the authorization request
191
+ */
192
+ request_id: string;
193
+ }
194
+
156
195
  /**
157
196
  * A WASM wrapper for the Rust `cedar_policy::Response` struct.
158
197
  * Represents the result of an authorization request.
@@ -91,6 +91,11 @@ export class Cedarling {
91
91
  * makes authorization decision based on the [`RequestUnsigned`]
92
92
  */
93
93
  authorize_unsigned(request: any): Promise<AuthorizeResult>;
94
+ /**
95
+ * Authorize multi-issuer request.
96
+ * Makes authorization decision based on multiple JWT tokens from different issuers
97
+ */
98
+ authorize_multi_issuer(request: any): Promise<MultiIssuerAuthorizeResult>;
94
99
  /**
95
100
  * Get logs and remove them from the storage.
96
101
  * Returns `Array` of `Map`
@@ -156,6 +161,33 @@ export class JsJsonLogic {
156
161
  constructor();
157
162
  apply(logic: any, data: any): any;
158
163
  }
164
+ /**
165
+ * A WASM wrapper for the Rust `cedarling::MultiIssuerAuthorizeResult` struct.
166
+ * Represents the result of a multi-issuer authorization request.
167
+ */
168
+ export class MultiIssuerAuthorizeResult {
169
+ private constructor();
170
+ free(): void;
171
+ [Symbol.dispose](): void;
172
+ /**
173
+ * Convert `MultiIssuerAuthorizeResult` to json string value
174
+ */
175
+ json_string(): string;
176
+ /**
177
+ * Result of Cedar policy authorization
178
+ */
179
+ response: AuthorizeResultResponse;
180
+ /**
181
+ * Result of authorization
182
+ * true means `ALLOW`
183
+ * false means `Deny`
184
+ */
185
+ decision: boolean;
186
+ /**
187
+ * Request ID of the authorization request
188
+ */
189
+ request_id: string;
190
+ }
159
191
  /**
160
192
  * PolicyEvaluationError
161
193
  * =====================
@@ -181,11 +213,20 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
181
213
  export interface InitOutput {
182
214
  readonly memory: WebAssembly.Memory;
183
215
  readonly __wbg_cedarling_free: (a: number, b: number) => void;
216
+ readonly __wbg_multiissuerauthorizeresult_free: (a: number, b: number) => void;
217
+ readonly __wbg_get_multiissuerauthorizeresult_response: (a: number) => number;
218
+ readonly __wbg_set_multiissuerauthorizeresult_response: (a: number, b: number) => void;
219
+ readonly __wbg_get_multiissuerauthorizeresult_decision: (a: number) => number;
220
+ readonly __wbg_set_multiissuerauthorizeresult_decision: (a: number, b: number) => void;
221
+ readonly __wbg_get_multiissuerauthorizeresult_request_id: (a: number) => [number, number];
222
+ readonly __wbg_set_multiissuerauthorizeresult_request_id: (a: number, b: number, c: number) => void;
223
+ readonly multiissuerauthorizeresult_json_string: (a: number) => [number, number];
184
224
  readonly init: (a: any) => any;
185
225
  readonly cedarling_new: (a: any) => any;
186
226
  readonly cedarling_new_from_map: (a: any) => any;
187
227
  readonly cedarling_authorize: (a: number, b: any) => any;
188
228
  readonly cedarling_authorize_unsigned: (a: number, b: any) => any;
229
+ readonly cedarling_authorize_multi_issuer: (a: number, b: any) => any;
189
230
  readonly cedarling_pop_logs: (a: number) => [number, number, number];
190
231
  readonly cedarling_get_log_by_id: (a: number, b: number, c: number) => [number, number, number];
191
232
  readonly cedarling_get_log_ids: (a: number) => any;
@@ -217,19 +258,19 @@ export interface InitOutput {
217
258
  readonly jsjsonlogic_new: () => number;
218
259
  readonly jsjsonlogic_apply: (a: number, b: any, c: any) => [number, number, number];
219
260
  readonly ring_core_0_17_14__bn_mul_mont: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
261
+ readonly wasm_bindgen__convert__closures_____invoke__hb85a0d6bfa2beadc: (a: number, b: number) => void;
262
+ readonly wasm_bindgen__closure__destroy__h412f0562fcad9c84: (a: number, b: number) => void;
220
263
  readonly wasm_bindgen__convert__closures_____invoke__h1c715d53d5a00020: (a: number, b: number, c: any) => void;
221
264
  readonly wasm_bindgen__closure__destroy__h8bb11a3ec59bf31f: (a: number, b: number) => void;
222
- readonly wasm_bindgen__convert__closures_____invoke__hf8ac7184f86fbcce: (a: number, b: number) => void;
223
- readonly wasm_bindgen__closure__destroy__ha0787d3d14449f11: (a: number, b: number) => void;
224
265
  readonly wasm_bindgen__convert__closures_____invoke__h4b59ba169ea05287: (a: number, b: number, c: any, d: any) => void;
225
266
  readonly __wbindgen_malloc: (a: number, b: number) => number;
226
267
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
227
268
  readonly __wbindgen_exn_store: (a: number) => void;
228
269
  readonly __externref_table_alloc: () => number;
229
270
  readonly __wbindgen_externrefs: WebAssembly.Table;
271
+ readonly __wbindgen_free: (a: number, b: number, c: number) => void;
230
272
  readonly __externref_table_dealloc: (a: number) => void;
231
273
  readonly __externref_drop_slice: (a: number, b: number) => void;
232
- readonly __wbindgen_free: (a: number, b: number, c: number) => void;
233
274
  readonly __wbindgen_start: () => void;
234
275
  }
235
276
 
package/cedarling_wasm.js CHANGED
@@ -213,6 +213,12 @@ function makeMutClosure(arg0, arg1, dtor, f) {
213
213
  CLOSURE_DTORS.register(real, state, state);
214
214
  return real;
215
215
  }
216
+
217
+ function _assertClass(instance, klass) {
218
+ if (!(instance instanceof klass)) {
219
+ throw new Error(`expected instance of ${klass.name}`);
220
+ }
221
+ }
216
222
  /**
217
223
  * Create a new instance of the Cedarling application.
218
224
  * This function can take as config parameter the eather `Map` other `Object`
@@ -240,20 +246,14 @@ function getArrayJsValueFromWasm0(ptr, len) {
240
246
  wasm.__externref_drop_slice(ptr, len);
241
247
  return result;
242
248
  }
243
-
244
- function _assertClass(instance, klass) {
245
- if (!(instance instanceof klass)) {
246
- throw new Error(`expected instance of ${klass.name}`);
247
- }
249
+ function wasm_bindgen__convert__closures_____invoke__hb85a0d6bfa2beadc(arg0, arg1) {
250
+ wasm.wasm_bindgen__convert__closures_____invoke__hb85a0d6bfa2beadc(arg0, arg1);
248
251
  }
252
+
249
253
  function wasm_bindgen__convert__closures_____invoke__h1c715d53d5a00020(arg0, arg1, arg2) {
250
254
  wasm.wasm_bindgen__convert__closures_____invoke__h1c715d53d5a00020(arg0, arg1, arg2);
251
255
  }
252
256
 
253
- function wasm_bindgen__convert__closures_____invoke__hf8ac7184f86fbcce(arg0, arg1) {
254
- wasm.wasm_bindgen__convert__closures_____invoke__hf8ac7184f86fbcce(arg0, arg1);
255
- }
256
-
257
257
  function wasm_bindgen__convert__closures_____invoke__h4b59ba169ea05287(arg0, arg1, arg2, arg3) {
258
258
  wasm.wasm_bindgen__convert__closures_____invoke__h4b59ba169ea05287(arg0, arg1, arg2, arg3);
259
259
  }
@@ -523,6 +523,16 @@ export class Cedarling {
523
523
  const ret = wasm.cedarling_authorize_unsigned(this.__wbg_ptr, request);
524
524
  return ret;
525
525
  }
526
+ /**
527
+ * Authorize multi-issuer request.
528
+ * Makes authorization decision based on multiple JWT tokens from different issuers
529
+ * @param {any} request
530
+ * @returns {Promise<MultiIssuerAuthorizeResult>}
531
+ */
532
+ authorize_multi_issuer(request) {
533
+ const ret = wasm.cedarling_authorize_multi_issuer(this.__wbg_ptr, request);
534
+ return ret;
535
+ }
526
536
  /**
527
537
  * Get logs and remove them from the storage.
528
538
  * Returns `Array` of `Map`
@@ -720,6 +730,114 @@ export class JsJsonLogic {
720
730
  }
721
731
  if (Symbol.dispose) JsJsonLogic.prototype[Symbol.dispose] = JsJsonLogic.prototype.free;
722
732
 
733
+ const MultiIssuerAuthorizeResultFinalization = (typeof FinalizationRegistry === 'undefined')
734
+ ? { register: () => {}, unregister: () => {} }
735
+ : new FinalizationRegistry(ptr => wasm.__wbg_multiissuerauthorizeresult_free(ptr >>> 0, 1));
736
+ /**
737
+ * A WASM wrapper for the Rust `cedarling::MultiIssuerAuthorizeResult` struct.
738
+ * Represents the result of a multi-issuer authorization request.
739
+ */
740
+ export class MultiIssuerAuthorizeResult {
741
+
742
+ static __wrap(ptr) {
743
+ ptr = ptr >>> 0;
744
+ const obj = Object.create(MultiIssuerAuthorizeResult.prototype);
745
+ obj.__wbg_ptr = ptr;
746
+ MultiIssuerAuthorizeResultFinalization.register(obj, obj.__wbg_ptr, obj);
747
+ return obj;
748
+ }
749
+
750
+ __destroy_into_raw() {
751
+ const ptr = this.__wbg_ptr;
752
+ this.__wbg_ptr = 0;
753
+ MultiIssuerAuthorizeResultFinalization.unregister(this);
754
+ return ptr;
755
+ }
756
+
757
+ free() {
758
+ const ptr = this.__destroy_into_raw();
759
+ wasm.__wbg_multiissuerauthorizeresult_free(ptr, 0);
760
+ }
761
+ /**
762
+ * Result of Cedar policy authorization
763
+ * @returns {AuthorizeResultResponse}
764
+ */
765
+ get response() {
766
+ const ret = wasm.__wbg_get_multiissuerauthorizeresult_response(this.__wbg_ptr);
767
+ return AuthorizeResultResponse.__wrap(ret);
768
+ }
769
+ /**
770
+ * Result of Cedar policy authorization
771
+ * @param {AuthorizeResultResponse} arg0
772
+ */
773
+ set response(arg0) {
774
+ _assertClass(arg0, AuthorizeResultResponse);
775
+ var ptr0 = arg0.__destroy_into_raw();
776
+ wasm.__wbg_set_multiissuerauthorizeresult_response(this.__wbg_ptr, ptr0);
777
+ }
778
+ /**
779
+ * Result of authorization
780
+ * true means `ALLOW`
781
+ * false means `Deny`
782
+ * @returns {boolean}
783
+ */
784
+ get decision() {
785
+ const ret = wasm.__wbg_get_multiissuerauthorizeresult_decision(this.__wbg_ptr);
786
+ return ret !== 0;
787
+ }
788
+ /**
789
+ * Result of authorization
790
+ * true means `ALLOW`
791
+ * false means `Deny`
792
+ * @param {boolean} arg0
793
+ */
794
+ set decision(arg0) {
795
+ wasm.__wbg_set_multiissuerauthorizeresult_decision(this.__wbg_ptr, arg0);
796
+ }
797
+ /**
798
+ * Request ID of the authorization request
799
+ * @returns {string}
800
+ */
801
+ get request_id() {
802
+ let deferred1_0;
803
+ let deferred1_1;
804
+ try {
805
+ const ret = wasm.__wbg_get_multiissuerauthorizeresult_request_id(this.__wbg_ptr);
806
+ deferred1_0 = ret[0];
807
+ deferred1_1 = ret[1];
808
+ return getStringFromWasm0(ret[0], ret[1]);
809
+ } finally {
810
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
811
+ }
812
+ }
813
+ /**
814
+ * Request ID of the authorization request
815
+ * @param {string} arg0
816
+ */
817
+ set request_id(arg0) {
818
+ const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
819
+ const len0 = WASM_VECTOR_LEN;
820
+ wasm.__wbg_set_multiissuerauthorizeresult_request_id(this.__wbg_ptr, ptr0, len0);
821
+ }
822
+ /**
823
+ * Convert `MultiIssuerAuthorizeResult` to json string value
824
+ * @returns {string}
825
+ */
826
+ json_string() {
827
+ let deferred1_0;
828
+ let deferred1_1;
829
+ try {
830
+ const ret = wasm.multiissuerauthorizeresult_json_string(this.__wbg_ptr);
831
+ deferred1_0 = ret[0];
832
+ deferred1_1 = ret[1];
833
+ return getStringFromWasm0(ret[0], ret[1]);
834
+ } finally {
835
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
836
+ }
837
+ }
838
+ }
839
+ if (Symbol.dispose) MultiIssuerAuthorizeResult.prototype[Symbol.dispose] = MultiIssuerAuthorizeResult.prototype.free;
840
+
723
841
  const PolicyEvaluationErrorFinalization = (typeof FinalizationRegistry === 'undefined')
724
842
  ? { register: () => {}, unregister: () => {} }
725
843
  : new FinalizationRegistry(ptr => wasm.__wbg_policyevaluationerror_free(ptr >>> 0, 1));
@@ -1094,6 +1212,10 @@ function __wbg_get_imports() {
1094
1212
  const ret = arg0.msCrypto;
1095
1213
  return ret;
1096
1214
  };
1215
+ imports.wbg.__wbg_multiissuerauthorizeresult_new = function(arg0) {
1216
+ const ret = MultiIssuerAuthorizeResult.__wrap(arg0);
1217
+ return ret;
1218
+ };
1097
1219
  imports.wbg.__wbg_new_0_f9740686d739025c = function() {
1098
1220
  const ret = new Date();
1099
1221
  return ret;
@@ -1318,16 +1440,16 @@ function __wbg_get_imports() {
1318
1440
  const ret = getStringFromWasm0(arg0, arg1);
1319
1441
  return ret;
1320
1442
  };
1321
- imports.wbg.__wbindgen_cast_2fb66661e8d075cf = function(arg0, arg1) {
1322
- // Cast intrinsic for `Closure(Closure { dtor_idx: 553, function: Function { arguments: [Externref], shim_idx: 554, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1323
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h8bb11a3ec59bf31f, wasm_bindgen__convert__closures_____invoke__h1c715d53d5a00020);
1324
- return ret;
1325
- };
1326
1443
  imports.wbg.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) {
1327
1444
  // Cast intrinsic for `U64 -> Externref`.
1328
1445
  const ret = BigInt.asUintN(64, arg0);
1329
1446
  return ret;
1330
1447
  };
1448
+ imports.wbg.__wbindgen_cast_7476ec76802be9a6 = function(arg0, arg1) {
1449
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 520, function: Function { arguments: [], shim_idx: 521, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1450
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h412f0562fcad9c84, wasm_bindgen__convert__closures_____invoke__hb85a0d6bfa2beadc);
1451
+ return ret;
1452
+ };
1331
1453
  imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
1332
1454
  // Cast intrinsic for `I64 -> Externref`.
1333
1455
  const ret = arg0;
@@ -1338,16 +1460,16 @@ function __wbg_get_imports() {
1338
1460
  const ret = getArrayU8FromWasm0(arg0, arg1);
1339
1461
  return ret;
1340
1462
  };
1463
+ imports.wbg.__wbindgen_cast_d13a751f153ef52c = function(arg0, arg1) {
1464
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 565, function: Function { arguments: [Externref], shim_idx: 566, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1465
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h8bb11a3ec59bf31f, wasm_bindgen__convert__closures_____invoke__h1c715d53d5a00020);
1466
+ return ret;
1467
+ };
1341
1468
  imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
1342
1469
  // Cast intrinsic for `F64 -> Externref`.
1343
1470
  const ret = arg0;
1344
1471
  return ret;
1345
1472
  };
1346
- imports.wbg.__wbindgen_cast_f0904d98c773eedb = function(arg0, arg1) {
1347
- // Cast intrinsic for `Closure(Closure { dtor_idx: 508, function: Function { arguments: [], shim_idx: 509, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1348
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__ha0787d3d14449f11, wasm_bindgen__convert__closures_____invoke__hf8ac7184f86fbcce);
1349
- return ret;
1350
- };
1351
1473
  imports.wbg.__wbindgen_init_externref_table = function() {
1352
1474
  const table = wasm.__wbindgen_externrefs;
1353
1475
  const offset = table.grow(4);
Binary file
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@janssenproject/cedarling_wasm",
3
3
  "type": "module",
4
4
  "description": "The Cedarling is a performant local authorization service that runs the Rust Cedar Engine",
5
- "version": "0.0.275",
5
+ "version": "0.0.276",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
8
8
  "type": "git",