@janssenproject/cedarling_wasm 0.0.275-nodejs → 0.0.276-nodejs

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
  * =====================
package/cedarling_wasm.js CHANGED
@@ -207,6 +207,12 @@ function makeMutClosure(arg0, arg1, dtor, f) {
207
207
  CLOSURE_DTORS.register(real, state, state);
208
208
  return real;
209
209
  }
210
+
211
+ function _assertClass(instance, klass) {
212
+ if (!(instance instanceof klass)) {
213
+ throw new Error(`expected instance of ${klass.name}`);
214
+ }
215
+ }
210
216
  /**
211
217
  * Create a new instance of the Cedarling application.
212
218
  * This function can take as config parameter the eather `Map` other `Object`
@@ -234,20 +240,14 @@ function getArrayJsValueFromWasm0(ptr, len) {
234
240
  wasm.__externref_drop_slice(ptr, len);
235
241
  return result;
236
242
  }
237
-
238
- function _assertClass(instance, klass) {
239
- if (!(instance instanceof klass)) {
240
- throw new Error(`expected instance of ${klass.name}`);
241
- }
243
+ function wasm_bindgen__convert__closures_____invoke__hb85a0d6bfa2beadc(arg0, arg1) {
244
+ wasm.wasm_bindgen__convert__closures_____invoke__hb85a0d6bfa2beadc(arg0, arg1);
242
245
  }
246
+
243
247
  function wasm_bindgen__convert__closures_____invoke__h1c715d53d5a00020(arg0, arg1, arg2) {
244
248
  wasm.wasm_bindgen__convert__closures_____invoke__h1c715d53d5a00020(arg0, arg1, arg2);
245
249
  }
246
250
 
247
- function wasm_bindgen__convert__closures_____invoke__hf8ac7184f86fbcce(arg0, arg1) {
248
- wasm.wasm_bindgen__convert__closures_____invoke__hf8ac7184f86fbcce(arg0, arg1);
249
- }
250
-
251
251
  function wasm_bindgen__convert__closures_____invoke__h4b59ba169ea05287(arg0, arg1, arg2, arg3) {
252
252
  wasm.wasm_bindgen__convert__closures_____invoke__h4b59ba169ea05287(arg0, arg1, arg2, arg3);
253
253
  }
@@ -521,6 +521,16 @@ class Cedarling {
521
521
  const ret = wasm.cedarling_authorize_unsigned(this.__wbg_ptr, request);
522
522
  return ret;
523
523
  }
524
+ /**
525
+ * Authorize multi-issuer request.
526
+ * Makes authorization decision based on multiple JWT tokens from different issuers
527
+ * @param {any} request
528
+ * @returns {Promise<MultiIssuerAuthorizeResult>}
529
+ */
530
+ authorize_multi_issuer(request) {
531
+ const ret = wasm.cedarling_authorize_multi_issuer(this.__wbg_ptr, request);
532
+ return ret;
533
+ }
524
534
  /**
525
535
  * Get logs and remove them from the storage.
526
536
  * Returns `Array` of `Map`
@@ -724,6 +734,116 @@ if (Symbol.dispose) JsJsonLogic.prototype[Symbol.dispose] = JsJsonLogic.prototyp
724
734
 
725
735
  exports.JsJsonLogic = JsJsonLogic;
726
736
 
737
+ const MultiIssuerAuthorizeResultFinalization = (typeof FinalizationRegistry === 'undefined')
738
+ ? { register: () => {}, unregister: () => {} }
739
+ : new FinalizationRegistry(ptr => wasm.__wbg_multiissuerauthorizeresult_free(ptr >>> 0, 1));
740
+ /**
741
+ * A WASM wrapper for the Rust `cedarling::MultiIssuerAuthorizeResult` struct.
742
+ * Represents the result of a multi-issuer authorization request.
743
+ */
744
+ class MultiIssuerAuthorizeResult {
745
+
746
+ static __wrap(ptr) {
747
+ ptr = ptr >>> 0;
748
+ const obj = Object.create(MultiIssuerAuthorizeResult.prototype);
749
+ obj.__wbg_ptr = ptr;
750
+ MultiIssuerAuthorizeResultFinalization.register(obj, obj.__wbg_ptr, obj);
751
+ return obj;
752
+ }
753
+
754
+ __destroy_into_raw() {
755
+ const ptr = this.__wbg_ptr;
756
+ this.__wbg_ptr = 0;
757
+ MultiIssuerAuthorizeResultFinalization.unregister(this);
758
+ return ptr;
759
+ }
760
+
761
+ free() {
762
+ const ptr = this.__destroy_into_raw();
763
+ wasm.__wbg_multiissuerauthorizeresult_free(ptr, 0);
764
+ }
765
+ /**
766
+ * Result of Cedar policy authorization
767
+ * @returns {AuthorizeResultResponse}
768
+ */
769
+ get response() {
770
+ const ret = wasm.__wbg_get_multiissuerauthorizeresult_response(this.__wbg_ptr);
771
+ return AuthorizeResultResponse.__wrap(ret);
772
+ }
773
+ /**
774
+ * Result of Cedar policy authorization
775
+ * @param {AuthorizeResultResponse} arg0
776
+ */
777
+ set response(arg0) {
778
+ _assertClass(arg0, AuthorizeResultResponse);
779
+ var ptr0 = arg0.__destroy_into_raw();
780
+ wasm.__wbg_set_multiissuerauthorizeresult_response(this.__wbg_ptr, ptr0);
781
+ }
782
+ /**
783
+ * Result of authorization
784
+ * true means `ALLOW`
785
+ * false means `Deny`
786
+ * @returns {boolean}
787
+ */
788
+ get decision() {
789
+ const ret = wasm.__wbg_get_multiissuerauthorizeresult_decision(this.__wbg_ptr);
790
+ return ret !== 0;
791
+ }
792
+ /**
793
+ * Result of authorization
794
+ * true means `ALLOW`
795
+ * false means `Deny`
796
+ * @param {boolean} arg0
797
+ */
798
+ set decision(arg0) {
799
+ wasm.__wbg_set_multiissuerauthorizeresult_decision(this.__wbg_ptr, arg0);
800
+ }
801
+ /**
802
+ * Request ID of the authorization request
803
+ * @returns {string}
804
+ */
805
+ get request_id() {
806
+ let deferred1_0;
807
+ let deferred1_1;
808
+ try {
809
+ const ret = wasm.__wbg_get_multiissuerauthorizeresult_request_id(this.__wbg_ptr);
810
+ deferred1_0 = ret[0];
811
+ deferred1_1 = ret[1];
812
+ return getStringFromWasm0(ret[0], ret[1]);
813
+ } finally {
814
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
815
+ }
816
+ }
817
+ /**
818
+ * Request ID of the authorization request
819
+ * @param {string} arg0
820
+ */
821
+ set request_id(arg0) {
822
+ const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
823
+ const len0 = WASM_VECTOR_LEN;
824
+ wasm.__wbg_set_multiissuerauthorizeresult_request_id(this.__wbg_ptr, ptr0, len0);
825
+ }
826
+ /**
827
+ * Convert `MultiIssuerAuthorizeResult` to json string value
828
+ * @returns {string}
829
+ */
830
+ json_string() {
831
+ let deferred1_0;
832
+ let deferred1_1;
833
+ try {
834
+ const ret = wasm.multiissuerauthorizeresult_json_string(this.__wbg_ptr);
835
+ deferred1_0 = ret[0];
836
+ deferred1_1 = ret[1];
837
+ return getStringFromWasm0(ret[0], ret[1]);
838
+ } finally {
839
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
840
+ }
841
+ }
842
+ }
843
+ if (Symbol.dispose) MultiIssuerAuthorizeResult.prototype[Symbol.dispose] = MultiIssuerAuthorizeResult.prototype.free;
844
+
845
+ exports.MultiIssuerAuthorizeResult = MultiIssuerAuthorizeResult;
846
+
727
847
  const PolicyEvaluationErrorFinalization = (typeof FinalizationRegistry === 'undefined')
