@janssenproject/cedarling_wasm 1.14.0 → 1.15.0-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.
@@ -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,80 +183,8 @@ export class PolicyEvaluationError {
176
183
  readonly error: string;
177
184
  }
178
185
 
179
- export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
180
-
181
- export interface InitOutput {
182
- readonly memory: WebAssembly.Memory;
183
- readonly __wbg_cedarling_free: (a: number, b: number) => void;
184
- readonly init: (a: any) => any;
185
- readonly cedarling_new: (a: any) => any;
186
- readonly cedarling_new_from_map: (a: any) => any;
187
- readonly cedarling_authorize: (a: number, b: any) => any;
188
- readonly cedarling_authorize_unsigned: (a: number, b: any) => any;
189
- readonly cedarling_pop_logs: (a: number) => [number, number, number];
190
- readonly cedarling_get_log_by_id: (a: number, b: number, c: number) => [number, number, number];
191
- readonly cedarling_get_log_ids: (a: number) => any;
192
- readonly cedarling_get_logs_by_tag: (a: number, b: number, c: number) => [number, number, number, number];
193
- readonly cedarling_get_logs_by_request_id: (a: number, b: number, c: number) => [number, number, number, number];
194
- readonly cedarling_get_logs_by_request_id_and_tag: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
195
- readonly cedarling_shut_down: (a: number) => any;
196
- readonly __wbg_authorizeresult_free: (a: number, b: number) => void;
197
- readonly __wbg_get_authorizeresult_workload: (a: number) => number;
198
- readonly __wbg_set_authorizeresult_workload: (a: number, b: number) => void;
199
- readonly __wbg_get_authorizeresult_person: (a: number) => number;
200
- readonly __wbg_set_authorizeresult_person: (a: number, b: number) => void;
201
- readonly __wbg_get_authorizeresult_decision: (a: number) => number;
202
- readonly __wbg_set_authorizeresult_decision: (a: number, b: number) => void;
203
- readonly __wbg_get_authorizeresult_request_id: (a: number) => [number, number];
204
- readonly __wbg_set_authorizeresult_request_id: (a: number, b: number, c: number) => void;
205
- readonly authorizeresult_json_string: (a: number) => [number, number];
206
- readonly authorizeresult_principal: (a: number, b: number, c: number) => number;
207
- readonly __wbg_authorizeresultresponse_free: (a: number, b: number) => void;
208
- readonly authorizeresultresponse_decision: (a: number) => number;
209
- readonly authorizeresultresponse_diagnostics: (a: number) => number;
210
- readonly __wbg_diagnostics_free: (a: number, b: number) => void;
211
- readonly diagnostics_reason: (a: number) => [number, number];
212
- readonly diagnostics_errors: (a: number) => [number, number];
213
- readonly __wbg_policyevaluationerror_free: (a: number, b: number) => void;
214
- readonly policyevaluationerror_id: (a: number) => [number, number];
215
- readonly policyevaluationerror_error: (a: number) => [number, number];
216
- readonly __wbg_jsjsonlogic_free: (a: number, b: number) => void;
217
- readonly jsjsonlogic_new: () => number;
218
- readonly jsjsonlogic_apply: (a: number, b: any, c: any) => [number, number, number];
219
- 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;
225
- readonly __wbindgen_malloc: (a: number, b: number) => number;
226
- readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
227
- readonly __wbindgen_exn_store: (a: number) => void;
228
- readonly __externref_table_alloc: () => number;
229
- readonly __wbindgen_externrefs: WebAssembly.Table;
230
- readonly __externref_table_dealloc: (a: number) => void;
231
- readonly __externref_drop_slice: (a: number, b: number) => void;
232
- readonly __wbindgen_free: (a: number, b: number, c: number) => void;
233
- readonly __wbindgen_start: () => void;
234
- }
235
-
236
- export type SyncInitInput = BufferSource | WebAssembly.Module;
237
186
  /**
238
- * Instantiates the given `module`, which can either be bytes or
239
- * a precompiled `WebAssembly.Module`.
240
- *
241
- * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
242
- *
243
- * @returns {InitOutput}
244
- */
245
- export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
246
-
247
- /**
248
- * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
249
- * for everything else, calls `WebAssembly.instantiate` directly.
250
- *
251
- * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
252
- *
253
- * @returns {Promise<InitOutput>}
254
- */
255
- export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
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>;