@janssenproject/cedarling_wasm 0.0.404 → 0.0.405
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 +10 -3
- package/cedarling_wasm.d.ts +82 -68
- package/cedarling_wasm.js +782 -592
- package/cedarling_wasm_bg.wasm +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -53,7 +53,9 @@ async function main() {
|
|
|
53
53
|
await initWasm(); // Initialize the WebAssembly module
|
|
54
54
|
|
|
55
55
|
let instance = await init(BOOTSTRAP_CONFIG);
|
|
56
|
-
|
|
56
|
+
// authorize calls take the request as a JSON string: it crosses the
|
|
57
|
+
// JS/WASM boundary as one string copy parsed by serde_json
|
|
58
|
+
let result = await instance.authorize_unsigned(JSON.stringify(REQUEST_UNSIGNED));
|
|
57
59
|
console.log("result:", result);
|
|
58
60
|
}
|
|
59
61
|
main().catch(console.error);
|
|
@@ -110,12 +112,13 @@ export class Cedarling {
|
|
|
110
112
|
* residual-dependent requests fail closed with `Decision::Deny` and surface
|
|
111
113
|
* residual policy ids in `response.diagnostics.reason`.
|
|
112
114
|
*/
|
|
113
|
-
authorize_unsigned(request:
|
|
115
|
+
authorize_unsigned(request: string): Promise<AuthorizeResult>;
|
|
114
116
|
/**
|
|
115
117
|
* Authorize multi-issuer request.
|
|
116
118
|
* Makes authorization decision based on multiple JWT tokens from different issuers
|
|
119
|
+
* The request is passed as a JSON string.
|
|
117
120
|
*/
|
|
118
|
-
authorize_multi_issuer(request:
|
|
121
|
+
authorize_multi_issuer(request: string): Promise<MultiIssuerAuthorizeResult>;
|
|
119
122
|
/**
|
|
120
123
|
* Get logs and remove them from the storage.
|
|
121
124
|
* Returns `Array` of `Map`
|
|
@@ -418,6 +421,10 @@ Cedarling supports multiple ways to load policy stores. **In WASM environments,
|
|
|
418
421
|
// Option 1: Fetch policy store from URL (simple)
|
|
419
422
|
const BOOTSTRAP_CONFIG = {
|
|
420
423
|
CEDARLING_POLICY_STORE_URI: "https://example.com/policy-store.cjar",
|
|
424
|
+
// Optional: re-fetch every 60s and atomically swap on change.
|
|
425
|
+
// Default is 0 (load-once-at-startup). See "Refreshing the policy store"
|
|
426
|
+
// in docs/cedarling/reference/cedarling-properties.md for details.
|
|
427
|
+
CEDARLING_POLICY_STORE_REFRESH_INTERVAL: 60,
|
|
421
428
|
// ... other config
|
|
422
429
|
};
|
|
423
430
|
const cedarling = await init(BOOTSTRAP_CONFIG);
|
package/cedarling_wasm.d.ts
CHANGED
|
@@ -65,9 +65,19 @@ export class Cedarling {
|
|
|
65
65
|
[Symbol.dispose](): void;
|
|
66
66
|
/**
|
|
67
67
|
* Authorize multi-issuer request.
|
|
68
|
-
* Makes authorization decision based on multiple JWT tokens from different issuers
|
|
68
|
+
* Makes authorization decision based on multiple JWT tokens from different issuers.
|
|
69
|
+
*
|
|
70
|
+
* # Arguments
|
|
71
|
+
*
|
|
72
|
+
* * `request` - JSON string representation of [`AuthorizeMultiIssuerRequest`].
|
|
73
|
+
*
|
|
74
|
+
* # Example
|
|
75
|
+
*
|
|
76
|
+
* ```javascript
|
|
77
|
+
* const result = await cedarling.authorize_multi_issuer(JSON.stringify(request));
|
|
78
|
+
* ```
|
|
69
79
|
*/
|
|
70
|
-
authorize_multi_issuer(request:
|
|
80
|
+
authorize_multi_issuer(request: string): Promise<MultiIssuerAuthorizeResult>;
|
|
71
81
|
/**
|
|
72
82
|
* Authorize an unsigned request carrying an optional single principal.
|
|
73
83
|
* Makes an authorization decision based on the [`RequestUnsigned`].
|
|
@@ -76,8 +86,18 @@ export class Cedarling {
|
|
|
76
86
|
* partial evaluation; residual-dependent requests fail closed with
|
|
77
87
|
* `Decision::Deny` and surface residual policy ids in
|
|
78
88
|
* `response.diagnostics.reason`.
|
|
89
|
+
*
|
|
90
|
+
* # Arguments
|
|
91
|
+
*
|
|
92
|
+
* * `request` - JSON string representation of [`RequestUnsigned`].
|
|
93
|
+
*
|
|
94
|
+
* # Example
|
|
95
|
+
*
|
|
96
|
+
* ```javascript
|
|
97
|
+
* const result = await cedarling.authorize_unsigned(JSON.stringify(request));
|
|
98
|
+
* ```
|
|
79
99
|
*/
|
|
80
|
-
authorize_unsigned(request:
|
|
100
|
+
authorize_unsigned(request: string): Promise<AuthorizeResult>;
|
|
81
101
|
/**
|
|
82
102
|
* Clear all entries from the data store.
|
|
83
103
|
*
|
|
@@ -536,13 +556,13 @@ export interface InitOutput {
|
|
|
536
556
|
readonly __wbg_datastorestats_free: (a: number, b: number) => void;
|
|
537
557
|
readonly __wbg_diagnostics_free: (a: number, b: number) => void;
|
|
538
558
|
readonly __wbg_get_authorizeresult_decision: (a: number) => number;
|
|
539
|
-
readonly __wbg_get_authorizeresult_request_id: (a: number) =>
|
|
559
|
+
readonly __wbg_get_authorizeresult_request_id: (a: number, b: number) => void;
|
|
540
560
|
readonly __wbg_get_authorizeresult_response: (a: number) => number;
|
|
541
561
|
readonly __wbg_get_dataentry_access_count: (a: number) => bigint;
|
|
542
|
-
readonly __wbg_get_dataentry_created_at: (a: number) =>
|
|
543
|
-
readonly __wbg_get_dataentry_data_type: (a: number) =>
|
|
544
|
-
readonly __wbg_get_dataentry_expires_at: (a: number) =>
|
|
545
|
-
readonly __wbg_get_dataentry_key: (a: number) =>
|
|
562
|
+
readonly __wbg_get_dataentry_created_at: (a: number, b: number) => void;
|
|
563
|
+
readonly __wbg_get_dataentry_data_type: (a: number, b: number) => void;
|
|
564
|
+
readonly __wbg_get_dataentry_expires_at: (a: number, b: number) => void;
|
|
565
|
+
readonly __wbg_get_dataentry_key: (a: number, b: number) => void;
|
|
546
566
|
readonly __wbg_get_datastorestats_avg_entry_size_bytes: (a: number) => number;
|
|
547
567
|
readonly __wbg_get_datastorestats_capacity_usage_percent: (a: number) => number;
|
|
548
568
|
readonly __wbg_get_datastorestats_entry_count: (a: number) => number;
|
|
@@ -570,63 +590,55 @@ export interface InitOutput {
|
|
|
570
590
|
readonly __wbg_set_datastorestats_memory_alert_triggered: (a: number, b: number) => void;
|
|
571
591
|
readonly __wbg_set_datastorestats_metrics_enabled: (a: number, b: number) => void;
|
|
572
592
|
readonly __wbg_set_datastorestats_total_size_bytes: (a: number, b: number) => void;
|
|
573
|
-
readonly authorizeresult_json_string: (a: number) =>
|
|
593
|
+
readonly authorizeresult_json_string: (a: number, b: number) => void;
|
|
574
594
|
readonly authorizeresultresponse_decision: (a: number) => number;
|
|
575
595
|
readonly authorizeresultresponse_diagnostics: (a: number) => number;
|
|
576
|
-
readonly cedarling_authorize_multi_issuer: (a: number, b:
|
|
577
|
-
readonly cedarling_authorize_unsigned: (a: number, b:
|
|
578
|
-
readonly cedarling_clear_data_ctx: (a: number) =>
|
|
579
|
-
readonly cedarling_failed_trusted_issuer_ids: (a: number) =>
|
|
580
|
-
readonly cedarling_get_data_ctx: (a: number, b: number, c: number
|
|
581
|
-
readonly cedarling_get_data_entry_ctx: (a: number, b: number, c: number
|
|
582
|
-
readonly cedarling_get_log_by_id: (a: number, b: number, c: number
|
|
583
|
-
readonly cedarling_get_log_ids: (a: number) =>
|
|
584
|
-
readonly cedarling_get_logs_by_request_id: (a: number, b: number, c: number
|
|
585
|
-
readonly cedarling_get_logs_by_request_id_and_tag: (a: number, b: number, c: number, d: number, e: number
|
|
586
|
-
readonly
|
|
587
|
-
readonly cedarling_get_stats_ctx: (a: number) => [number, number, number];
|
|
596
|
+
readonly cedarling_authorize_multi_issuer: (a: number, b: number, c: number) => number;
|
|
597
|
+
readonly cedarling_authorize_unsigned: (a: number, b: number, c: number) => number;
|
|
598
|
+
readonly cedarling_clear_data_ctx: (a: number, b: number) => void;
|
|
599
|
+
readonly cedarling_failed_trusted_issuer_ids: (a: number) => number;
|
|
600
|
+
readonly cedarling_get_data_ctx: (a: number, b: number, c: number, d: number) => void;
|
|
601
|
+
readonly cedarling_get_data_entry_ctx: (a: number, b: number, c: number, d: number) => void;
|
|
602
|
+
readonly cedarling_get_log_by_id: (a: number, b: number, c: number, d: number) => void;
|
|
603
|
+
readonly cedarling_get_log_ids: (a: number) => number;
|
|
604
|
+
readonly cedarling_get_logs_by_request_id: (a: number, b: number, c: number, d: number) => void;
|
|
605
|
+
readonly cedarling_get_logs_by_request_id_and_tag: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
606
|
+
readonly cedarling_get_stats_ctx: (a: number, b: number) => void;
|
|
588
607
|
readonly cedarling_is_trusted_issuer_loaded_by_iss: (a: number, b: number, c: number) => number;
|
|
589
608
|
readonly cedarling_is_trusted_issuer_loaded_by_name: (a: number, b: number, c: number) => number;
|
|
590
|
-
readonly cedarling_list_data_ctx: (a: number
|
|
591
|
-
readonly cedarling_loaded_trusted_issuer_ids: (a: number) =>
|
|
609
|
+
readonly cedarling_list_data_ctx: (a: number, b: number) => void;
|
|
610
|
+
readonly cedarling_loaded_trusted_issuer_ids: (a: number) => number;
|
|
592
611
|
readonly cedarling_loaded_trusted_issuers_count: (a: number) => number;
|
|
593
|
-
readonly cedarling_new: (a:
|
|
594
|
-
readonly cedarling_new_from_map: (a:
|
|
595
|
-
readonly cedarling_pop_logs: (a: number
|
|
596
|
-
readonly cedarling_push_data_ctx: (a: number, b: number, c: number, d:
|
|
597
|
-
readonly cedarling_remove_data_ctx: (a: number, b: number, c: number
|
|
598
|
-
readonly cedarling_shut_down: (a: number) =>
|
|
612
|
+
readonly cedarling_new: (a: number) => number;
|
|
613
|
+
readonly cedarling_new_from_map: (a: number) => number;
|
|
614
|
+
readonly cedarling_pop_logs: (a: number, b: number) => void;
|
|
615
|
+
readonly cedarling_push_data_ctx: (a: number, b: number, c: number, d: number, e: number, f: number, g: bigint) => void;
|
|
616
|
+
readonly cedarling_remove_data_ctx: (a: number, b: number, c: number, d: number) => void;
|
|
617
|
+
readonly cedarling_shut_down: (a: number) => number;
|
|
599
618
|
readonly cedarling_total_issuers: (a: number) => number;
|
|
600
|
-
readonly dataentry_json_string: (a: number) =>
|
|
601
|
-
readonly dataentry_value: (a: number
|
|
602
|
-
readonly datastorestats_json_string: (a: number) =>
|
|
603
|
-
readonly diagnostics_errors: (a: number) =>
|
|
604
|
-
readonly diagnostics_reason: (a: number) =>
|
|
605
|
-
readonly init: (a:
|
|
606
|
-
readonly init_from_archive_bytes: (a:
|
|
607
|
-
readonly multiissuerauthorizeresult_json_string: (a: number) =>
|
|
608
|
-
readonly policyevaluationerror_error: (a: number) =>
|
|
609
|
-
readonly policyevaluationerror_id: (a: number) =>
|
|
610
|
-
readonly __wbg_get_multiissuerauthorizeresult_decision: (a: number) => number;
|
|
611
|
-
readonly __wbg_set_multiissuerauthorizeresult_response: (a: number, b: number) => void;
|
|
612
|
-
readonly __wbg_set_multiissuerauthorizeresult_request_id: (a: number, b: number, c: number) => void;
|
|
613
|
-
readonly __wbg_set_multiissuerauthorizeresult_decision: (a: number, b: number) => void;
|
|
614
|
-
readonly __wbg_get_multiissuerauthorizeresult_response: (a: number) => number;
|
|
615
|
-
readonly __wbg_get_multiissuerauthorizeresult_request_id: (a: number) => [number, number];
|
|
616
|
-
readonly __wbg_multiissuerauthorizeresult_free: (a: number, b: number) => void;
|
|
619
|
+
readonly dataentry_json_string: (a: number, b: number) => void;
|
|
620
|
+
readonly dataentry_value: (a: number, b: number) => void;
|
|
621
|
+
readonly datastorestats_json_string: (a: number, b: number) => void;
|
|
622
|
+
readonly diagnostics_errors: (a: number, b: number) => void;
|
|
623
|
+
readonly diagnostics_reason: (a: number, b: number) => void;
|
|
624
|
+
readonly init: (a: number) => number;
|
|
625
|
+
readonly init_from_archive_bytes: (a: number, b: number) => number;
|
|
626
|
+
readonly multiissuerauthorizeresult_json_string: (a: number, b: number) => void;
|
|
627
|
+
readonly policyevaluationerror_error: (a: number, b: number) => void;
|
|
628
|
+
readonly policyevaluationerror_id: (a: number, b: number) => void;
|
|
617
629
|
readonly __wbg_intounderlyingbytesource_free: (a: number, b: number) => void;
|
|
618
630
|
readonly __wbg_intounderlyingsink_free: (a: number, b: number) => void;
|
|
619
631
|
readonly __wbg_intounderlyingsource_free: (a: number, b: number) => void;
|
|
620
632
|
readonly intounderlyingbytesource_autoAllocateChunkSize: (a: number) => number;
|
|
621
633
|
readonly intounderlyingbytesource_cancel: (a: number) => void;
|
|
622
|
-
readonly intounderlyingbytesource_pull: (a: number, b:
|
|
623
|
-
readonly intounderlyingbytesource_start: (a: number, b:
|
|
634
|
+
readonly intounderlyingbytesource_pull: (a: number, b: number) => number;
|
|
635
|
+
readonly intounderlyingbytesource_start: (a: number, b: number) => void;
|
|
624
636
|
readonly intounderlyingbytesource_type: (a: number) => number;
|
|
625
|
-
readonly intounderlyingsink_abort: (a: number, b:
|
|
626
|
-
readonly intounderlyingsink_close: (a: number) =>
|
|
627
|
-
readonly intounderlyingsink_write: (a: number, b:
|
|
637
|
+
readonly intounderlyingsink_abort: (a: number, b: number) => number;
|
|
638
|
+
readonly intounderlyingsink_close: (a: number) => number;
|
|
639
|
+
readonly intounderlyingsink_write: (a: number, b: number) => number;
|
|
628
640
|
readonly intounderlyingsource_cancel: (a: number) => void;
|
|
629
|
-
readonly intounderlyingsource_pull: (a: number, b:
|
|
641
|
+
readonly intounderlyingsource_pull: (a: number, b: number) => number;
|
|
630
642
|
readonly rust_zstd_wasm_shim_calloc: (a: number, b: number) => number;
|
|
631
643
|
readonly rust_zstd_wasm_shim_free: (a: number) => void;
|
|
632
644
|
readonly rust_zstd_wasm_shim_malloc: (a: number) => number;
|
|
@@ -635,22 +647,24 @@ export interface InitOutput {
|
|
|
635
647
|
readonly rust_zstd_wasm_shim_memmove: (a: number, b: number, c: number) => number;
|
|
636
648
|
readonly rust_zstd_wasm_shim_memset: (a: number, b: number, c: number) => number;
|
|
637
649
|
readonly rust_zstd_wasm_shim_qsort: (a: number, b: number, c: number, d: number) => void;
|
|
638
|
-
readonly
|
|
639
|
-
readonly
|
|
640
|
-
readonly
|
|
641
|
-
readonly
|
|
642
|
-
readonly
|
|
643
|
-
readonly
|
|
644
|
-
readonly
|
|
645
|
-
readonly
|
|
646
|
-
readonly
|
|
647
|
-
readonly
|
|
648
|
-
readonly
|
|
649
|
-
readonly
|
|
650
|
-
readonly
|
|
651
|
-
readonly
|
|
652
|
-
readonly
|
|
653
|
-
readonly
|
|
650
|
+
readonly __wbg_get_multiissuerauthorizeresult_decision: (a: number) => number;
|
|
651
|
+
readonly __wbg_set_multiissuerauthorizeresult_response: (a: number, b: number) => void;
|
|
652
|
+
readonly __wbg_set_multiissuerauthorizeresult_request_id: (a: number, b: number, c: number) => void;
|
|
653
|
+
readonly __wbg_set_multiissuerauthorizeresult_decision: (a: number, b: number) => void;
|
|
654
|
+
readonly __wbg_get_multiissuerauthorizeresult_response: (a: number) => number;
|
|
655
|
+
readonly __wbg_get_multiissuerauthorizeresult_request_id: (a: number, b: number) => void;
|
|
656
|
+
readonly __wbg_multiissuerauthorizeresult_free: (a: number, b: number) => void;
|
|
657
|
+
readonly cedarling_get_logs_by_tag: (a: number, b: number, c: number, d: number) => void;
|
|
658
|
+
readonly __wasm_bindgen_func_elem_8728: (a: number, b: number, c: number, d: number) => void;
|
|
659
|
+
readonly __wasm_bindgen_func_elem_8782: (a: number, b: number, c: number, d: number) => void;
|
|
660
|
+
readonly __wasm_bindgen_func_elem_12191: (a: number, b: number, c: number) => void;
|
|
661
|
+
readonly __wasm_bindgen_func_elem_8563: (a: number, b: number) => void;
|
|
662
|
+
readonly __wbindgen_export: (a: number, b: number) => number;
|
|
663
|
+
readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
664
|
+
readonly __wbindgen_export3: (a: number) => void;
|
|
665
|
+
readonly __wbindgen_export4: (a: number, b: number) => void;
|
|
666
|
+
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
667
|
+
readonly __wbindgen_export5: (a: number, b: number, c: number) => void;
|
|
654
668
|
}
|
|
655
669
|
|
|
656
670
|
export type SyncInitInput = BufferSource | WebAssembly.Module;
|