/**
 * PrivacyPort — V0 noop stub for Vauban Privacy Protocol (VPP) integration.
 *
 * Implements S0 port #10 (PrivacyPort): placeholder interface for privacy-preserving
 * operations. Phase 2+ will implement full Stwo+ML-KEM+viewing-key+SMT+cross-domain
 * functionality per draft-vauban-privacy-protocol-00 (target IETF submission 2026-06-29,
 * sprint-490 active 78%).
 *
 * V0 design: all operations return identity or noop stubs. Enables code to pass type
 * checks while VPP integration is deferred. No Side effects, no cryptographic guarantees.
 *
 * Reference: S0 § cross-spec invariants X-1 (isolation), X-3 (crypto-shredding);
 * VPP Phase roadmap: draft-vauban-privacy-protocol-00 + integration plan TBD.
 */
// ─── Noop implementation (V0 stub) ────────────────────────────────────────────
/**
 * NoopPrivacyAdapter — V0 stub implementation of PrivacyPort.
 *
 * All methods return identity values or noop results. Enables type-safe code
 * while VPP integration is deferred to Phase 2.
 *
 * Documentation: "V0 stub — replaced by VPP integration in Phase 2
 * (Stwo+ML-KEM+viewing key+SMT+cross-domain)."
 *
 * Usage:
 *   const adapter = new NoopPrivacyAdapter();
 *   const data = { secret: 'hidden', public: 'visible' };
 *   const masked = await adapter.applyMask(data, mask, ctx);
 *   // masked === data (unchanged in V0)
 */
export class NoopPrivacyAdapter {
    async applyMask(payload, _mask, _ctx) {
        // V0: identity function — return input unchanged
        return payload;
    }
    async verifyZkProof(_proof, _ctx) {
        // V0: always invalid with noop marker
        return {
            valid: false,
            reason: "noop_v0",
            confidence: 0,
        };
    }
    async commitToSmt(commitment, _ctx) {
        // V0: return deterministic mock root based on commitment value
        // In real Phase 2+, would compute Poseidon hash and maintain SMT state
        const mockRoot = this.computeMockRoot(commitment);
        return {
            smt_root: mockRoot,
            leaf_index: commitment.index ?? 0,
            version: 0, // V0 version
        };
    }
    /**
     * Compute a deterministic mock SMT root (V0 only).
     * Purely for testing — no cryptographic guarantee.
     */
    computeMockRoot(commitment) {
        // Simple deterministic hash for V0: stringify commitment and hash
        const str = JSON.stringify(commitment);
        let hash = 0;
        for (let i = 0; i < str.length; i++) {
            hash = (hash << 5) - hash + str.charCodeAt(i);
            hash = hash & hash; // keep it as 32-bit int
        }
        return "0x" + Math.abs(hash).toString(16).padStart(64, "0");
    }
}
// ─── Informational warning (not thrown) ─────────────────────────────────────
/**
 * PrivacyNoopWarning — logged when V0 noop operations are used.
 * Not thrown as an exception (non-blocking), but logged for observability.
 */
export class PrivacyNoopWarning extends Error {
    operation;
    constructor(message, operation) {
        super(message);
        this.operation = operation;
        this.name = "PrivacyNoopWarning";
        Object.setPrototypeOf(this, new.target.prototype);
    }
}
//# sourceMappingURL=privacy.js.map