@janssenproject/cedarling_wasm 1.14.0 → 1.15.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.
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.
@@ -1,14 +1,6 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- /**
4
- * Create a new instance of the Cedarling application.
5
- * This function can take as config parameter the eather `Map` other `Object`
6
- */
7
- export function init(config: any): Promise<Cedarling>;
8
- /**
9
- * A WASM wrapper for the Rust `cedarling::AuthorizeResult` struct.
10
- * Represents the result of an authorization request.
11
- */
3
+
12
4
  export class AuthorizeResult {
13
5
  private constructor();
14
6
  free(): void;
@@ -47,10 +39,7 @@ export class AuthorizeResult {
47
39
  */
48
40
  request_id: string;
49
41
  }
50
- /**
51
- * A WASM wrapper for the Rust `cedar_policy::Response` struct.
52
- * Represents the result of an authorization request.
53
- */
42
+
54
43
  export class AuthorizeResultResponse {
55
44
  private constructor();
56
45
  free(): void;
@@ -64,9 +53,7 @@ export class AuthorizeResultResponse {
64
53
  */
65
54
  readonly diagnostics: Diagnostics;
66
55
  }
67
- /**
68
- * The instance of the Cedarling application.
69
- */
56
+
70
57
  export class Cedarling {
71
58
  private constructor();
72
59
  free(): void;
@@ -91,6 +78,11 @@ export class Cedarling {
91
78
  * makes authorization decision based on the [`RequestUnsigned`]
92
79
  */
93
80
  authorize_unsigned(request: any): Promise<AuthorizeResult>;
81
+ /**
82
+ * Authorize multi-issuer request.
83
+ * Makes authorization decision based on multiple JWT tokens from different issuers
84
+ */
85
+ authorize_multi_issuer(request: any): Promise<MultiIssuerAuthorizeResult>;
94
86
  /**
95
87
  * Get logs and remove them from the storage.
96
88
  * Returns `Array` of `Map`
@@ -127,12 +119,7 @@ export class Cedarling {
127
119
  */
128
120
  shut_down(): Promise<void>;
129
121
  }
130
- /**
131
- * Diagnostics
132
- * ===========
133
- *
134
- * Provides detailed information about how a policy decision was made, including policies that contributed to the decision and any errors encountered during evaluation.
135
- */
122
+
136
123
  export class Diagnostics {
137
124
  private constructor();
138
125
  free(): void;
@@ -150,18 +137,38 @@ export class Diagnostics {
150
137
  */
151
138
  readonly errors: PolicyEvaluationError[];
152
139
  }
140
+
153
141
  export class JsJsonLogic {
154
142
  free(): void;
155
143
  [Symbol.dispose](): void;
156
144
  constructor();
157
145
  apply(logic: any, data: any): any;
158
146
  }
159
- /**
160
- * PolicyEvaluationError
161
- * =====================
162
- *
163
- * Represents an error that occurred when evaluating a Cedar policy.
164
- */
147
+
148
+ export class MultiIssuerAuthorizeResult {
149
+ private constructor();
150
+ free(): void;
151
+ [Symbol.dispose](): void;
152
+ /**
153
+ * Convert `MultiIssuerAuthorizeResult` to json string value
154
+ */
155
+ json_string(): string;
156
+ /**
157
+ * Result of Cedar policy authorization
158
+ */
159
+ response: AuthorizeResultResponse;
160
+ /**
161
+ * Result of authorization
162
+ * true means `ALLOW`
163
+ * false means `Deny`
164
+ */
165
+ decision: boolean;
166
+ /**
167
+ * Request ID of the authorization request
168
+ */
169
+ request_id: string;
170
+ }
171
+
165
172
  export class PolicyEvaluationError {
166
173
  private constructor();
167
174
  free(): void;
@@ -176,16 +183,31 @@ export class PolicyEvaluationError {
176
183
  readonly error: string;
177
184
  }
178
185
 
186
+ /**
187
+ * Create a new instance of the Cedarling application.
188
+ * This function can take as config parameter the eather `Map` other `Object`
189
+ */
190
+ export function init(config: any): Promise<Cedarling>;
191
+
179
192
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
180
193
 
181
194
  export interface InitOutput {
182
195
  readonly memory: WebAssembly.Memory;
183
196
  readonly __wbg_cedarling_free: (a: number, b: number) => void;
197
+ readonly __wbg_multiissuerauthorizeresult_free: (a: number, b: number) => void;
198
+ readonly __wbg_get_multiissuerauthorizeresult_response: (a: number) => number;
199
+ readonly __wbg_set_multiissuerauthorizeresult_response: (a: number, b: number) => void;
200
+ readonly __wbg_get_multiissuerauthorizeresult_decision: (a: number) => number;
201
+ readonly __wbg_set_multiissuerauthorizeresult_decision: (a: number, b: number) => void;
202
+ readonly __wbg_get_multiissuerauthorizeresult_request_id: (a: number) => [number, number];
203
+ readonly __wbg_set_multiissuerauthorizeresult_request_id: (a: number, b: number, c: number) => void;
204
+ readonly multiissuerauthorizeresult_json_string: (a: number) => [number, number];
184
205
  readonly init: (a: any) => any;
185
206
  readonly cedarling_new: (a: any) => any;
186
207
  readonly cedarling_new_from_map: (a: any) => any;
187
208
  readonly cedarling_authorize: (a: number, b: any) => any;
188
209
  readonly cedarling_authorize_unsigned: (a: number, b: any) => any;
210
+ readonly cedarling_authorize_multi_issuer: (a: number, b: any) => any;
189
211
  readonly cedarling_pop_logs: (a: number) => [number, number, number];
190
212
  readonly cedarling_get_log_by_id: (a: number, b: number, c: number) => [number, number, number];
191
213
  readonly cedarling_get_log_ids: (a: number) => any;
@@ -217,23 +239,24 @@ export interface InitOutput {
217
239
  readonly jsjsonlogic_new: () => number;
218
240
  readonly jsjsonlogic_apply: (a: number, b: any, c: any) => [number, number, number];
219
241
  readonly ring_core_0_17_14__bn_mul_mont: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
220
- readonly wasm_bindgen__convert__closures_____invoke__hf8ac7184f86fbcce: (a: number, b: number) => void;
221
- readonly wasm_bindgen__closure__destroy__ha0787d3d14449f11: (a: number, b: number) => void;
222
- readonly wasm_bindgen__convert__closures_____invoke__h1c715d53d5a00020: (a: number, b: number, c: any) => void;
223
- readonly wasm_bindgen__closure__destroy__h8bb11a3ec59bf31f: (a: number, b: number) => void;
224
- readonly wasm_bindgen__convert__closures_____invoke__h4b59ba169ea05287: (a: number, b: number, c: any, d: any) => void;
242
+ readonly wasm_bindgen__convert__closures_____invoke__h8a10b0fb25c32ce7: (a: number, b: number) => void;
243
+ readonly wasm_bindgen__closure__destroy__h3edd0da2e16650db: (a: number, b: number) => void;
244
+ readonly wasm_bindgen__convert__closures_____invoke__h7f8b71809a8d7577: (a: number, b: number, c: any) => void;
245
+ readonly wasm_bindgen__closure__destroy__h8554173f80599467: (a: number, b: number) => void;
246
+ readonly wasm_bindgen__convert__closures_____invoke__h3a7d0d99d266e2f8: (a: number, b: number, c: any, d: any) => void;
225
247
  readonly __wbindgen_malloc: (a: number, b: number) => number;
226
248
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
227
249
  readonly __wbindgen_exn_store: (a: number) => void;
228
250
  readonly __externref_table_alloc: () => number;
229
251
  readonly __wbindgen_externrefs: WebAssembly.Table;
252
+ readonly __wbindgen_free: (a: number, b: number, c: number) => void;
230
253
  readonly __externref_table_dealloc: (a: number) => void;
231
254
  readonly __externref_drop_slice: (a: number, b: number) => void;
232
- readonly __wbindgen_free: (a: number, b: number, c: number) => void;
233
255
  readonly __wbindgen_start: () => void;
234
256
  }
235
257
 
236
258
  export type SyncInitInput = BufferSource | WebAssembly.Module;
259
+
237
260
  /**
238
261
  * Instantiates the given `module`, which can either be bytes or
239
262
  * a precompiled `WebAssembly.Module`.