@janssenproject/cedarling_wasm 0.0.404-nodejs → 0.0.405-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 +10 -3
- package/cedarling_wasm.d.ts +23 -3
- 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
|
*
|