@janssenproject/cedarling_wasm 0.0.369 → 0.0.370

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
@@ -104,8 +104,11 @@ export class Cedarling {
104
104
  */
105
105
  static new_from_map(config: Map<any, any>): Promise<Cedarling>;
106
106
  /**
107
- * Authorize request for unsigned principals.
108
- * makes authorization decision based on the [`RequestUnsigned`]
107
+ * Authorize an unsigned request carrying an optional single principal.
108
+ * Makes an authorization decision based on the [`RequestUnsigned`].
109
+ * When `principal` is omitted / `null` the core uses Cedar partial evaluation;
110
+ * residual-dependent requests fail closed with `Decision::Deny` and surface
111
+ * residual policy ids in `response.diagnostics.reason`.
109
112
  */
110
113
  authorize_unsigned(request: any): Promise<AuthorizeResult>;
111
114
  /**
@@ -261,13 +264,9 @@ export class AuthorizeResult {
261
264
  */
262
265
  json_string(): string;
263
266
  /**
264
- * Get authorization responses for all principals
267
+ * Cedar authorization response for the request.
265
268
  */
266
- principals: Record<string, AuthorizeResultResponse>;
267
- /**
268
- * Get result for a specific principal
269
- */
270
- principal(principal: string): AuthorizeResultResponse | undefined;
269
+ response: AuthorizeResultResponse;
271
270
  /**
272
271
  * Result of authorization
273
272
  * true means `ALLOW`
@@ -20,7 +20,6 @@ export class AuthorizeResult {
20
20
  * Convert `AuthorizeResult` to json string value
21
21
  */
22
22
  json_string(): string;
23
- principal(principal: string): AuthorizeResultResponse | undefined;
24
23
  /**
25
24
  * Result of authorization
26
25
  * true means `ALLOW`
@@ -33,6 +32,10 @@ export class AuthorizeResult {
33
32
  * Request ID of the authorization request
34
33
  */
35
34
  request_id: string;
35
+ /**
36
+ * Cedar authorization response for the request.
37
+ */
38
+ response: AuthorizeResultResponse;
36
39
  }
37
40
 
38
41
  /**
@@ -66,8 +69,13 @@ export class Cedarling {
66
69
  */
67
70
  authorize_multi_issuer(request: any): Promise<MultiIssuerAuthorizeResult>;
68
71
  /**
69
- * Authorize request for unsigned principals.
70
- * makes authorization decision based on the [`RequestUnsigned`]
72
+ * Authorize an unsigned request carrying an optional single principal.
73
+ * Makes an authorization decision based on the [`RequestUnsigned`].
74
+ *
75
+ * When `principal` is omitted / `null` on the JS side the core uses Cedar
76
+ * partial evaluation; residual-dependent requests fail closed with
77
+ * `Decision::Deny` and surface residual policy ids in
78
+ * `response.diagnostics.reason`.
71
79
  */
72
80
  authorize_unsigned(request: any): Promise<AuthorizeResult>;
