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): templateLiteral;

Parameters

NameTypeDescription
dataPolicyDataThe policy data to encode.

Returns

templateLiteral — The encoded policy as a 0x-prefixed hex string.

decode

Decode a binary policy blob into a PolicyData structure.

function decode(blob: templateLiteral): PolicyData;

Parameters

NameTypeDescription
blobtemplateLiteralBinary 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: templateLiteral): DecodedPolicy;

Parameters

NameTypeDescription
blobtemplateLiteralBinary policy as 0x-prefixed hex string.

Returns

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

Functions

parsePathSteps

Parse a BE16-encoded hex path into an array of step values.

Git Source

function parsePathSteps(path: templateLiteral): number[];

Parameters

NameTypeDescription
pathtemplateLiteral0x-prefixed hex string containing BE16-encoded path steps.

Returns

number[] — Array of numeric step values.

On this page