API
PolicyCoder
Encode and decode binary policies.
PolicyCoder
Encode, decode, and inspect policies in the canonical binary format.
Methods
encode
Encode a PolicyData structure into the canonical binary format.
function encode(data: PolicyData): `0x${string}`;Parameters
| Name | Type | Description |
|---|---|---|
data | PolicyData | The policy data to encode. |
Returns
`0x${string}` — The encoded policy as a 0x-prefixed hex string.
decode
Decode a binary policy blob into a PolicyData structure.
function decode(blob: `0x${string}`): PolicyData;Parameters
| Name | Type | Description |
|---|---|---|
blob | `0x${string}` | Binary policy as 0x-prefixed hex string. |
Returns
PolicyData — The decoded policy data with constraints grouped by scope and path.
inspect
Inspect a binary policy blob, returning the structural representation with full byte-level spans.
function inspect(blob: `0x${string}`): DecodedPolicy;Parameters
| Name | Type | Description |
|---|---|---|
blob | `0x${string}` | Binary policy as 0x-prefixed hex string. |
Returns
DecodedPolicy — The inspected policy with per-field spans for every structural element.