import type { CesrBody, CesrMessage, Smellage } from "../core/types.js"; import { Aggor } from "../primitives/aggor.js"; import { Blinder } from "../primitives/blinder.js"; import { Diger } from "../primitives/diger.js"; import { Mediar } from "../primitives/mediar.js"; import { NumberPrimitive } from "../primitives/number.js"; import { type CounterGroupLike } from "../primitives/primitive.js"; import { Sealer } from "../primitives/sealer.js"; import { SealEvent, type SealRecord } from "../primitives/structing.js"; import { Tholder } from "../primitives/tholder.js"; import { Verfer } from "../primitives/verfer.js"; import { type CounterCodex } from "../tables/counter-version-registry.js"; import type { Versionage } from "../tables/table-types.js"; import { type Kind } from "../tables/versions.js"; import type { Protocol } from "../tables/versions.js"; type SadMap = Record; type SaidCodeMap = Record; interface FieldDom { alls: SadMap; opts?: SadMap; alts?: Record; saids?: SaidCodeMap; strict?: boolean; } type FieldMap = Record; type ProtocolFieldMap = Record; type FieldRegistry = Record; /** * Serialize one KERI/ACDC body using the requested wire kind. * * Mirrors KERIpy's `dumps()` helper: this is a format utility, not a `Serder` * instance method, so upper layers can size or saidify SADs before they have a * body object. */ export declare function dumps(ked: Record | unknown[], kind: Kind): Uint8Array; /** * Measure one versioned SAD and rewrite its embedded version string size. * * Mirrors KERIpy's `sizeify()` utility closely enough for local parity work: * callers provide a mutable SAD carrying a `v` field, optionally override the * serialization kind, and receive the updated raw bytes plus parsed version * metadata. */ export declare function sizeify(ked: Record, kind?: Kind): { raw: Uint8Array; proto: Smellage["proto"]; kind: Kind; ked: Record; pvrsn: Smellage["pvrsn"]; gvrsn: Smellage["gvrsn"]; }; interface SerderHydratedInit { raw: Uint8Array; smellage: Smellage; ked: SadMap | null; ilk: string | null; said: string | null; } /** Constructor variant for hydrating a serder directly from raw encoded bytes. */ export interface SerderRawInit { raw: Uint8Array; smellage?: Smellage; verify?: boolean; } /** Constructor variant for building or normalizing a serder from semantic SAD input. */ export interface SerderSadInit { sad?: SadMap; makify?: boolean; verify?: boolean; proto?: Protocol; pvrsn?: Versionage; gvrsn?: Versionage | null; kind?: Kind; ilk?: string | null; saids?: SaidCodeMap; compactify?: boolean; } /** Union of all supported serder construction modes. */ export type SerderInit = SerderHydratedInit | SerderRawInit | SerderSadInit; /** * Structured projection of parsed attachment counter-groups into structor families. * * `other` captures counted groups that are intentionally not one of the known * structor families (`Aggor`, `Sealer`, `Blinder`, `Mediar`). * * Boundary reminder: * - these are transport-family projections * - fixed-field semantics for seal/blind/media records live separately in * `structing.ts` and `disclosure.ts` */ export interface SerderStructorProjection { aggor: Aggor[]; sealer: Sealer[]; blinder: Blinder[]; mediar: Mediar[]; other: CounterGroupLike[]; } /** * Base Serder body class. * * KERIpy substance: Serders own both halves of the message-body contract: * serialization (`sad` -> `raw`) and deserialization (`raw` -> `sad`) plus * verification of saidive fields against the serialized body bytes. */ export declare class Serder implements CesrBody { static readonly Protocol: Protocol | null; static readonly Proto: Protocol; static readonly PVrsn: Versionage; static readonly GVrsn: Versionage | null; static readonly Kind: Kind; static readonly Fields: FieldRegistry; readonly raw: Uint8Array; readonly kind: CesrBody["kind"]; readonly size: number; readonly proto: CesrBody["proto"]; readonly pvrsn: CesrBody["pvrsn"]; readonly gvrsn: CesrBody["gvrsn"]; readonly ilk: string | null; readonly native?: CesrBody["native"]; protected readonly _ked: SadMap | null; protected readonly _said: string | null; constructor(init?: SerderInit); get ked(): SadMap | null; get sad(): SadMap | null; get verstr(): string | null; /** CESR message-universal genus code backing this serder's native framing. */ get genus(): string; get protocol(): Protocol; /** * Message-universal counter codex selected by the serder's genus version. * * This mirrors KERIpy's `serder.mucodes`: native body-group parsing and emit * use the latest compatible counter table for the active genus major/minor. * Non-native legacy messages without `gvrsn` do not have a meaningful * message-universal codex, so this accessor rejects that misuse explicitly. */ get mucodes(): CounterCodex; get said(): string | null; get saidb(): Uint8Array | null; get stamp(): string | null; /** True when this body belongs to KERI protocol domain. */ get isKeri(): boolean; /** True when this body belongs to ACDC protocol domain. */ get isAcdc(): boolean; verify(): boolean; protected _verify(): void; compare(said?: string | Uint8Array): boolean; pretty(opts?: { size?: number; }): string; /** * Project counted attachment groups into structor subclasses. * * This keeps Serder + attachment processing cohesive for consumers that * immediately need typed structor families after frame parsing. */ projectStructors(message: Pick): SerderStructorProjection; } /** KERI-protocol Serder subtype (`proto=KERI`). */ export declare class SerderKERI extends Serder { static readonly Protocol: Protocol; static readonly Proto: Protocol; constructor(init?: SerderInit); protected _verify(): void; get estive(): boolean; get pre(): string | null; get preb(): Uint8Array | null; get sner(): NumberPrimitive | null; get sn(): number | null; get snh(): string | null; /** * Raw top-level `a` field from the decoded KERI SAD. * * Do not assume this is always a seal list. KERI reuses `a` for multiple * semantic roles, which is why typed seal projection is exposed separately. */ get a(): unknown; /** * Raw KERI `a` list as decoded from the SAD. * * This accessor intentionally stays raw for KERIpy parity. The same label `a` * is used in KERI for more than one semantic purpose, so eager typing here * would conflate raw SAD decoding with higher-level interpretation. */ get seals(): unknown[]; /** * Typed seal projection built from raw KERI `a` SAD entries. * * Boundary rule: * - `seals` stays raw and untyped for KERIpy parity * - `sealRecords` is the explicit semantic projection and therefore rejects * malformed or unknown seal dictionaries instead of silently skipping them */ get sealRecords(): SealRecord[]; /** * Narrow `sealRecords` to event-style seals used for anchoring and delegation. * * Use this when the caller needs semantic seal fields (`i`, `s`, `d`) instead * of raw `a` dictionaries. */ get eventSeals(): SealEvent[]; get traits(): string[]; get tholder(): Tholder | null; get keys(): string[]; get verfers(): Verfer[]; get ndigs(): string[]; get ntholder(): Tholder | null; get ndigers(): Diger[]; get bner(): NumberPrimitive | null; get bn(): number | null; get backs(): string[]; get berfers(): Verfer[]; get prior(): string | null; get priorb(): Uint8Array | null; get cuts(): string[]; get adds(): string[]; get delpre(): string | null; get delpreb(): Uint8Array | null; get route(): string | null; get uuid(): string | null; get nonce(): string | null; } /** ACDC-protocol Serder subtype (`proto=ACDC`). */ export declare class SerderACDC extends Serder { static readonly Protocol: Protocol; static readonly Proto: Protocol; constructor(init?: SerderInit); protected _verify(): void; get uuid(): string | null; get uuidb(): Uint8Array | null; get issuer(): string | null; get issuerb(): Uint8Array | null; get regid(): string | null; get regidb(): Uint8Array | null; get schema(): unknown; get attrib(): unknown; get issuee(): string | null; get issueeb(): Uint8Array | null; get aggreg(): unknown; get edge(): unknown; get rule(): unknown; } /** * Parse one raw Serder body and hydrate protocol-specific Serder subclasses. */ export declare function parseSerder(raw: Uint8Array, smellage: Smellage): Serder; export {}; //# sourceMappingURL=serder.d.ts.map