728
848
  ? { register: () => {}, unregister: () => {} }
729
849
  : new FinalizationRegistry(ptr => wasm.__wbg_policyevaluationerror_free(ptr >>> 0, 1));
@@ -1121,6 +1241,11 @@ exports.__wbg_msCrypto_a61aeb35a24c1329 = function(arg0) {
1121
1241
  return ret;
1122
1242
  };
1123
1243
 
1244
+ exports.__wbg_multiissuerauthorizeresult_new = function(arg0) {
1245
+ const ret = MultiIssuerAuthorizeResult.__wrap(arg0);
1246
+ return ret;
1247
+ };
1248
+
1124
1249
  exports.__wbg_new_0_f9740686d739025c = function() {
1125
1250
  const ret = new Date();
1126
1251
  return ret;
@@ -1400,18 +1525,18 @@ exports.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
1400
1525
  return ret;
1401
1526
  };
1402
1527
 
1403
- exports.__wbindgen_cast_2fb66661e8d075cf = function(arg0, arg1) {
1404
- // Cast intrinsic for `Closure(Closure { dtor_idx: 553, function: Function { arguments: [Externref], shim_idx: 554, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1405
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h8bb11a3ec59bf31f, wasm_bindgen__convert__closures_____invoke__h1c715d53d5a00020);
1406
- return ret;
1407
- };
1408
-
1409
1528
  exports.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) {
1410
1529
  // Cast intrinsic for `U64 -> Externref`.
1411
1530
  const ret = BigInt.asUintN(64, arg0);
1412
1531
  return ret;
1413
1532
  };