73
81
  /**
@@ -522,13 +530,7 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
522
530
  export interface InitOutput {
523
531
  readonly memory: WebAssembly.Memory;
524
532
  readonly __wbg_cedarling_free: (a: number, b: number) => void;
525
- readonly __wbg_multiissuerauthorizeresult_free: (a: number, b: number) => void;
526
- readonly __wbg_get_multiissuerauthorizeresult_response: (a: number) => number;
527
- readonly __wbg_set_multiissuerauthorizeresult_response: (a: number, b: number) => void;
528
- readonly __wbg_get_multiissuerauthorizeresult_decision: (a: number) => number;
529
- readonly __wbg_set_multiissuerauthorizeresult_decision: (a: number, b: number) => void;
530
533
  readonly __wbg_get_multiissuerauthorizeresult_request_id: (a: number) => [number, number];
531
- readonly __wbg_set_multiissuerauthorizeresult_request_id: (a: number, b: number, c: number) => void;
532
534
  readonly multiissuerauthorizeresult_json_string: (a: number) => [number, number];
533
535
  readonly init: (a: any) => any;
534
536
  readonly init_from_archive_bytes: (a: any, b: any) => any;
@@ -557,12 +559,13 @@ export interface InitOutput {
557
559
  readonly cedarling_loaded_trusted_issuer_ids: (a: number) => any;
558
560
  readonly cedarling_failed_trusted_issuer_ids: (a: number) => any;
559
561
  readonly __wbg_authorizeresult_free: (a: number, b: number) => void;
562
+ readonly __wbg_get_authorizeresult_response: (a: number) => number;
563
+ readonly __wbg_set_authorizeresult_response: (a: number, b: number) => void;
560
564
  readonly __wbg_get_authorizeresult_decision: (a: number) => number;
561
565
  readonly __wbg_set_authorizeresult_decision: (a: number, b: number) => void;
562
566
  readonly __wbg_get_authorizeresult_request_id: (a: number) => [number, number];
563
567
  readonly __wbg_set_authorizeresult_request_id: (a: number, b: number, c: number) => void;
564
568
  readonly authorizeresult_json_string: (a: number) => [number, number];
565
- readonly authorizeresult_principal: (a: number, b: number, c: number) => number;
566
569
  readonly __wbg_authorizeresultresponse_free: (a: number, b: number) => void;
567
570
  readonly authorizeresultresponse_decision: (a: number) => number;
568
571
  readonly authorizeresultresponse_diagnostics: (a: number) => number;
@@ -605,6 +608,12 @@ export interface InitOutput {
605
608
  readonly __wbg_get_datastorestats_memory_alert_triggered: (a: number) => number;
606
609
  readonly __wbg_set_datastorestats_memory_alert_triggered: (a: number, b: number) => void;
607
610
  readonly datastorestats_json_string: (a: number) => [number, number];
611
+ readonly __wbg_set_multiissuerauthorizeresult_request_id: (a: number, b: number, c: number) => void;
612
+ readonly __wbg_get_multiissuerauthorizeresult_decision: (a: number) => number;
613
+ readonly __wbg_get_multiissuerauthorizeresult_response: (a: number) => number;
614
+ readonly __wbg_set_multiissuerauthorizeresult_decision: (a: number, b: number) => void;
615
+ readonly __wbg_set_multiissuerauthorizeresult_response: (a: number, b: number) => void;
616
+ readonly __wbg_multiissuerauthorizeresult_free: (a: number, b: number) => void;
608
617
  readonly __wbg_intounderlyingbytesource_free: (a: number, b: number) => void;
609
618
  readonly intounderlyingbytesource_type: (a: number) => number;
610
619
  readonly intounderlyingbytesource_autoAllocateChunkSize: (a: number) => number;
@@ -629,7 +638,7 @@ export interface InitOutput {
629
638
  readonly wasm_bindgen__convert__closures_____invoke__h10797b50422db1d9: (a: number, b: number, c: any) => [number, number];
630
639
  readonly wasm_bindgen__convert__closures_____invoke__h034cae6b5dd12778: (a: number, b: number, c: any, d: any) => void;
631
640
  readonly wasm_bindgen__convert__closures_____invoke__hc1f7fa9b168b3277: (a: number, b: number, c: any) => void;
632
- readonly wasm_bindgen__convert__closures_____invoke__h0cd1ac4ce5b742bb: (a: number, b: number) => void;
641
+ readonly wasm_bindgen__convert__closures_____invoke__h6f3d4b30895d4f66: (a: number, b: number) => void;
633
642
  readonly wasm_bindgen__convert__closures_____invoke__h1de102d8396d84e7: (a: number, b: number) => void;
634
643
  readonly __wbindgen_malloc: (a: number, b: number) => number;
635
644
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
package/cedarling_wasm.js CHANGED
@@ -38,16 +38,6 @@ export class AuthorizeResult {
38
38
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
39
39
  }
40
40
  }
41
- /**
42
- * @param {string} principal
43
- * @returns {AuthorizeResultResponse | undefined}
44
- */
45
- principal(principal) {
46
- const ptr0 = passStringToWasm0(principal, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
47
- const len0 = WASM_VECTOR_LEN;
48
- const ret = wasm.authorizeresult_principal(this.__wbg_ptr, ptr0, len0);
49
- return ret === 0 ? undefined : AuthorizeResultResponse.__wrap(ret);
50
- }
51
41
  /**
52
42
  * Result of authorization
53
43
  * true means `ALLOW`
@@ -76,6 +66,14 @@ export class AuthorizeResult {
76
66
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
77
67
  }
78
68
  }
69
+ /**
70
+ * Cedar authorization response for the request.
71
+ * @returns {AuthorizeResultResponse}
72
+ */
73
+ get response() {
74
+ const ret = wasm.__wbg_get_authorizeresult_response(this.__wbg_ptr);
75
+ return AuthorizeResultResponse.__wrap(ret);
76
+ }
79
77
  /**
80
78
  * Result of authorization
81
79
  * true means `ALLOW`
@@ -96,6 +94,15 @@ export class AuthorizeResult {
96
94
  const len0 = WASM_VECTOR_LEN;
97
95
  wasm.__wbg_set_authorizeresult_request_id(this.__wbg_ptr, ptr0, len0);
98
96
  }
97
+ /**
98
+ * Cedar authorization response for the request.
99
+ * @param {AuthorizeResultResponse} arg0
100
+ */
101
+ set response(arg0) {
102
+ _assertClass(arg0, AuthorizeResultResponse);
103
+ var ptr0 = arg0.__destroy_into_raw();
104
+ wasm.__wbg_set_authorizeresult_response(this.__wbg_ptr, ptr0);
105
+ }
99
106
  }
