/** * Library core — thin wrapper over `@motebit/crypto`'s unified `verify()` * dispatcher with file-reading + human-rendering helpers. No state, no * side effects beyond filesystem reads you requested. * * Supported artifact kinds (auto-detected by `@motebit/crypto`): * - `identity` — `motebit.md` identity file with YAML frontmatter * - `receipt` — signed `ExecutionReceipt` JSON * - `credential` — W3C-style `VerifiableCredential` JSON * - `presentation`— `VerifiablePresentation` JSON * - `skill` — directory containing `SKILL.md` + `skill-envelope.json` * plus any auxiliary `files[]` declared in the envelope * * Error handling: file I/O errors throw (caller decides how to surface). * Parse / signature errors are returned as `valid: false` results so the * caller can render a structured reason instead of catching exceptions. */ import { type ArtifactType, type HardwareAttestationVerifiers, type SkillVerifyResult, type VerifyResult } from "@motebit/crypto"; /** * A {@link VerifyResult} augmented with the binding rung for receipts. The * `sovereign` flag is computed offline from the receipt alone — `motebit_id` * IS the commitment to `public_key` (`deriveSovereignMotebitId`), so the CLI * reports the strongest binding with no relay and no identity file, matching * receipt.computer's `sovereign` rung. Absent for non-receipt artifacts. */ export type VerifyResultWithBinding = VerifyResult & { readonly sovereign?: boolean; }; export interface VerifyFileOptions { /** * Pin the expected artifact type. When set, detection must match or * the result is `valid: false` with an explanatory error. Useful in * CI where you want to reject a credential passed into a * receipt-verification step. */ readonly expectedType?: ArtifactType; /** * Clock skew allowance (seconds) for credential / presentation * time-bounded fields (`issuanceDate`, `expirationDate`, etc.). * Forwarded to `@motebit/crypto`. Defaults to the crypto package's * default. */ readonly clockSkewSeconds?: number; /** * Optional platform-specific hardware-attestation verifiers. Forwarded * through to `@motebit/crypto::verify` so credentials carrying a * `hardware_attestation` claim for `device_check` / `tpm` / * `play_integrity` / `webauthn` can be verified end-to-end. Leaving * this unset keeps the permissive-floor path fail-closed — * hardware-attested credentials still verify their Ed25519 proof, but the * `hardware_attestation` channel reports `adapter not yet shipped` * (the expected permissive-floor-only behavior). The BSL companion CLI * `@motebit/verify` wires all four leaves automatically. */ readonly hardwareAttestation?: HardwareAttestationVerifiers; /** * When `true`, additionally verify an `ExecutionReceipt`'s `result_hash` * equals `hex(SHA-256(UTF-8(result)))` (the spec formula). A valid signature * proves the bytes are authentic but NOT that `result_hash` binds the * `result` field; strict mode rejects a self-inconsistent receipt — one whose * committed hash a third party can't reproduce from its own `result`. * Forwarded to `@motebit/crypto::verify`. Default `false`. */ readonly strictHashBinding?: boolean; } /** * Verify an artifact read from disk. Auto-detects type via content * inspection in `@motebit/crypto`. * * Path-shape dispatch: * - Directory → routed to `verifySkillDirectory` (a skill ships as * `/SKILL.md` + `/skill-envelope.json` plus any auxiliary * files declared in `envelope.files[]`). The full envelope-sig + * body-hash + per-file-hash cross-check runs on disk. * - File → read as bytes and routed through `verifyArtifact`, which * calls `@motebit/crypto`'s detector. */ export declare function verifyFile(path: string, opts?: VerifyFileOptions): Promise; /** * Verify a skill directory end-to-end: envelope signature + body hash * + every declared file hash. Reads `/skill-envelope.json` and * `/SKILL.md`, plus each file in `envelope.files[]` from the * directory tree, then composes the unified `SkillVerifyResult`. * * Faithful to `services/relay/CLAUDE.md` rule 6 ("relay is a * convenience layer, not a trust root") at the ecosystem layer: an * agentskills.io user with a skill they downloaded from anywhere can * run `motebit-verify ` and answer "is this signed * AND do the bytes match the signature?" without trusting any motebit * service. * * I/O failures (missing envelope, missing SKILL.md, unreadable * directory) return `valid: false` with named errors rather than * throwing, so the CLI's structured-output path can surface them * uniformly with signature/hash failures. */ export declare function verifySkillDirectory(dir: string, opts?: VerifyFileOptions): Promise; /** * Verify an already-loaded artifact. Accepts a JSON string, an * already-parsed object, or a `motebit.md` identity string. */ export declare function verifyArtifact(content: string | object, opts?: VerifyFileOptions): Promise; /** * Render a `VerifyResult` as the CLI's default human-readable block. * `--json` bypasses this and prints the raw result directly. * * Layout: * ``` * VALID (receipt) * signer: did:motebit:... * id: rcpt_01JZN... * ``` * or * ``` * INVALID (credential) * - credentialSubject.id missing * - signature mismatch * ``` */ export declare function formatHuman(result: VerifyResultWithBinding): string; //# sourceMappingURL=lib.d.ts.map