1414
1533
 
1534
+ exports.__wbindgen_cast_7476ec76802be9a6 = function(arg0, arg1) {
1535
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 520, function: Function { arguments: [], shim_idx: 521, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1536
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h412f0562fcad9c84, wasm_bindgen__convert__closures_____invoke__hb85a0d6bfa2beadc);
1537
+ return ret;
1538
+ };
1539
+
1415
1540
  exports.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
1416
1541
  // Cast intrinsic for `I64 -> Externref`.
1417
1542
  const ret = arg0;
@@ -1424,15 +1549,15 @@ exports.__wbindgen_cast_cb9088102bce6b30 = function(arg0, arg1) {
1424
1549
  return ret;
1425
1550
  };
1426
1551
 
1427
- exports.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
1428
- // Cast intrinsic for `F64 -> Externref`.
1429
- const ret = arg0;
1552
+ exports.__wbindgen_cast_d13a751f153ef52c = function(arg0, arg1) {
1553
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 565, function: Function { arguments: [Externref], shim_idx: 566, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1554
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h8bb11a3ec59bf31f, wasm_bindgen__convert__closures_____invoke__h1c715d53d5a00020);
1430
1555
  return ret;
1431
1556
  };
1432
1557
 
1433
- exports.__wbindgen_cast_f0904d98c773eedb = function(arg0, arg1) {
1434
- // Cast intrinsic for `Closure(Closure { dtor_idx: 508, function: Function { arguments: [], shim_idx: 509, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1435
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__ha0787d3d14449f11, wasm_bindgen__convert__closures_____invoke__hf8ac7184f86fbcce);
1558
+ exports.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
1559
+ // Cast intrinsic for `F64 -> Externref`.
1560
+ const ret = arg0;
1436
1561
  return ret;
1437
1562
  };
1438
1563
 
Binary file
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@janssenproject/cedarling_wasm",
3
3
  "description": "The Cedarling is a performant local authorization service that runs the Rust Cedar Engine",
4
- "version": "0.0.275-nodejs",
4
+ "version": "0.0.276-nodejs",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
7
7
  "type": "git",