Pre-release — The API surface may change. Unaudited.
Callcium LogoCallcium
API

PolicyCoder

Encode and decode binary policies.

PolicyCoder

Encode, decode, and inspect policies in the canonical binary format.

Git Source

Methods

encode

Encode a PolicyData structure into the canonical binary format.

function encode(data: PolicyData): `0x${string}`;

Parameters

NameTypeDescription
dataPolicyDataThe 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

NameTypeDescription
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

NameTypeDescription
blob`0x${string}`Binary policy as 0x-prefixed hex string.

Returns

DecodedPolicy — The inspected policy with per-field spans for every structural element.

On this page