import { type Smellage } from "../core/types.js"; import { type MapperValue } from "../primitives/mapper.js"; import type { Versionage } from "../tables/table-types.js"; type SadMap = Record; /** * Convert native input into the canonical qb64 text-domain form used by the * rest of this module. * * If `raw` is already text-domain, it is returned unchanged. If `raw` is qb2, * the function converts exactly one native body-group span back into its qb64 * ASCII form. * * Example: * * ```ts * const txt = canonicalizeCesrNativeRaw(qb2Bytes, { major: 2, minor: 0 }); * // new TextDecoder().decode(txt) starts with "-F..." or "-G..." * ``` */ export declare function canonicalizeCesrNativeRaw(raw: Uint8Array, version: Versionage): Uint8Array; /** * Reap one CESR-native body group and derive the smellage metadata that * non-native bodies expose through `smell()`. */ export declare function reapCesrNativeBody(input: Uint8Array, version?: Versionage): { raw: Uint8Array; smellage: Smellage; consumed: number; } | null; /** * Decode one CESR-native body into a semantic SAD plus core serder projections. * * Current intent is narrow but real: hydrate actual native message bodies into * something `Serder` can verify and expose through its normal accessor surface. * Broader KERI/ACDC ilk parity should continue extending this function rather * than introducing sidecar native decoders elsewhere in the stack. * * Inputs: * - `raw`: full native body-group bytes, either qb64 text or qb2 binary * - `smellage`: protocol/version metadata already derived by `Serdery` or a * parser-side native pre-read * * Output: * - `ked`: semantic SAD reconstructed from compact CESR fields * - `ilk`: top-level message type when present * - `said`: top-level `d` SAID when present * * High-level flow: * 1. canonicalize qb2 to qb64 text if needed * 2. parse the body-group counter (`-F...` or `-G...`) * 3. consume version metadata (`Verser`) and then protocol-specific fields * 4. rebuild normal SAD strings/lists/maps so `Serder` verification can run on * the same shape used by JSON/CBOR/MGPK bodies * * Maintainer rule: * top-level KERI native messages are fixed-field bodies. A top-level * `MapBodyGroup` may still be meaningful for lower-level CESR-native mapping * surfaces or ACDC, but it is not a valid KERI native message body and should * be rejected here. * * Example: * * ```ts * const { ked } = parseCesrNativeKed( * new TextEncoder().encode("-FA50OKERICAACAXicp..."), * { proto: "KERI", pvrsn: { major: 2, minor: 0 }, gvrsn: { major: 2, minor: 0 }, kind: "CESR", size: 188 }, * ); * // ked.t === "icp" * // ked.d === "EFaYE2LTv8dItUgQzIHKRA9FaHDrHtIHNs-m5DJKWXRN" * ``` */ export declare function parseCesrNativeKed(raw: Uint8Array, smellage: Smellage): { ked: SadMap; ilk: string | null; said: string | null; }; /** * Serialize one semantic SAD into CESR-native qb64 text-domain bytes. * * Callers that start from qb2 should still route through this text-domain emit * path; qb2 is derived from qb64 later, matching the canonicalization path used * during native inhale. * * Inputs: * - one semantic SAD in the same shape used by non-native serders * * Output: * - qb64 text-domain bytes for a CESR-native body group * * High-level flow: * 1. derive protocol/version context from the SAD's `v` * 2. emit compact CESR primitives for each field (`Verser`, `Ilker`, `Matter`, * grouped lists/maps, etc.) * 3. wrap the payload in `FixBodyGroup` or `MapBodyGroup` * * ASCII shape of the result for a KERI fixed-body message: * * ```text * -F... ... * ``` * * Example: * * ```ts * const raw = dumpCesrNativeSad({ * v: "KERICAACAACESRAAC8.", * t: "icp", * d: "EFaYE2LTv8dItUgQzIHKRA9FaHDrHtIHNs-m5DJKWXRN", * i: "DNG2arBDtHK_JyHRAq-emRdC6UM-yIpCAeJIWDiXp4Hx", * s: "0", * kt: "1", * k: ["DNG2arBDtHK_JyHRAq-emRdC6UM-yIpCAeJIWDiXp4Hx"], * nt: "1", * n: ["EFXIx7URwmw7AVQTBcMxPXfOOJ2YYA1SJAam69DXV8D2"], * bt: "0", * b: [], * c: [], * a: [], * }); * ``` */ export declare function dumpCesrNativeSad(sad: SadMap): Uint8Array; export {}; //# sourceMappingURL=native.d.ts.map