100
107
  if (Symbol.dispose) AuthorizeResult.prototype[Symbol.dispose] = AuthorizeResult.prototype.free;
101
108
 
@@ -172,8 +179,13 @@ export class Cedarling {
172
179
  return ret;
173
180
  }
174
181
  /**
175
- * Authorize request for unsigned principals.
176
- * makes authorization decision based on the [`RequestUnsigned`]
182
+ * Authorize an unsigned request carrying an optional single principal.
183
+ * Makes an authorization decision based on the [`RequestUnsigned`].
184
+ *
185
+ * When `principal` is omitted / `null` on the JS side the core uses Cedar
186
+ * partial evaluation; residual-dependent requests fail closed with
187
+ * `Decision::Deny` and surface residual policy ids in
188
+ * `response.diagnostics.reason`.
177
189
  * @param {any} request
178
190
  * @returns {Promise<AuthorizeResult>}
179
191
  */
@@ -1877,22 +1889,22 @@ function __wbg_get_imports() {
1877
1889
  console.warn(...arg0);
1878
1890
  },
1879
1891
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
1880
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 2231, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1892
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 2202, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1881
1893
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h10797b50422db1d9);
1882
1894
  return ret;
1883
1895
  },
1884
1896
  __wbindgen_cast_0000000000000002: function(arg0, arg1) {
1885
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 656, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1897
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 631, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1886
1898
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hc1f7fa9b168b3277);
1887
1899
  return ret;
1888
1900
  },
1889
1901
  __wbindgen_cast_0000000000000003: function(arg0, arg1) {
1890
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 611, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1891
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h0cd1ac4ce5b742bb);
1902
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 587, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1903
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h6f3d4b30895d4f66);
1892
1904
  return ret;
1893
1905
  },
1894
1906
  __wbindgen_cast_0000000000000004: function(arg0, arg1) {
1895
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 772, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1907
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 748, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1896
1908
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h1de102d8396d84e7);
1897
1909
  return ret;
1898
1910
  },
@@ -1937,8 +1949,8 @@ function __wbg_get_imports() {
1937
1949
  };
1938
1950
  }
1939
1951
 
1940
- function wasm_bindgen__convert__closures_____invoke__h0cd1ac4ce5b742bb(arg0, arg1) {
1941
- wasm.wasm_bindgen__convert__closures_____invoke__h0cd1ac4ce5b742bb(arg0, arg1);
1952
+ function wasm_bindgen__convert__closures_____invoke__h6f3d4b30895d4f66(arg0, arg1) {
1953
+ wasm.wasm_bindgen__convert__closures_____invoke__h6f3d4b30895d4f66(arg0, arg1);
1942
1954
  }
1943
1955
 
1944
1956
  function wasm_bindgen__convert__closures_____invoke__h1de102d8396d84e7(arg0, arg1) {
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.369",
5
+ "version": "0.0.370",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
8
8
  "type": "git",