/** * Signing Middleware * * DESIGN.md ยง6.2 โ€” Every op can be cryptographically signed by its author. * * This module provides: * - `signOp`: Sign a VcsOp with a local identity's private key. * - `verifyOp`: Verify the signature on a VcsOp. * - `SignatureVerificationMiddleware`: Middleware that rejects ops with * invalid signatures on remote ops. */ import type { VcsOp } from '../vcs/types.js'; /** * Sign a VcsOp in-place using the given private key. * Sets `vcs.signature`, `vcs.signedBy`, and optionally `vcs.signedWith` (ADR 0020). * * The signature is computed over the body with the signature fields excluded * (`hashVcsOpBody`), then stamped, and `op.hash` is recomputed to *include* the * signature so a signed op still passes `verifyVcsOpHash` (signing is not an * out-of-band annotation). `verifyOp`/`verifyOpBatch` reconstruct the same * body hash to check the signature. */ export declare function signOp(op: VcsOp, privateKeyBase64: string, identityEntityId: string, signedWith?: string): Promise; /** * Verify the signature on a VcsOp. * Returns true if the op has a valid signature, false if invalid. * Returns null if the op has no signature (unsigned). */ export declare function verifyOp(op: VcsOp, publicKeyBase64: string): Promise; /** * Reconstruct the canonical body hash a signature was computed over: the op * with its signature fields stripped (see `hashVcsOpBody`). */ export declare function opBodyHash(op: VcsOp): Promise; export interface IdentityResolver { /** Resolve an identity entity ID to its root/bootstrap public key (base64). */ resolvePublicKey(entityId: string): string | null; /** ADR 0020 โ€” resolve a specific device key under an identity. */ resolveDevicePublicKey?(identityEntityId: string, deviceId: string): string | null; /** ADR 0020 โ€” all authorized keys (root + devices) for try-all legacy verify. */ resolvePublicKeys?(identityEntityId: string): string[]; } export interface SignatureVerificationResult { valid: boolean; op: VcsOp; reason?: string; } /** * Verify all signatures on a batch of ops. * Returns results for ops that have signatures. * Supports ADR 0020 device keys via signedWith + resolveDevicePublicKey. */ export declare function verifyOpBatch(ops: VcsOp[], resolver: IdentityResolver): Promise; //# sourceMappingURL=signing-middleware.d.ts.map