@janssenproject/cedarling_wasm 2.0.0 → 2.0.1-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 +423 -21
- package/cedarling_wasm.d.ts +484 -197
- package/cedarling_wasm.js +1980 -1177
- package/cedarling_wasm_bg.wasm +0 -0
- package/package.json +2 -6
package/cedarling_wasm.d.ts
CHANGED
|
@@ -1,125 +1,405 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* The `ReadableStreamType` enum.
|
|
5
|
+
*
|
|
6
|
+
* *This API requires the following crate features to be activated: `ReadableStreamType`*
|
|
6
7
|
*/
|
|
7
|
-
|
|
8
|
+
|
|
9
|
+
type ReadableStreamType = "bytes";
|
|
10
|
+
|
|
8
11
|
/**
|
|
9
12
|
* A WASM wrapper for the Rust `cedarling::AuthorizeResult` struct.
|
|
10
13
|
* Represents the result of an authorization request.
|
|
11
14
|
*/
|
|
12
15
|
export class AuthorizeResult {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Result of authorization
|
|
38
|
-
* true means `ALLOW`
|
|
39
|
-
* false means `Deny`
|
|
40
|
-
*
|
|
41
|
-
* this field is [`bool`] type to be compatible with [authzen Access Evaluation Decision](https://openid.github.io/authzen/#section-6.2.1).
|
|
42
|
-
*/
|
|
43
|
-
decision: boolean;
|
|
44
|
-
/**
|
|
45
|
-
* Request ID of the authorization request
|
|
46
|
-
*/
|
|
47
|
-
request_id: string;
|
|
16
|
+
private constructor();
|
|
17
|
+
free(): void;
|
|
18
|
+
[Symbol.dispose](): void;
|
|
19
|
+
/**
|
|
20
|
+
* Convert `AuthorizeResult` to json string value
|
|
21
|
+
*/
|
|
22
|
+
json_string(): string;
|
|
23
|
+
/**
|
|
24
|
+
* Result of authorization
|
|
25
|
+
* true means `ALLOW`
|
|
26
|
+
* false means `Deny`
|
|
27
|
+
*
|
|
28
|
+
* this field is [`bool`] type to be compatible with [authzen Access Evaluation Decision](https://openid.github.io/authzen/#section-6.2.1).
|
|
29
|
+
*/
|
|
30
|
+
decision: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Request ID of the authorization request
|
|
33
|
+
*/
|
|
34
|
+
request_id: string;
|
|
35
|
+
/**
|
|
36
|
+
* Cedar authorization response for the request.
|
|
37
|
+
*/
|
|
38
|
+
response: AuthorizeResultResponse;
|
|
48
39
|
}
|
|
40
|
+
|
|
49
41
|
/**
|
|
50
42
|
* A WASM wrapper for the Rust `cedar_policy::Response` struct.
|
|
51
43
|
* Represents the result of an authorization request.
|
|
52
44
|
*/
|
|
53
45
|
export class AuthorizeResultResponse {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
46
|
+
private constructor();
|
|
47
|
+
free(): void;
|
|
48
|
+
[Symbol.dispose](): void;
|
|
49
|
+
/**
|
|
50
|
+
* Authorization decision
|
|
51
|
+
*/
|
|
52
|
+
readonly decision: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Diagnostics providing more information on how this decision was reached
|
|
55
|
+
*/
|
|
56
|
+
readonly diagnostics: Diagnostics;
|
|
64
57
|
}
|
|
58
|
+
|
|
65
59
|
/**
|
|
66
60
|
* The instance of the Cedarling application.
|
|
67
61
|
*/
|
|
68
62
|
export class Cedarling {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
63
|
+
private constructor();
|
|
64
|
+
free(): void;
|
|
65
|
+
[Symbol.dispose](): void;
|
|
66
|
+
/**
|
|
67
|
+
* Authorize multi-issuer request.
|
|
68
|
+
* Makes authorization decision based on multiple JWT tokens from different issuers
|
|
69
|
+
*/
|
|
70
|
+
authorize_multi_issuer(request: any): Promise<MultiIssuerAuthorizeResult>;
|
|
71
|
+
/**
|
|
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`.
|
|
79
|
+
*/
|
|
80
|
+
authorize_unsigned(request: any): Promise<AuthorizeResult>;
|
|
81
|
+
/**
|
|
82
|
+
* Clear all entries from the data store.
|
|
83
|
+
*
|
|
84
|
+
* # Example
|
|
85
|
+
*
|
|
86
|
+
* ```javascript
|
|
87
|
+
* cedarling.clear_data_ctx();
|
|
88
|
+
* console.log("All data entries cleared");
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
clear_data_ctx(): void;
|
|
92
|
+
/**
|
|
93
|
+
* Get trusted issuer identifiers that failed to load.
|
|
94
|
+
*
|
|
95
|
+
* # Example
|
|
96
|
+
*
|
|
97
|
+
* ```javascript
|
|
98
|
+
* const ids = cedarling.failed_trusted_issuer_ids();
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
failed_trusted_issuer_ids(): Array<any>;
|
|
102
|
+
/**
|
|
103
|
+
* Get a value from the data store by key.
|
|
104
|
+
* Returns null if the key doesn't exist or the entry has expired.
|
|
105
|
+
*
|
|
106
|
+
* # Arguments
|
|
107
|
+
*
|
|
108
|
+
* * `key` - A string key for the data entry to retrieve
|
|
109
|
+
*
|
|
110
|
+
* # Example
|
|
111
|
+
*
|
|
112
|
+
* ```javascript
|
|
113
|
+
* const value = cedarling.get_data_ctx("user:123");
|
|
114
|
+
* if (value !== null) {
|
|
115
|
+
* console.log(value.name); // "John"
|
|
116
|
+
* }
|
|
117
|
+
* ```
|
|
118
|
+
*/
|
|
119
|
+
get_data_ctx(key: string): any;
|
|
120
|
+
/**
|
|
121
|
+
* Get a data entry with full metadata by key.
|
|
122
|
+
* Returns null if the key doesn't exist or the entry has expired.
|
|
123
|
+
*
|
|
124
|
+
* # Arguments
|
|
125
|
+
*
|
|
126
|
+
* * `key` - A string key for the data entry to retrieve
|
|
127
|
+
*
|
|
128
|
+
* # Example
|
|
129
|
+
*
|
|
130
|
+
* ```javascript
|
|
131
|
+
* const entry = cedarling.get_data_entry_ctx("user:123");
|
|
132
|
+
* if (entry !== null) {
|
|
133
|
+
* console.log(entry.key); // "user:123"
|
|
134
|
+
* console.log(entry.value); // { name: "John", age: 30 }
|
|
135
|
+
* console.log(entry.data_type); // "Record"
|
|
136
|
+
* console.log(entry.created_at); // "2024-01-01T12:00:00Z"
|
|
137
|
+
* console.log(entry.access_count); // 5
|
|
138
|
+
* }
|
|
139
|
+
* ```
|
|
140
|
+
*/
|
|
141
|
+
get_data_entry_ctx(key: string): DataEntry | undefined;
|
|
142
|
+
/**
|
|
143
|
+
* Get specific log entry.
|
|
144
|
+
* Returns `Map` with values or `null`.
|
|
145
|
+
*/
|
|
146
|
+
get_log_by_id(id: string): any;
|
|
147
|
+
/**
|
|
148
|
+
* Returns a list of all log ids.
|
|
149
|
+
* Returns `Array` of `String`
|
|
150
|
+
*/
|
|
151
|
+
get_log_ids(): Array<any>;
|
|
152
|
+
/**
|
|
153
|
+
* Get logs by request_id.
|
|
154
|
+
* Return log entries that match the given request_id.
|
|
155
|
+
*/
|
|
156
|
+
get_logs_by_request_id(request_id: string): any[];
|
|
157
|
+
/**
|
|
158
|
+
* Get log by request_id and tag, like composite key `request_id` + `log_kind`.
|
|
159
|
+
* Tag can be `log_kind`, `log_level`.
|
|
160
|
+
* Return log entries that match the given request_id and tag.
|
|
161
|
+
*/
|
|
162
|
+
get_logs_by_request_id_and_tag(request_id: string, tag: string): any[];
|
|
163
|
+
/**
|
|
164
|
+
* Get logs by tag, like `log_kind` or `log level`.
|
|
165
|
+
* Tag can be `log_kind`, `log_level`.
|
|
166
|
+
*/
|
|
167
|
+
get_logs_by_tag(tag: string): any[];
|
|
168
|
+
/**
|
|
169
|
+
* Get statistics about the data store.
|
|
170
|
+
*
|
|
171
|
+
* # Example
|
|
172
|
+
*
|
|
173
|
+
* ```javascript
|
|
174
|
+
* const stats = cedarling.get_stats_ctx();
|
|
175
|
+
* console.log(`Entries: ${stats.entry_count}/${stats.max_entries || 'unlimited'}`);
|
|
176
|
+
* console.log(`Capacity: ${stats.capacity_usage_percent.toFixed(2)}%`);
|
|
177
|
+
* console.log(`Total size: ${stats.total_size_bytes} bytes`);
|
|
178
|
+
* ```
|
|
179
|
+
*/
|
|
180
|
+
get_stats_ctx(): DataStoreStats;
|
|
181
|
+
/**
|
|
182
|
+
* Check whether a trusted issuer was loaded by `iss` claim.
|
|
183
|
+
*
|
|
184
|
+
* # Arguments
|
|
185
|
+
*
|
|
186
|
+
* * `iss_claim` - Issuer `iss` claim value to check.
|
|
187
|
+
*
|
|
188
|
+
* # Example
|
|
189
|
+
*
|
|
190
|
+
* ```javascript
|
|
191
|
+
* const ok = cedarling.is_trusted_issuer_loaded_by_iss("https://issuer.example.org");
|
|
192
|
+
* ```
|
|
193
|
+
*/
|
|
194
|
+
is_trusted_issuer_loaded_by_iss(iss_claim: string): boolean;
|
|
195
|
+
/**
|
|
196
|
+
* Check whether a trusted issuer was loaded by issuer identifier.
|
|
197
|
+
*
|
|
198
|
+
* # Arguments
|
|
199
|
+
*
|
|
200
|
+
* * `issuer_id` - Trusted issuer identifier to check.
|
|
201
|
+
*
|
|
202
|
+
* # Example
|
|
203
|
+
*
|
|
204
|
+
* ```javascript
|
|
205
|
+
* const ok = cedarling.is_trusted_issuer_loaded_by_name("issuer_id");
|
|
206
|
+
* ```
|
|
207
|
+
*/
|
|
208
|
+
is_trusted_issuer_loaded_by_name(issuer_id: string): boolean;
|
|
209
|
+
/**
|
|
210
|
+
* List all entries with their metadata.
|
|
211
|
+
* Returns an array of DataEntry objects.
|
|
212
|
+
*
|
|
213
|
+
* # Example
|
|
214
|
+
*
|
|
215
|
+
* ```javascript
|
|
216
|
+
* const entries = cedarling.list_data_ctx();
|
|
217
|
+
* entries.forEach(entry => {
|
|
218
|
+
* console.log(`${entry.key}: ${entry.data_type} (accessed ${entry.access_count} times)`);
|
|
219
|
+
* });
|
|
220
|
+
* ```
|
|
221
|
+
*/
|
|
222
|
+
list_data_ctx(): Array<any>;
|
|
223
|
+
/**
|
|
224
|
+
* Get trusted issuer identifiers loaded successfully.
|
|
225
|
+
*
|
|
226
|
+
* # Example
|
|
227
|
+
*
|
|
228
|
+
* ```javascript
|
|
229
|
+
* const ids = cedarling.loaded_trusted_issuer_ids();
|
|
230
|
+
* ```
|
|
231
|
+
*/
|
|
232
|
+
loaded_trusted_issuer_ids(): Array<any>;
|
|
233
|
+
/**
|
|
234
|
+
* Get the number of trusted issuers loaded successfully.
|
|
235
|
+
*
|
|
236
|
+
* # Example
|
|
237
|
+
*
|
|
238
|
+
* ```javascript
|
|
239
|
+
* const loadedCount = cedarling.loaded_trusted_issuers_count();
|
|
240
|
+
* ```
|
|
241
|
+
*/
|
|
242
|
+
loaded_trusted_issuers_count(): number;
|
|
243
|
+
/**
|
|
244
|
+
* Create a new instance of the Cedarling application.
|
|
245
|
+
* Assume that config is `Object`
|
|
246
|
+
*/
|
|
247
|
+
static new(config: object): Promise<Cedarling>;
|
|
248
|
+
/**
|
|
249
|
+
* Create a new instance of the Cedarling application.
|
|
250
|
+
* Assume that config is `Map`
|
|
251
|
+
*/
|
|
252
|
+
static new_from_map(config: Map<any, any>): Promise<Cedarling>;
|
|
253
|
+
/**
|
|
254
|
+
* Get logs and remove them from the storage.
|
|
255
|
+
* Returns `Array` of `Map`
|
|
256
|
+
*/
|
|
257
|
+
pop_logs(): Array<any>;
|
|
258
|
+
/**
|
|
259
|
+
* Push a value into the data store with an optional TTL.
|
|
260
|
+
* If the key already exists, the value will be replaced.
|
|
261
|
+
* If TTL is not provided, the default TTL from configuration is used.
|
|
262
|
+
*
|
|
263
|
+
* # Arguments
|
|
264
|
+
*
|
|
265
|
+
* * `key` - A string key for the data entry (must not be empty)
|
|
266
|
+
* * `value` - The value to store (any JSON-serializable JavaScript value: object, array, string, number, boolean)
|
|
267
|
+
* * `ttl_secs` - Optional TTL in seconds (undefined/null uses default from config)
|
|
268
|
+
*
|
|
269
|
+
* # Example
|
|
270
|
+
*
|
|
271
|
+
* ```javascript
|
|
272
|
+
* cedarling.push_data_ctx("user:123", { name: "John", age: 30 }, 3600);
|
|
273
|
+
* cedarling.push_data_ctx("config", { setting: "value" }); // Uses default TTL
|
|
274
|
+
* ```
|
|
275
|
+
*/
|
|
276
|
+
push_data_ctx(key: string, value: any, ttl_secs?: bigint | null): void;
|
|
277
|
+
/**
|
|
278
|
+
* Remove a value from the data store by key.
|
|
279
|
+
* Returns true if the key existed and was removed, false otherwise.
|
|
280
|
+
*
|
|
281
|
+
* # Arguments
|
|
282
|
+
*
|
|
283
|
+
* * `key` - A string key for the data entry to remove
|
|
284
|
+
*
|
|
285
|
+
* # Example
|
|
286
|
+
*
|
|
287
|
+
* ```javascript
|
|
288
|
+
* const removed = cedarling.remove_data_ctx("user:123");
|
|
289
|
+
* if (removed) {
|
|
290
|
+
* console.log("Entry was successfully removed");
|
|
291
|
+
* }
|
|
292
|
+
* ```
|
|
293
|
+
*/
|
|
294
|
+
remove_data_ctx(key: string): boolean;
|
|
295
|
+
/**
|
|
296
|
+
* Closes the connections to the Lock Server and pushes all available logs.
|
|
297
|
+
*/
|
|
298
|
+
shut_down(): Promise<void>;
|
|
299
|
+
/**
|
|
300
|
+
* Get the total number of trusted issuer entries discovered.
|
|
301
|
+
*
|
|
302
|
+
* # Example
|
|
303
|
+
*
|
|
304
|
+
* ```javascript
|
|
305
|
+
* const total = cedarling.total_issuers();
|
|
306
|
+
* ```
|
|
307
|
+
*/
|
|
308
|
+
total_issuers(): number;
|
|
122
309
|
}
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* A WASM wrapper for the Rust `cedarling::DataEntry` struct.
|
|
313
|
+
* Represents a data entry in the DataStore with value and metadata.
|
|
314
|
+
*/
|
|
315
|
+
export class DataEntry {
|
|
316
|
+
private constructor();
|
|
317
|
+
free(): void;
|
|
318
|
+
[Symbol.dispose](): void;
|
|
319
|
+
/**
|
|
320
|
+
* Convert `DataEntry` to json string value
|
|
321
|
+
*/
|
|
322
|
+
json_string(): string;
|
|
323
|
+
/**
|
|
324
|
+
* Get the value stored in this entry as a JavaScript object
|
|
325
|
+
*/
|
|
326
|
+
value(): any;
|
|
327
|
+
/**
|
|
328
|
+
* Number of times this entry has been accessed
|
|
329
|
+
*/
|
|
330
|
+
access_count: bigint;
|
|
331
|
+
/**
|
|
332
|
+
* Timestamp when this entry was created (RFC 3339 format)
|
|
333
|
+
*/
|
|
334
|
+
created_at: string;
|
|
335
|
+
/**
|
|
336
|
+
* The inferred Cedar type of the value
|
|
337
|
+
*/
|
|
338
|
+
data_type: string;
|
|
339
|
+
/**
|
|
340
|
+
* Timestamp when this entry expires (RFC 3339 format), or null if no TTL
|
|
341
|
+
*/
|
|
342
|
+
get expires_at(): string | undefined;
|
|
343
|
+
/**
|
|
344
|
+
* Timestamp when this entry expires (RFC 3339 format), or null if no TTL
|
|
345
|
+
*/
|
|
346
|
+
set expires_at(value: string | null | undefined);
|
|
347
|
+
/**
|
|
348
|
+
* The key for this entry
|
|
349
|
+
*/
|
|
350
|
+
key: string;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* A WASM wrapper for the Rust `cedarling::DataStoreStats` struct.
|
|
355
|
+
* Statistics about the DataStore.
|
|
356
|
+
*/
|
|
357
|
+
export class DataStoreStats {
|
|
358
|
+
private constructor();
|
|
359
|
+
free(): void;
|
|
360
|
+
[Symbol.dispose](): void;
|
|
361
|
+
/**
|
|
362
|
+
* Convert `DataStoreStats` to json string value
|
|
363
|
+
*/
|
|
364
|
+
json_string(): string;
|
|
365
|
+
/**
|
|
366
|
+
* Average size per entry in bytes (0 if no entries)
|
|
367
|
+
*/
|
|
368
|
+
avg_entry_size_bytes: number;
|
|
369
|
+
/**
|
|
370
|
+
* Percentage of capacity used (0.0-100.0, based on entry count)
|
|
371
|
+
*/
|
|
372
|
+
capacity_usage_percent: number;
|
|
373
|
+
/**
|
|
374
|
+
* Number of entries currently stored
|
|
375
|
+
*/
|
|
376
|
+
entry_count: number;
|
|
377
|
+
/**
|
|
378
|
+
* Maximum number of entries allowed (0 = unlimited)
|
|
379
|
+
*/
|
|
380
|
+
max_entries: number;
|
|
381
|
+
/**
|
|
382
|
+
* Maximum size per entry in bytes (0 = unlimited)
|
|
383
|
+
*/
|
|
384
|
+
max_entry_size: number;
|
|
385
|
+
/**
|
|
386
|
+
* Memory usage threshold percentage (from config)
|
|
387
|
+
*/
|
|
388
|
+
memory_alert_threshold: number;
|
|
389
|
+
/**
|
|
390
|
+
* Whether memory usage exceeds the alert threshold
|
|
391
|
+
*/
|
|
392
|
+
memory_alert_triggered: boolean;
|
|
393
|
+
/**
|
|
394
|
+
* Whether metrics tracking is enabled
|
|
395
|
+
*/
|
|
396
|
+
metrics_enabled: boolean;
|
|
397
|
+
/**
|
|
398
|
+
* Total size of all entries in bytes (approximate, based on JSON serialization)
|
|
399
|
+
*/
|
|
400
|
+
total_size_bytes: number;
|
|
401
|
+
}
|
|
402
|
+
|
|
123
403
|
/**
|
|
124
404
|
* Diagnostics
|
|
125
405
|
* ===========
|
|
@@ -127,26 +407,79 @@ export class Cedarling {
|
|
|
127
407
|
* Provides detailed information about how a policy decision was made, including policies that contributed to the decision and any errors encountered during evaluation.
|
|
128
408
|
*/
|
|
129
409
|
export class Diagnostics {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
410
|
+
private constructor();
|
|
411
|
+
free(): void;
|
|
412
|
+
[Symbol.dispose](): void;
|
|
413
|
+
/**
|
|
414
|
+
* Errors that occurred during authorization. The errors should be
|
|
415
|
+
* treated as unordered, since policies may be evaluated in any order.
|
|
416
|
+
*/
|
|
417
|
+
readonly errors: PolicyEvaluationError[];
|
|
418
|
+
/**
|
|
419
|
+
* `PolicyId`s of the policies that contributed to the decision.
|
|
420
|
+
* If no policies applied to the request, this set will be empty.
|
|
421
|
+
*
|
|
422
|
+
* The ids should be treated as unordered,
|
|
423
|
+
*/
|
|
424
|
+
readonly reason: string[];
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
export class IntoUnderlyingByteSource {
|
|
428
|
+
private constructor();
|
|
429
|
+
free(): void;
|
|
430
|
+
[Symbol.dispose](): void;
|
|
431
|
+
cancel(): void;
|
|
432
|
+
pull(controller: ReadableByteStreamController): Promise<any>;
|
|
433
|
+
start(controller: ReadableByteStreamController): void;
|
|
434
|
+
readonly autoAllocateChunkSize: number;
|
|
435
|
+
readonly type: ReadableStreamType;
|
|
144
436
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
437
|
+
|
|
438
|
+
export class IntoUnderlyingSink {
|
|
439
|
+
private constructor();
|
|
440
|
+
free(): void;
|
|
441
|
+
[Symbol.dispose](): void;
|
|
442
|
+
abort(reason: any): Promise<any>;
|
|
443
|
+
close(): Promise<any>;
|
|
444
|
+
write(chunk: any): Promise<any>;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
export class IntoUnderlyingSource {
|
|
448
|
+
private constructor();
|
|
449
|
+
free(): void;
|
|
450
|
+
[Symbol.dispose](): void;
|
|
451
|
+
cancel(): void;
|
|
452
|
+
pull(controller: ReadableStreamDefaultController): Promise<any>;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
/**
|
|
456
|
+
* A WASM wrapper for the Rust `cedarling::MultiIssuerAuthorizeResult` struct.
|
|
457
|
+
* Represents the result of a multi-issuer authorization request.
|
|
458
|
+
*/
|
|
459
|
+
export class MultiIssuerAuthorizeResult {
|
|
460
|
+
private constructor();
|
|
461
|
+
free(): void;
|
|
462
|
+
[Symbol.dispose](): void;
|
|
463
|
+
/**
|
|
464
|
+
* Convert `MultiIssuerAuthorizeResult` to json string value
|
|
465
|
+
*/
|
|
466
|
+
json_string(): string;
|
|
467
|
+
/**
|
|
468
|
+
* Result of authorization
|
|
469
|
+
* true means `ALLOW`
|
|
470
|
+
* false means `Deny`
|
|
471
|
+
*/
|
|
472
|
+
decision: boolean;
|
|
473
|
+
/**
|
|
474
|
+
* Request ID of the authorization request
|
|
475
|
+
*/
|
|
476
|
+
request_id: string;
|
|
477
|
+
/**
|
|
478
|
+
* Result of Cedar policy authorization
|
|
479
|
+
*/
|
|
480
|
+
response: AuthorizeResultResponse;
|
|
149
481
|
}
|
|
482
|
+
|
|
150
483
|
/**
|
|
151
484
|
* PolicyEvaluationError
|
|
152
485
|
* =====================
|
|
@@ -154,86 +487,40 @@ export class JsJsonLogic {
|
|
|
154
487
|
* Represents an error that occurred when evaluating a Cedar policy.
|
|
155
488
|
*/
|
|
156
489
|
export class PolicyEvaluationError {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
490
|
+
private constructor();
|
|
491
|
+
free(): void;
|
|
492
|
+
[Symbol.dispose](): void;
|
|
493
|
+
/**
|
|
494
|
+
* Underlying evaluation error string representation
|
|
495
|
+
*/
|
|
496
|
+
readonly error: string;
|
|
497
|
+
/**
|
|
498
|
+
* Id of the policy with an error
|
|
499
|
+
*/
|
|
500
|
+
readonly id: string;
|
|
167
501
|
}
|
|
168
502
|
|
|
169
|
-
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
170
|
-
|
|
171
|
-
export interface InitOutput {
|
|
172
|
-
readonly memory: WebAssembly.Memory;
|
|
173
|
-
readonly __wbg_cedarling_free: (a: number, b: number) => void;
|
|
174
|
-
readonly init: (a: number) => number;
|
|
175
|
-
readonly cedarling_new: (a: number) => number;
|
|
176
|
-
readonly cedarling_new_from_map: (a: number) => number;
|
|
177
|
-
readonly cedarling_authorize: (a: number, b: number) => number;
|
|
178
|
-
readonly cedarling_authorize_unsigned: (a: number, b: number) => number;
|
|
179
|
-
readonly cedarling_pop_logs: (a: number, b: number) => void;
|
|
180
|
-
readonly cedarling_get_log_by_id: (a: number, b: number, c: number, d: number) => void;
|
|
181
|
-
readonly cedarling_get_log_ids: (a: number) => number;
|
|
182
|
-
readonly cedarling_get_logs_by_tag: (a: number, b: number, c: number, d: number) => void;
|
|
183
|
-
readonly cedarling_get_logs_by_request_id: (a: number, b: number, c: number, d: number) => void;
|
|
184
|
-
readonly cedarling_get_logs_by_request_id_and_tag: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
185
|
-
readonly __wbg_authorizeresult_free: (a: number, b: number) => void;
|
|
186
|
-
readonly __wbg_get_authorizeresult_workload: (a: number) => number;
|
|
187
|
-
readonly __wbg_set_authorizeresult_workload: (a: number, b: number) => void;
|
|
188
|
-
readonly __wbg_get_authorizeresult_person: (a: number) => number;
|
|
189
|
-
readonly __wbg_set_authorizeresult_person: (a: number, b: number) => void;
|
|
190
|
-
readonly __wbg_get_authorizeresult_decision: (a: number) => number;
|
|
191
|
-
readonly __wbg_set_authorizeresult_decision: (a: number, b: number) => void;
|
|
192
|
-
readonly __wbg_get_authorizeresult_request_id: (a: number, b: number) => void;
|
|
193
|
-
readonly __wbg_set_authorizeresult_request_id: (a: number, b: number, c: number) => void;
|
|
194
|
-
readonly authorizeresult_json_string: (a: number, b: number) => void;
|
|
195
|
-
readonly authorizeresult_principal: (a: number, b: number, c: number) => number;
|
|
196
|
-
readonly __wbg_authorizeresultresponse_free: (a: number, b: number) => void;
|
|
197
|
-
readonly authorizeresultresponse_decision: (a: number) => number;
|
|
198
|
-
readonly authorizeresultresponse_diagnostics: (a: number) => number;
|
|
199
|
-
readonly __wbg_diagnostics_free: (a: number, b: number) => void;
|
|
200
|
-
readonly diagnostics_reason: (a: number, b: number) => void;
|
|
201
|
-
readonly diagnostics_errors: (a: number, b: number) => void;
|
|
202
|
-
readonly __wbg_policyevaluationerror_free: (a: number, b: number) => void;
|
|
203
|
-
readonly policyevaluationerror_id: (a: number, b: number) => void;
|
|
204
|
-
readonly policyevaluationerror_error: (a: number, b: number) => void;
|
|
205
|
-
readonly __wbg_jsjsonlogic_free: (a: number, b: number) => void;
|
|
206
|
-
readonly jsjsonlogic_new: () => number;
|
|
207
|
-
readonly jsjsonlogic_apply: (a: number, b: number, c: number, d: number) => void;
|
|
208
|
-
readonly ring_core_0_17_14__bn_mul_mont: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
209
|
-
readonly __wbindgen_export_0: (a: number, b: number) => number;
|
|
210
|
-
readonly __wbindgen_export_1: (a: number, b: number, c: number, d: number) => number;
|
|
211
|
-
readonly __wbindgen_export_2: (a: number) => void;
|
|
212
|
-
readonly __wbindgen_export_3: WebAssembly.Table;
|
|
213
|
-
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
214
|
-
readonly __wbindgen_export_4: (a: number, b: number, c: number) => void;
|
|
215
|
-
readonly __wbindgen_export_5: (a: number, b: number) => void;
|
|
216
|
-
readonly __wbindgen_export_6: (a: number, b: number, c: number) => void;
|
|
217
|
-
readonly __wbindgen_export_7: (a: number, b: number, c: number, d: number) => void;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
221
503
|
/**
|
|
222
|
-
*
|
|
223
|
-
*
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
*
|
|
227
|
-
* @returns {InitOutput}
|
|
228
|
-
*/
|
|
229
|
-
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
504
|
+
* Create a new instance of the Cedarling application.
|
|
505
|
+
* This function can take as config parameter the eather `Map` other `Object`
|
|
506
|
+
*/
|
|
507
|
+
export function init(config: any): Promise<Cedarling>;
|
|
230
508
|
|
|
231
509
|
/**
|
|
232
|
-
*
|
|
233
|
-
*
|
|
234
|
-
*
|
|
235
|
-
*
|
|
236
|
-
*
|
|
237
|
-
*
|
|
238
|
-
|
|
239
|
-
|
|
510
|
+
* Create a new instance of the Cedarling application from archive bytes.
|
|
511
|
+
*
|
|
512
|
+
* This function allows loading a policy store from a Cedar Archive (.cjar)
|
|
513
|
+
* that was fetched with custom logic (e.g., with authentication headers).
|
|
514
|
+
*
|
|
515
|
+
* # Arguments
|
|
516
|
+
* * `config` - Bootstrap configuration (Map or Object). Policy store config is ignored.
|
|
517
|
+
* * `archive_bytes` - The .cjar archive bytes (Uint8Array)
|
|
518
|
+
*
|
|
519
|
+
* # Example
|
|
520
|
+
* ```javascript
|
|
521
|
+
* const response = await fetch(url, { headers: { Authorization: 'Bearer ...' } });
|
|
522
|
+
* const bytes = new Uint8Array(await response.arrayBuffer());
|
|
523
|
+
* const cedarling = await init_from_archive_bytes(config, bytes);
|
|
524
|
+
* ```
|
|
525
|
+
*/
|
|
526
|
+
export function init_from_archive_bytes(config: any, archive_bytes: Uint8Array): Promise<Cedarling>;
|