@janssenproject/cedarling_wasm 0.0.466 → 0.0.467
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 +23 -553
- package/cedarling_wasm.d.ts +277 -123
- package/cedarling_wasm.js +285 -131
- package/cedarling_wasm_bg.wasm +0 -0
- package/package.json +1 -1
package/cedarling_wasm.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export class AuthorizeResult {
|
|
|
19
19
|
/**
|
|
20
20
|
* Convert `AuthorizeResult` to json string value
|
|
21
21
|
*/
|
|
22
|
-
|
|
22
|
+
jsonString(): string;
|
|
23
23
|
/**
|
|
24
24
|
* Result of authorization
|
|
25
25
|
* true means `ALLOW`
|
|
@@ -186,14 +186,17 @@ export class Cedarling {
|
|
|
186
186
|
* # Example
|
|
187
187
|
*
|
|
188
188
|
* ```javascript
|
|
189
|
-
* const redirects = cedarling.
|
|
189
|
+
* const redirects = cedarling.annotationValues(
|
|
190
|
+
* result.response.diagnostics.reason,
|
|
191
|
+
* "redirect",
|
|
192
|
+
* );
|
|
190
193
|
* // ["/upgrade"]
|
|
191
194
|
* ```
|
|
192
195
|
*/
|
|
193
|
-
|
|
196
|
+
annotationValues(policy_ids: string[], key: string): string[];
|
|
194
197
|
/**
|
|
195
|
-
* Return the annotations of each given policy, grouped by policy ID
|
|
196
|
-
* the loss-free companion to `
|
|
198
|
+
* Return the annotations of each given policy, grouped by policy ID. It is
|
|
199
|
+
* the loss-free companion to `annotationsMap`. Unknown policy IDs are
|
|
197
200
|
* silently skipped.
|
|
198
201
|
*
|
|
199
202
|
* # Arguments
|
|
@@ -205,11 +208,11 @@ export class Cedarling {
|
|
|
205
208
|
* # Example
|
|
206
209
|
*
|
|
207
210
|
* ```javascript
|
|
208
|
-
* const byPolicy = cedarling.
|
|
211
|
+
* const byPolicy = cedarling.annotationsByPolicy(result.response.diagnostics.reason);
|
|
209
212
|
* // { "5": { redirect: "/upgrade", tier: "premium" } }
|
|
210
213
|
* ```
|
|
211
214
|
*/
|
|
212
|
-
|
|
215
|
+
annotationsByPolicy(policy_ids: string[]): any;
|
|
213
216
|
/**
|
|
214
217
|
* Merge the annotations (`@key("value")`) of the given policies into a single object.
|
|
215
218
|
*
|
|
@@ -217,7 +220,7 @@ export class Cedarling {
|
|
|
217
220
|
* pass `result.response.diagnostics.reason`.
|
|
218
221
|
*
|
|
219
222
|
* Lossy: if the same annotation key appears on several policies, one value wins
|
|
220
|
-
* arbitrarily. Use `
|
|
223
|
+
* arbitrarily. Use `annotationValues` / `annotationsByPolicy` when duplicates
|
|
221
224
|
* matter. Unknown policy IDs are silently skipped.
|
|
222
225
|
*
|
|
223
226
|
* # Arguments
|
|
@@ -229,11 +232,11 @@ export class Cedarling {
|
|
|
229
232
|
* # Example
|
|
230
233
|
*
|
|
231
234
|
* ```javascript
|
|
232
|
-
* const annotations = cedarling.
|
|
235
|
+
* const annotations = cedarling.annotationsMap(result.response.diagnostics.reason);
|
|
233
236
|
* // { redirect: "/upgrade", tier: "premium" }
|
|
234
237
|
* ```
|
|
235
238
|
*/
|
|
236
|
-
|
|
239
|
+
annotationsMap(policy_ids: string[]): any;
|
|
237
240
|
/**
|
|
238
241
|
* Authorize multi-issuer request.
|
|
239
242
|
* Makes authorization decision based on multiple JWT tokens from different issuers.
|
|
@@ -245,10 +248,10 @@ export class Cedarling {
|
|
|
245
248
|
* # Example
|
|
246
249
|
*
|
|
247
250
|
* ```javascript
|
|
248
|
-
* const result = await cedarling.
|
|
251
|
+
* const result = await cedarling.authorizeMultiIssuer(JSON.stringify(request));
|
|
249
252
|
* ```
|
|
250
253
|
*/
|
|
251
|
-
|
|
254
|
+
authorizeMultiIssuer(request: string): Promise<MultiIssuerAuthorizeResult>;
|
|
252
255
|
/**
|
|
253
256
|
* Authorize a batch of multi-issuer requests against one shared token set.
|
|
254
257
|
*
|
|
@@ -266,10 +269,10 @@ export class Cedarling {
|
|
|
266
269
|
* # Example
|
|
267
270
|
*
|
|
268
271
|
* ```javascript
|
|
269
|
-
* const result = await cedarling.
|
|
272
|
+
* const result = await cedarling.authorizeMultiIssuerBatch(JSON.stringify(batchRequest));
|
|
270
273
|
* ```
|
|
271
274
|
*/
|
|
272
|
-
|
|
275
|
+
authorizeMultiIssuerBatch(request: string): Promise<BatchAuthorizeMultiIssuerResponse>;
|
|
273
276
|
/**
|
|
274
277
|
* Authorize an unsigned request carrying an optional single principal.
|
|
275
278
|
* Makes an authorization decision based on the [`RequestUnsigned`].
|
|
@@ -286,10 +289,10 @@ export class Cedarling {
|
|
|
286
289
|
* # Example
|
|
287
290
|
*
|
|
288
291
|
* ```javascript
|
|
289
|
-
* const result = await cedarling.
|
|
292
|
+
* const result = await cedarling.authorizeUnsigned(JSON.stringify(request));
|
|
290
293
|
* ```
|
|
291
294
|
*/
|
|
292
|
-
|
|
295
|
+
authorizeUnsigned(request: string): Promise<AuthorizeResult>;
|
|
293
296
|
/**
|
|
294
297
|
* Authorize a batch of unsigned requests against one shared principal.
|
|
295
298
|
*
|
|
@@ -307,31 +310,39 @@ export class Cedarling {
|
|
|
307
310
|
* # Example
|
|
308
311
|
*
|
|
309
312
|
* ```javascript
|
|
310
|
-
* const result = await cedarling.
|
|
313
|
+
* const result = await cedarling.authorizeUnsignedBatch(JSON.stringify(batchRequest));
|
|
311
314
|
* ```
|
|
312
315
|
*/
|
|
313
|
-
|
|
316
|
+
authorizeUnsignedBatch(request: string): Promise<BatchAuthorizeUnsignedResponse>;
|
|
314
317
|
/**
|
|
315
318
|
* Clear all entries from the data store.
|
|
316
319
|
*
|
|
320
|
+
* # Arguments
|
|
321
|
+
*
|
|
322
|
+
* None.
|
|
323
|
+
*
|
|
317
324
|
* # Example
|
|
318
325
|
*
|
|
319
326
|
* ```javascript
|
|
320
|
-
* cedarling.
|
|
327
|
+
* cedarling.clearDataCtx();
|
|
321
328
|
* console.log("All data entries cleared");
|
|
322
329
|
* ```
|
|
323
330
|
*/
|
|
324
|
-
|
|
331
|
+
clearDataCtx(): void;
|
|
325
332
|
/**
|
|
326
333
|
* Get trusted issuer identifiers that failed to load.
|
|
327
334
|
*
|
|
335
|
+
* # Arguments
|
|
336
|
+
*
|
|
337
|
+
* None.
|
|
338
|
+
*
|
|
328
339
|
* # Example
|
|
329
340
|
*
|
|
330
341
|
* ```javascript
|
|
331
|
-
* const ids = cedarling.
|
|
342
|
+
* const ids = cedarling.failedTrustedIssuerIds();
|
|
332
343
|
* ```
|
|
333
344
|
*/
|
|
334
|
-
|
|
345
|
+
failedTrustedIssuerIds(): Array<any>;
|
|
335
346
|
/**
|
|
336
347
|
* Get a value from the data store by key.
|
|
337
348
|
* Returns null if the key doesn't exist or the entry has expired.
|
|
@@ -343,16 +354,16 @@ export class Cedarling {
|
|
|
343
354
|
* # Example
|
|
344
355
|
*
|
|
345
356
|
* ```javascript
|
|
346
|
-
* const value = cedarling.
|
|
357
|
+
* const value = cedarling.getDataCtx("user:123");
|
|
347
358
|
* if (value !== null) {
|
|
348
359
|
* console.log(value.name); // "John"
|
|
349
360
|
* }
|
|
350
361
|
* ```
|
|
351
362
|
*/
|
|
352
|
-
|
|
363
|
+
getDataCtx(key: string): any;
|
|
353
364
|
/**
|
|
354
365
|
* Get a data entry with full metadata by key.
|
|
355
|
-
* Returns
|
|
366
|
+
* Returns undefined if the key doesn't exist or the entry has expired.
|
|
356
367
|
*
|
|
357
368
|
* # Arguments
|
|
358
369
|
*
|
|
@@ -361,56 +372,107 @@ export class Cedarling {
|
|
|
361
372
|
* # Example
|
|
362
373
|
*
|
|
363
374
|
* ```javascript
|
|
364
|
-
* const entry = cedarling.
|
|
365
|
-
* if (entry !==
|
|
375
|
+
* const entry = cedarling.getDataEntryCtx("user:123");
|
|
376
|
+
* if (entry !== undefined) {
|
|
366
377
|
* console.log(entry.key); // "user:123"
|
|
367
|
-
* console.log(entry.value); // { name: "John", age: 30 }
|
|
378
|
+
* console.log(entry.value()); // { name: "John", age: 30 }
|
|
368
379
|
* console.log(entry.data_type); // "Record"
|
|
369
380
|
* console.log(entry.created_at); // "2024-01-01T12:00:00Z"
|
|
370
381
|
* console.log(entry.access_count); // 5
|
|
371
382
|
* }
|
|
372
383
|
* ```
|
|
373
384
|
*/
|
|
374
|
-
|
|
385
|
+
getDataEntryCtx(key: string): DataEntry | undefined;
|
|
375
386
|
/**
|
|
376
|
-
*
|
|
377
|
-
*
|
|
387
|
+
* Returns one retained memory log by ID, or `null` when it is not retained.
|
|
388
|
+
*
|
|
389
|
+
* # Arguments
|
|
390
|
+
*
|
|
391
|
+
* * `id` - The retained log identifier.
|
|
392
|
+
*
|
|
393
|
+
* # Example
|
|
394
|
+
*
|
|
395
|
+
* ```javascript
|
|
396
|
+
* const log = cedarling.getLogById("request-id");
|
|
397
|
+
* ```
|
|
378
398
|
*/
|
|
379
|
-
|
|
399
|
+
getLogById(id: string): any;
|
|
380
400
|
/**
|
|
381
|
-
* Returns
|
|
382
|
-
*
|
|
401
|
+
* Returns identifiers for all retained memory logs.
|
|
402
|
+
*
|
|
403
|
+
* # Arguments
|
|
404
|
+
*
|
|
405
|
+
* None.
|
|
406
|
+
*
|
|
407
|
+
* # Example
|
|
408
|
+
*
|
|
409
|
+
* ```javascript
|
|
410
|
+
* const ids = cedarling.getLogIds();
|
|
411
|
+
* ```
|
|
383
412
|
*/
|
|
384
|
-
|
|
413
|
+
getLogIds(): Array<any>;
|
|
385
414
|
/**
|
|
386
|
-
*
|
|
387
|
-
*
|
|
415
|
+
* Returns retained memory logs for one request ID.
|
|
416
|
+
*
|
|
417
|
+
* # Arguments
|
|
418
|
+
*
|
|
419
|
+
* * `requestId` - The request identifier to match.
|
|
420
|
+
*
|
|
421
|
+
* # Example
|
|
422
|
+
*
|
|
423
|
+
* ```javascript
|
|
424
|
+
* const logs = cedarling.getLogsByRequestId("request-id");
|
|
425
|
+
* ```
|
|
388
426
|
*/
|
|
389
|
-
|
|
427
|
+
getLogsByRequestId(request_id: string): any[];
|
|
390
428
|
/**
|
|
391
|
-
*
|
|
392
|
-
*
|
|
393
|
-
*
|
|
429
|
+
* Returns retained memory logs matching one request ID and indexed value.
|
|
430
|
+
*
|
|
431
|
+
* # Arguments
|
|
432
|
+
*
|
|
433
|
+
* * `requestId` - The request identifier to match.
|
|
434
|
+
* * `tag` - A log kind (`"System"`, `"Decision"`, or `"Metric"`) or a
|
|
435
|
+
* system-log level such as `"DEBUG"`.
|
|
436
|
+
*
|
|
437
|
+
* # Example
|
|
438
|
+
*
|
|
439
|
+
* ```javascript
|
|
440
|
+
* const logs = cedarling.getLogsByRequestIdAndTag("request-id", "System");
|
|
441
|
+
* ```
|
|
394
442
|
*/
|
|
395
|
-
|
|
443
|
+
getLogsByRequestIdAndTag(request_id: string, tag: string): any[];
|
|
396
444
|
/**
|
|
397
|
-
*
|
|
398
|
-
*
|
|
445
|
+
* Returns retained memory logs matching an indexed value.
|
|
446
|
+
*
|
|
447
|
+
* # Arguments
|
|
448
|
+
*
|
|
449
|
+
* * `tag` - A log kind (`"System"`, `"Decision"`, or `"Metric"`) or a
|
|
450
|
+
* system-log level such as `"DEBUG"`.
|
|
451
|
+
*
|
|
452
|
+
* # Example
|
|
453
|
+
*
|
|
454
|
+
* ```javascript
|
|
455
|
+
* const logs = cedarling.getLogsByTag("System");
|
|
456
|
+
* ```
|
|
399
457
|
*/
|
|
400
|
-
|
|
458
|
+
getLogsByTag(tag: string): any[];
|
|
401
459
|
/**
|
|
402
460
|
* Get statistics about the data store.
|
|
403
461
|
*
|
|
462
|
+
* # Arguments
|
|
463
|
+
*
|
|
464
|
+
* None.
|
|
465
|
+
*
|
|
404
466
|
* # Example
|
|
405
467
|
*
|
|
406
468
|
* ```javascript
|
|
407
|
-
* const stats = cedarling.
|
|
469
|
+
* const stats = cedarling.getStatsCtx();
|
|
408
470
|
* console.log(`Entries: ${stats.entry_count}/${stats.max_entries || 'unlimited'}`);
|
|
409
471
|
* console.log(`Capacity: ${stats.capacity_usage_percent.toFixed(2)}%`);
|
|
410
472
|
* console.log(`Total size: ${stats.total_size_bytes} bytes`);
|
|
411
473
|
* ```
|
|
412
474
|
*/
|
|
413
|
-
|
|
475
|
+
getStatsCtx(): DataStoreStats;
|
|
414
476
|
/**
|
|
415
477
|
* Check whether a trusted issuer was loaded by `iss` claim.
|
|
416
478
|
*
|
|
@@ -421,10 +483,10 @@ export class Cedarling {
|
|
|
421
483
|
* # Example
|
|
422
484
|
*
|
|
423
485
|
* ```javascript
|
|
424
|
-
* const ok = cedarling.
|
|
486
|
+
* const ok = cedarling.isTrustedIssuerLoadedByIss("https://issuer.example.org");
|
|
425
487
|
* ```
|
|
426
488
|
*/
|
|
427
|
-
|
|
489
|
+
isTrustedIssuerLoadedByIss(iss_claim: string): boolean;
|
|
428
490
|
/**
|
|
429
491
|
* Check whether a trusted issuer was loaded by issuer identifier.
|
|
430
492
|
*
|
|
@@ -435,59 +497,111 @@ export class Cedarling {
|
|
|
435
497
|
* # Example
|
|
436
498
|
*
|
|
437
499
|
* ```javascript
|
|
438
|
-
* const ok = cedarling.
|
|
500
|
+
* const ok = cedarling.isTrustedIssuerLoadedByName("issuer_id");
|
|
439
501
|
* ```
|
|
440
502
|
*/
|
|
441
|
-
|
|
503
|
+
isTrustedIssuerLoadedByName(issuer_id: string): boolean;
|
|
442
504
|
/**
|
|
443
505
|
* List all entries with their metadata.
|
|
444
506
|
* Returns an array of DataEntry objects.
|
|
445
507
|
*
|
|
508
|
+
* # Arguments
|
|
509
|
+
*
|
|
510
|
+
* None.
|
|
511
|
+
*
|
|
446
512
|
* # Example
|
|
447
513
|
*
|
|
448
514
|
* ```javascript
|
|
449
|
-
* const entries = cedarling.
|
|
515
|
+
* const entries = cedarling.listDataCtx();
|
|
450
516
|
* entries.forEach(entry => {
|
|
451
517
|
* console.log(`${entry.key}: ${entry.data_type} (accessed ${entry.access_count} times)`);
|
|
452
518
|
* });
|
|
453
519
|
* ```
|
|
454
520
|
*/
|
|
455
|
-
|
|
521
|
+
listDataCtx(): Array<any>;
|
|
456
522
|
/**
|
|
457
523
|
* Get trusted issuer identifiers loaded successfully.
|
|
458
524
|
*
|
|
525
|
+
* # Arguments
|
|
526
|
+
*
|
|
527
|
+
* None.
|
|
528
|
+
*
|
|
459
529
|
* # Example
|
|
460
530
|
*
|
|
461
531
|
* ```javascript
|
|
462
|
-
* const ids = cedarling.
|
|
532
|
+
* const ids = cedarling.loadedTrustedIssuerIds();
|
|
463
533
|
* ```
|
|
464
534
|
*/
|
|
465
|
-
|
|
535
|
+
loadedTrustedIssuerIds(): Array<any>;
|
|
466
536
|
/**
|
|
467
537
|
* Get the number of trusted issuers loaded successfully.
|
|
468
538
|
*
|
|
539
|
+
* # Arguments
|
|
540
|
+
*
|
|
541
|
+
* None.
|
|
542
|
+
*
|
|
469
543
|
* # Example
|
|
470
544
|
*
|
|
471
545
|
* ```javascript
|
|
472
|
-
* const loadedCount = cedarling.
|
|
546
|
+
* const loadedCount = cedarling.loadedTrustedIssuersCount();
|
|
473
547
|
* ```
|
|
474
548
|
*/
|
|
475
|
-
|
|
549
|
+
loadedTrustedIssuersCount(): number;
|
|
476
550
|
/**
|
|
477
|
-
*
|
|
478
|
-
*
|
|
551
|
+
* Creates a Cedarling application from bootstrap properties.
|
|
552
|
+
*
|
|
553
|
+
* # Arguments
|
|
554
|
+
*
|
|
555
|
+
* * `config` - A plain object of Cedarling bootstrap-property names and values.
|
|
556
|
+
*
|
|
557
|
+
* # Example
|
|
558
|
+
*
|
|
559
|
+
* ```javascript
|
|
560
|
+
* await initWasm();
|
|
561
|
+
* const cedarling = await Cedarling.new({
|
|
562
|
+
* CEDARLING_APPLICATION_NAME: "task-api",
|
|
563
|
+
* CEDARLING_POLICY_STORE_URI: "https://example.com/policy-store.cjar",
|
|
564
|
+
* CEDARLING_LOG_TYPE: "memory",
|
|
565
|
+
* CEDARLING_LOG_TTL: 120,
|
|
566
|
+
* });
|
|
567
|
+
* ```
|
|
479
568
|
*/
|
|
480
569
|
static new(config: object): Promise<Cedarling>;
|
|
481
570
|
/**
|
|
482
|
-
*
|
|
483
|
-
*
|
|
571
|
+
* Creates a new Cedarling application from a JavaScript `Map`.
|
|
572
|
+
*
|
|
573
|
+
* # Arguments
|
|
574
|
+
*
|
|
575
|
+
* * `config` - A `Map` of Cedarling bootstrap-property names and values.
|
|
576
|
+
*
|
|
577
|
+
* # Example
|
|
578
|
+
*
|
|
579
|
+
* ```javascript
|
|
580
|
+
* await initWasm();
|
|
581
|
+
* const cedarling = await Cedarling.newFromMap(new Map([
|
|
582
|
+
* ["CEDARLING_APPLICATION_NAME", "task-api"],
|
|
583
|
+
* ["CEDARLING_POLICY_STORE_URI", "https://example.com/policy-store.cjar"],
|
|
584
|
+
* ["CEDARLING_LOG_TYPE", "memory"],
|
|
585
|
+
* ["CEDARLING_LOG_TTL", 120],
|
|
586
|
+
* ]));
|
|
587
|
+
* ```
|
|
484
588
|
*/
|
|
485
|
-
static
|
|
589
|
+
static newFromMap(config: Map<any, any>): Promise<Cedarling>;
|
|
486
590
|
/**
|
|
487
|
-
*
|
|
488
|
-
*
|
|
591
|
+
* Returns all retained memory logs and removes them from storage.
|
|
592
|
+
* Other log configurations return an empty array.
|
|
593
|
+
*
|
|
594
|
+
* # Arguments
|
|
595
|
+
*
|
|
596
|
+
* None.
|
|
597
|
+
*
|
|
598
|
+
* # Example
|
|
599
|
+
*
|
|
600
|
+
* ```javascript
|
|
601
|
+
* const logs = cedarling.popLogs();
|
|
602
|
+
* ```
|
|
489
603
|
*/
|
|
490
|
-
|
|
604
|
+
popLogs(): Array<any>;
|
|
491
605
|
/**
|
|
492
606
|
* Push a value into the data store with an optional TTL.
|
|
493
607
|
* If the key already exists, the value will be replaced.
|
|
@@ -502,11 +616,11 @@ export class Cedarling {
|
|
|
502
616
|
* # Example
|
|
503
617
|
*
|
|
504
618
|
* ```javascript
|
|
505
|
-
* cedarling.
|
|
506
|
-
* cedarling.
|
|
619
|
+
* cedarling.pushDataCtx("user:123", { name: "John", age: 30 }, 3600);
|
|
620
|
+
* cedarling.pushDataCtx("config", { setting: "value" }); // Uses default TTL
|
|
507
621
|
* ```
|
|
508
622
|
*/
|
|
509
|
-
|
|
623
|
+
pushDataCtx(key: string, value: any, ttl_secs?: bigint | null): void;
|
|
510
624
|
/**
|
|
511
625
|
* Remove a value from the data store by key.
|
|
512
626
|
* Returns true if the key existed and was removed, false otherwise.
|
|
@@ -518,27 +632,41 @@ export class Cedarling {
|
|
|
518
632
|
* # Example
|
|
519
633
|
*
|
|
520
634
|
* ```javascript
|
|
521
|
-
* const removed = cedarling.
|
|
635
|
+
* const removed = cedarling.removeDataCtx("user:123");
|
|
522
636
|
* if (removed) {
|
|
523
637
|
* console.log("Entry was successfully removed");
|
|
524
638
|
* }
|
|
525
639
|
* ```
|
|
526
640
|
*/
|
|
527
|
-
|
|
641
|
+
removeDataCtx(key: string): boolean;
|
|
528
642
|
/**
|
|
529
|
-
* Closes
|
|
643
|
+
* Closes Lock Server connections and pushes all available logs.
|
|
644
|
+
*
|
|
645
|
+
* # Arguments
|
|
646
|
+
*
|
|
647
|
+
* None.
|
|
648
|
+
*
|
|
649
|
+
* # Example
|
|
650
|
+
*
|
|
651
|
+
* ```javascript
|
|
652
|
+
* await cedarling.shutDown();
|
|
653
|
+
* ```
|
|
530
654
|
*/
|
|
531
|
-
|
|
655
|
+
shutDown(): Promise<void>;
|
|
532
656
|
/**
|
|
533
657
|
* Get the total number of trusted issuer entries discovered.
|
|
534
658
|
*
|
|
659
|
+
* # Arguments
|
|
660
|
+
*
|
|
661
|
+
* None.
|
|
662
|
+
*
|
|
535
663
|
* # Example
|
|
536
664
|
*
|
|
537
665
|
* ```javascript
|
|
538
|
-
* const total = cedarling.
|
|
666
|
+
* const total = cedarling.totalIssuers();
|
|
539
667
|
* ```
|
|
540
668
|
*/
|
|
541
|
-
|
|
669
|
+
totalIssuers(): number;
|
|
542
670
|
}
|
|
543
671
|
|
|
544
672
|
/**
|
|
@@ -552,7 +680,7 @@ export class DataEntry {
|
|
|
552
680
|
/**
|
|
553
681
|
* Convert `DataEntry` to json string value
|
|
554
682
|
*/
|
|
555
|
-
|
|
683
|
+
jsonString(): string;
|
|
556
684
|
/**
|
|
557
685
|
* Get the value stored in this entry as a JavaScript object
|
|
558
686
|
*/
|
|
@@ -570,11 +698,11 @@ export class DataEntry {
|
|
|
570
698
|
*/
|
|
571
699
|
data_type: string;
|
|
572
700
|
/**
|
|
573
|
-
* Timestamp when this entry expires (RFC 3339 format)
|
|
701
|
+
* Timestamp when this entry expires (RFC 3339 format). The getter returns undefined if no TTL.
|
|
574
702
|
*/
|
|
575
703
|
get expires_at(): string | undefined;
|
|
576
704
|
/**
|
|
577
|
-
* Timestamp when this entry expires (RFC 3339 format)
|
|
705
|
+
* Timestamp when this entry expires (RFC 3339 format). The getter returns undefined if no TTL.
|
|
578
706
|
*/
|
|
579
707
|
set expires_at(value: string | null | undefined);
|
|
580
708
|
/**
|
|
@@ -594,7 +722,7 @@ export class DataStoreStats {
|
|
|
594
722
|
/**
|
|
595
723
|
* Convert `DataStoreStats` to json string value
|
|
596
724
|
*/
|
|
597
|
-
|
|
725
|
+
jsonString(): string;
|
|
598
726
|
/**
|
|
599
727
|
* Average size per entry in bytes (0 if no entries)
|
|
600
728
|
*/
|
|
@@ -696,7 +824,7 @@ export class MultiIssuerAuthorizeResult {
|
|
|
696
824
|
/**
|
|
697
825
|
* Convert `MultiIssuerAuthorizeResult` to json string value
|
|
698
826
|
*/
|
|
699
|
-
|
|
827
|
+
jsonString(): string;
|
|
700
828
|
/**
|
|
701
829
|
* Result of authorization
|
|
702
830
|
* true means `ALLOW`
|
|
@@ -734,8 +862,24 @@ export class PolicyEvaluationError {
|
|
|
734
862
|
}
|
|
735
863
|
|
|
736
864
|
/**
|
|
737
|
-
*
|
|
738
|
-
*
|
|
865
|
+
* Creates a Cedarling application from bootstrap properties.
|
|
866
|
+
*
|
|
867
|
+
* # Arguments
|
|
868
|
+
*
|
|
869
|
+
* * `config` - A JavaScript `Map` or plain object of Cedarling
|
|
870
|
+
* bootstrap-property names and values.
|
|
871
|
+
*
|
|
872
|
+
* # Example
|
|
873
|
+
*
|
|
874
|
+
* ```javascript
|
|
875
|
+
* await initWasm();
|
|
876
|
+
* const cedarling = await init({
|
|
877
|
+
* CEDARLING_APPLICATION_NAME: "task-api",
|
|
878
|
+
* CEDARLING_POLICY_STORE_URI: "https://example.com/policy-store.cjar",
|
|
879
|
+
* CEDARLING_LOG_TYPE: "memory",
|
|
880
|
+
* CEDARLING_LOG_TTL: 120,
|
|
881
|
+
* });
|
|
882
|
+
* ```
|
|
739
883
|
*/
|
|
740
884
|
export function init(config: any): Promise<Cedarling>;
|
|
741
885
|
|
|
@@ -746,17 +890,27 @@ export function init(config: any): Promise<Cedarling>;
|
|
|
746
890
|
* that was fetched with custom logic (e.g., with authentication headers).
|
|
747
891
|
*
|
|
748
892
|
* # Arguments
|
|
749
|
-
* * `config` - Bootstrap configuration (Map or Object)
|
|
893
|
+
* * `config` - Bootstrap configuration (Map or Object) without a policy-store
|
|
894
|
+
* source property. The archive bytes provide the policy store.
|
|
750
895
|
* * `archive_bytes` - The .cjar archive bytes (Uint8Array)
|
|
751
896
|
*
|
|
752
897
|
* # Example
|
|
753
898
|
* ```javascript
|
|
754
|
-
*
|
|
755
|
-
* const
|
|
756
|
-
*
|
|
899
|
+
* await initWasm();
|
|
900
|
+
* const config = {
|
|
901
|
+
* CEDARLING_APPLICATION_NAME: "task-api",
|
|
902
|
+
* CEDARLING_LOG_TYPE: "memory",
|
|
903
|
+
* CEDARLING_LOG_TTL: 120,
|
|
904
|
+
* };
|
|
905
|
+
* const response = await fetch("https://example.com/policy-store.cjar", {
|
|
906
|
+
* headers: { Authorization: "Bearer <token>" },
|
|
907
|
+
* });
|
|
908
|
+
* if (!response.ok) throw new Error("Unable to fetch policy store");
|
|
909
|
+
* const archiveBytes = new Uint8Array(await response.arrayBuffer());
|
|
910
|
+
* const cedarling = await initFromArchiveBytes(config, archiveBytes);
|
|
757
911
|
* ```
|
|
758
912
|
*/
|
|
759
|
-
export function
|
|
913
|
+
export function initFromArchiveBytes(config: any, archive_bytes: Uint8Array): Promise<Cedarling>;
|
|
760
914
|
|
|
761
915
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
762
916
|
|
|
@@ -806,7 +960,7 @@ export interface InitOutput {
|
|
|
806
960
|
readonly __wbg_set_datastorestats_memory_alert_triggered: (a: number, b: number) => void;
|
|
807
961
|
readonly __wbg_set_datastorestats_metrics_enabled: (a: number, b: number) => void;
|
|
808
962
|
readonly __wbg_set_datastorestats_total_size_bytes: (a: number, b: number) => void;
|
|
809
|
-
readonly
|
|
963
|
+
readonly authorizeresult_jsonString: (a: number, b: number) => void;
|
|
810
964
|
readonly authorizeresultresponse_decision: (a: number) => number;
|
|
811
965
|
readonly authorizeresultresponse_diagnostics: (a: number) => number;
|
|
812
966
|
readonly batchauthorizemultiissuerresponse_batch_id: (a: number, b: number) => void;
|
|
@@ -819,42 +973,42 @@ export interface InitOutput {
|
|
|
819
973
|
readonly batchitemmultiissuerresult_is_ok: (a: number) => number;
|
|
820
974
|
readonly batchitemmultiissuerresult_unwrap: (a: number, b: number) => void;
|
|
821
975
|
readonly batchitemunsignedresult_unwrap: (a: number, b: number) => void;
|
|
822
|
-
readonly
|
|
823
|
-
readonly
|
|
824
|
-
readonly
|
|
825
|
-
readonly
|
|
826
|
-
readonly
|
|
827
|
-
readonly
|
|
828
|
-
readonly
|
|
829
|
-
readonly
|
|
830
|
-
readonly
|
|
831
|
-
readonly
|
|
832
|
-
readonly
|
|
833
|
-
readonly
|
|
834
|
-
readonly
|
|
835
|
-
readonly
|
|
836
|
-
readonly
|
|
837
|
-
readonly
|
|
838
|
-
readonly
|
|
839
|
-
readonly
|
|
840
|
-
readonly
|
|
841
|
-
readonly
|
|
842
|
-
readonly
|
|
976
|
+
readonly cedarling_annotationValues: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
977
|
+
readonly cedarling_annotationsByPolicy: (a: number, b: number, c: number, d: number) => void;
|
|
978
|
+
readonly cedarling_annotationsMap: (a: number, b: number, c: number, d: number) => void;
|
|
979
|
+
readonly cedarling_authorizeMultiIssuer: (a: number, b: number, c: number) => number;
|
|
980
|
+
readonly cedarling_authorizeMultiIssuerBatch: (a: number, b: number, c: number) => number;
|
|
981
|
+
readonly cedarling_authorizeUnsigned: (a: number, b: number, c: number) => number;
|
|
982
|
+
readonly cedarling_authorizeUnsignedBatch: (a: number, b: number, c: number) => number;
|
|
983
|
+
readonly cedarling_clearDataCtx: (a: number, b: number) => void;
|
|
984
|
+
readonly cedarling_failedTrustedIssuerIds: (a: number) => number;
|
|
985
|
+
readonly cedarling_getDataCtx: (a: number, b: number, c: number, d: number) => void;
|
|
986
|
+
readonly cedarling_getDataEntryCtx: (a: number, b: number, c: number, d: number) => void;
|
|
987
|
+
readonly cedarling_getLogById: (a: number, b: number, c: number, d: number) => void;
|
|
988
|
+
readonly cedarling_getLogIds: (a: number) => number;
|
|
989
|
+
readonly cedarling_getLogsByRequestId: (a: number, b: number, c: number, d: number) => void;
|
|
990
|
+
readonly cedarling_getLogsByRequestIdAndTag: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
991
|
+
readonly cedarling_getStatsCtx: (a: number, b: number) => void;
|
|
992
|
+
readonly cedarling_isTrustedIssuerLoadedByIss: (a: number, b: number, c: number) => number;
|
|
993
|
+
readonly cedarling_isTrustedIssuerLoadedByName: (a: number, b: number, c: number) => number;
|
|
994
|
+
readonly cedarling_listDataCtx: (a: number, b: number) => void;
|
|
995
|
+
readonly cedarling_loadedTrustedIssuerIds: (a: number) => number;
|
|
996
|
+
readonly cedarling_loadedTrustedIssuersCount: (a: number) => number;
|
|
843
997
|
readonly cedarling_new: (a: number) => number;
|
|
844
|
-
readonly
|
|
845
|
-
readonly
|
|
846
|
-
readonly
|
|
847
|
-
readonly
|
|
848
|
-
readonly
|
|
849
|
-
readonly
|
|
850
|
-
readonly
|
|
998
|
+
readonly cedarling_newFromMap: (a: number) => number;
|
|
999
|
+
readonly cedarling_popLogs: (a: number, b: number) => void;
|
|
1000
|
+
readonly cedarling_pushDataCtx: (a: number, b: number, c: number, d: number, e: number, f: number, g: bigint) => void;
|
|
1001
|
+
readonly cedarling_removeDataCtx: (a: number, b: number, c: number, d: number) => void;
|
|
1002
|
+
readonly cedarling_shutDown: (a: number) => number;
|
|
1003
|
+
readonly cedarling_totalIssuers: (a: number) => number;
|
|
1004
|
+
readonly dataentry_jsonString: (a: number, b: number) => void;
|
|
851
1005
|
readonly dataentry_value: (a: number, b: number) => void;
|
|
852
|
-
readonly
|
|
1006
|
+
readonly datastorestats_jsonString: (a: number, b: number) => void;
|
|
853
1007
|
readonly diagnostics_errors: (a: number, b: number) => void;
|
|
854
1008
|
readonly diagnostics_reason: (a: number, b: number) => void;
|
|
855
1009
|
readonly init: (a: number) => number;
|
|
856
|
-
readonly
|
|
857
|
-
readonly
|
|
1010
|
+
readonly initFromArchiveBytes: (a: number, b: number) => number;
|
|
1011
|
+
readonly multiissuerauthorizeresult_jsonString: (a: number, b: number) => void;
|
|
858
1012
|
readonly policyevaluationerror_error: (a: number, b: number) => void;
|
|
859
1013
|
readonly policyevaluationerror_id: (a: number, b: number) => void;
|
|
860
1014
|
readonly __wbg_intounderlyingbytesource_free: (a: number, b: number) => void;
|
|
@@ -890,11 +1044,11 @@ export interface InitOutput {
|
|
|
890
1044
|
readonly batchitemunsignedresult_is_ok: (a: number) => number;
|
|
891
1045
|
readonly batchitemunsignedresult_error: (a: number) => number;
|
|
892
1046
|
readonly batchauthorizeunsignedresponse_batch_id: (a: number, b: number) => void;
|
|
893
|
-
readonly
|
|
894
|
-
readonly
|
|
895
|
-
readonly
|
|
896
|
-
readonly
|
|
897
|
-
readonly
|
|
1047
|
+
readonly cedarling_getLogsByTag: (a: number, b: number, c: number, d: number) => void;
|
|
1048
|
+
readonly __wasm_bindgen_func_elem_8902: (a: number, b: number, c: number, d: number) => void;
|
|
1049
|
+
readonly __wasm_bindgen_func_elem_8968: (a: number, b: number, c: number, d: number) => void;
|
|
1050
|
+
readonly __wasm_bindgen_func_elem_12454: (a: number, b: number, c: number) => void;
|
|
1051
|
+
readonly __wasm_bindgen_func_elem_8737: (a: number, b: number) => void;
|
|
898
1052
|
readonly __wbindgen_export: (a: number, b: number) => number;
|
|
899
1053
|
readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
900
1054
|
readonly __wbindgen_export3: (a: number) => void;
|