@o3co/auth.policy-verifier.cedar-wasm 0.12.0 → 0.13.0
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 +30 -0
- package/dist/wasmEngine.d.mts.map +1 -1
- package/dist/wasmEngine.mjs +5 -0
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# @o3co/auth.policy-verifier.cedar-wasm
|
|
2
2
|
|
|
3
|
+
Last updated: 2026-09-23
|
|
4
|
+
|
|
3
5
|
The in-process Cedar engine for
|
|
4
6
|
[`@o3co/auth.policy-verifier.cedar`](../cedar/README.md): the official
|
|
5
7
|
[`@cedar-policy/cedar-wasm`](https://www.npmjs.com/package/@cedar-policy/cedar-wasm)
|
|
@@ -25,6 +27,34 @@ cannot have come from any other policies. It is the engine
|
|
|
25
27
|
`requireConfirmedRevision = true` boots over; see cedar's [Policy
|
|
26
28
|
revision](../cedar/README.md#policy-revision-which-policies-decided).
|
|
27
29
|
|
|
30
|
+
## Responsibility
|
|
31
|
+
|
|
32
|
+
**Role.** One engine behind cedar's `CedarEngine` port
|
|
33
|
+
([`engine.mts`](../cedar/src/engine.mts)). It depends on
|
|
34
|
+
`@o3co/auth.policy-verifier.cedar` and on `@cedar-policy/cedar-wasm`. No
|
|
35
|
+
package in this repository depends on it (only the integration tests do); a
|
|
36
|
+
deployment imports it.
|
|
37
|
+
|
|
38
|
+
**Owns** ([`src/wasmEngine.mts`](src/wasmEngine.mts)):
|
|
39
|
+
|
|
40
|
+
- Parse-checking each policy file at boot, so a syntax error names its file,
|
|
41
|
+
and compiling the set once into wasm memory under an id minted per load.
|
|
42
|
+
- Evaluating each request against that compiled set, synchronously, and
|
|
43
|
+
rendering the bindings' answer as a `CedarDecision`.
|
|
44
|
+
- Naming the revision of the source it compiled on every answer.
|
|
45
|
+
- The exact version of `@cedar-policy/cedar-wasm`.
|
|
46
|
+
- Registering itself as `"wasm"` when imported
|
|
47
|
+
([`src/index.mts`](src/index.mts)).
|
|
48
|
+
|
|
49
|
+
**Does not own.** Policy loading, the policy revision itself, the
|
|
50
|
+
attribute-to-request mapping, what an answer means (the answer table,
|
|
51
|
+
`onNoDeterminingPolicy`, the revision check) and which engine is selected. All
|
|
52
|
+
of that is cedar's, and is identical whichever engine runs.
|
|
53
|
+
|
|
54
|
+
**Why a separate package.** The cost below: about 12 MB of wasm instantiated
|
|
55
|
+
on import. Kept out of cedar, it is carried only by a deployment that
|
|
56
|
+
evaluates in-process; one that runs cedar's `http` engine never loads it.
|
|
57
|
+
|
|
28
58
|
## What it costs, and when to choose it
|
|
29
59
|
|
|
30
60
|
The policy set is compiled once, at boot, into wasm memory; each request
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wasmEngine.d.mts","sourceRoot":"","sources":["../src/wasmEngine.mts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"wasmEngine.d.mts","sourceRoot":"","sources":["../src/wasmEngine.mts"],"names":[],"mappings":"AAeA,OAAO,EAEN,KAAK,WAAW,EAGhB,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,MAAM,kCAAkC,CAAC;AAE1C,kFAAkF;AAClF,eAAO,MAAM,sBAAsB,EAAG,MAAe,CAAC;AAEtD,oFAAoF;AACpF,MAAM,WAAW,eAAgB,SAAQ,WAAW;IACnD,QAAQ,CAAC,IAAI,EAAE,OAAO,sBAAsB,CAAC;IAC7C,IAAI,CAAC,MAAM,EAAE,YAAY,GAAG,kBAAkB,CAAC;CAC/C;AAKD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,eAAe,EAAE,eA0C7B,CAAC"}
|
package/dist/wasmEngine.mjs
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: 2026 1o1 Co. Ltd.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
/*
|
|
4
|
+
* The `wasm` engine: evaluates the policy set in process through the official
|
|
5
|
+
* `@cedar-policy/cedar-wasm` bindings, compiling it once at load and answering
|
|
6
|
+
* synchronously. The package index registers it.
|
|
7
|
+
*/
|
|
3
8
|
import { checkParsePolicySet, preparsePolicySet, statefulIsAuthorized, } from "@cedar-policy/cedar-wasm/nodejs";
|
|
4
9
|
import { CedarEngineError, } from "@o3co/auth.policy-verifier.cedar";
|
|
5
10
|
/** The name this engine registers under, and the config value that selects it. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@o3co/auth.policy-verifier.cedar-wasm",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -25,14 +25,14 @@
|
|
|
25
25
|
"directory": "packages/cedar-wasm"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@cedar-policy/cedar-wasm": "4.
|
|
29
|
-
"@o3co/auth.policy-verifier.cedar": "0.
|
|
28
|
+
"@cedar-policy/cedar-wasm": "4.13.0",
|
|
29
|
+
"@o3co/auth.policy-verifier.cedar": "0.13.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@types/node": "^26.
|
|
33
|
-
"@vitest/coverage-v8": "^5.0.
|
|
34
|
-
"vitest": "^5.0.
|
|
35
|
-
"@o3co/auth.policy-verifier.core": "0.
|
|
32
|
+
"@types/node": "^26.6.2",
|
|
33
|
+
"@vitest/coverage-v8": "^5.0.1",
|
|
34
|
+
"vitest": "^5.0.1",
|
|
35
|
+
"@o3co/auth.policy-verifier.core": "0.13.0"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
38
|
"prebuild": "rimraf dist",
|