{
  "$schema": "https://ar-agents.ar/test-vectors/rfc-006-v1.schema.json",
  "spec": "https://ar-agents.ar/rfcs/006",
  "version": "rfc-006-v1-draft",
  "publishedAt": "2026-05-17",
  "notes": "Conformance vectors for RFC-006 v1 (hash-chained ledger + external anchoring profile, extends RFC-004). Deterministic + reproducible: re-run tools/arg-verify/_gen-rfc006-vectors.mjs and every value holds. arg-verify.mjs reimplements canonical/HMAC/projection clean-room and asserts every value here. License: CC-BY-4.0.",
  "secrets": {
    "audit": "rfc-006-conformance-secret",
    "projection": "rfc-006-projection-secret"
  },
  "chain": {
    "description": "Genesis-rooted 3-link chain. verifyChain MUST return valid:true. Each link.hash = HMAC-SHA256(audit, canonical({seq,prevHash,societyId,actor,action,meta:meta??null,ts})).",
    "genesis": "GENESIS",
    "links": [
      {
        "seq": 1,
        "prevHash": "GENESIS",
        "societyId": null,
        "actor": "system",
        "action": "ledger.genesis",
        "meta": null,
        "ts": "2026-05-11T00:00:00.000Z",
        "hash": "e8688b9eac9e5e63b8822d4585c4023d31348e30f589e946c4f3533409c22031"
      },
      {
        "seq": 2,
        "prevHash": "e8688b9eac9e5e63b8822d4585c4023d31348e30f589e946c4f3533409c22031",
        "societyId": "soc_abc12345",
        "actor": "mercadopago",
        "action": "mercadopago.preapproval.create",
        "meta": {
          "amount": 1500,
          "currency": "ARS",
          "governance": "audit-logged"
        },
        "ts": "2026-05-11T00:00:01.000Z",
        "hash": "a7dbd708286799a1e2c3b5c97b9daf015072535d2abd713e78d5e8912d0c1bad"
      },
      {
        "seq": 3,
        "prevHash": "a7dbd708286799a1e2c3b5c97b9daf015072535d2abd713e78d5e8912d0c1bad",
        "societyId": "soc_abc12345",
        "actor": "afip",
        "action": "afip.factura.emitir",
        "meta": {
          "cae": "75123456789012",
          "governance": "requires-confirmation"
        },
        "ts": "2026-05-11T00:00:02.000Z",
        "hash": "33eb348ae76bf4c12a54d6f97cbf351504bac58ccd7bab5c950f0130dea48fc7"
      }
    ],
    "expect": {
      "valid": true,
      "count": 3
    }
  },
  "chainMutated": {
    "description": "Same links but link seq=2 meta.amount mutated 1500→1501 while keeping the original hash. verifyChain MUST return valid:false at seq 2 (hash mismatch).",
    "links": [
      {
        "seq": 1,
        "prevHash": "GENESIS",
        "societyId": null,
        "actor": "system",
        "action": "ledger.genesis",
        "meta": null,
        "ts": "2026-05-11T00:00:00.000Z",
        "hash": "e8688b9eac9e5e63b8822d4585c4023d31348e30f589e946c4f3533409c22031"
      },
      {
        "seq": 2,
        "prevHash": "e8688b9eac9e5e63b8822d4585c4023d31348e30f589e946c4f3533409c22031",
        "societyId": "soc_abc12345",
        "actor": "mercadopago",
        "action": "mercadopago.preapproval.create",
        "meta": {
          "amount": 1501,
          "currency": "ARS",
          "governance": "audit-logged"
        },
        "ts": "2026-05-11T00:00:01.000Z",
        "hash": "a7dbd708286799a1e2c3b5c97b9daf015072535d2abd713e78d5e8912d0c1bad"
      },
      {
        "seq": 3,
        "prevHash": "a7dbd708286799a1e2c3b5c97b9daf015072535d2abd713e78d5e8912d0c1bad",
        "societyId": "soc_abc12345",
        "actor": "afip",
        "action": "afip.factura.emitir",
        "meta": {
          "cae": "75123456789012",
          "governance": "requires-confirmation"
        },
        "ts": "2026-05-11T00:00:02.000Z",
        "hash": "33eb348ae76bf4c12a54d6f97cbf351504bac58ccd7bab5c950f0130dea48fc7"
      }
    ],
    "expect": {
      "valid": false,
      "brokenAtSeq": 2,
      "reasonContains": "hash"
    }
  },
  "chainDeleted": {
    "description": "Middle link (seq 2) removed; links seq 1 and 3 retain original hashes. verifyChain MUST return valid:false (contiguity or prevHash linkage break).",
    "links": [
      {
        "seq": 1,
        "prevHash": "GENESIS",
        "societyId": null,
        "actor": "system",
        "action": "ledger.genesis",
        "meta": null,
        "ts": "2026-05-11T00:00:00.000Z",
        "hash": "e8688b9eac9e5e63b8822d4585c4023d31348e30f589e946c4f3533409c22031"
      },
      {
        "seq": 3,
        "prevHash": "a7dbd708286799a1e2c3b5c97b9daf015072535d2abd713e78d5e8912d0c1bad",
        "societyId": "soc_abc12345",
        "actor": "afip",
        "action": "afip.factura.emitir",
        "meta": {
          "cae": "75123456789012",
          "governance": "requires-confirmation"
        },
        "ts": "2026-05-11T00:00:02.000Z",
        "hash": "33eb348ae76bf4c12a54d6f97cbf351504bac58ccd7bab5c950f0130dea48fc7"
      }
    ],
    "expect": {
      "valid": false,
      "brokenAtSeq": 3
    }
  },
  "anchors": {
    "description": "2-anchor chain over the §3 chain head. signature_n = HMAC-SHA256(audit, canonical(AnchorBody)); prevAnchor links to previous signature; genesis prevAnchor = 'GENESIS'.",
    "genesis": "GENESIS",
    "anchors": [
      {
        "seq": 1,
        "headSeq": 2,
        "headHash": "a7dbd708286799a1e2c3b5c97b9daf015072535d2abd713e78d5e8912d0c1bad",
        "prevAnchor": "GENESIS",
        "ts": "2026-05-11T00:01:00.000Z",
        "signature": "2acf14307564a1bf27e0ff225dacda75ecb55912a8b178d38691bf46eb76fa1b"
      },
      {
        "seq": 2,
        "headSeq": 3,
        "headHash": "33eb348ae76bf4c12a54d6f97cbf351504bac58ccd7bab5c950f0130dea48fc7",
        "prevAnchor": "2acf14307564a1bf27e0ff225dacda75ecb55912a8b178d38691bf46eb76fa1b",
        "ts": "2026-05-11T00:02:00.000Z",
        "signature": "9cbf53f16b995a8a226db76dfb15cb252187f45e35537be05a8f37fd012a484f"
      }
    ],
    "expect": {
      "valid": true,
      "count": 2
    }
  },
  "projection": {
    "description": "RFC-006 §5 normative projection P(L)→RFC-004 OperationalLogEntry. Each entry MUST canonical-equal the published object, its hmac MUST string-equal, AND it MUST pass RFC-004 §3 verifyEntry with secrets.projection.",
    "secret": "rfc-006-projection-secret",
    "entries": [
      {
        "fromSeq": 1,
        "entry": {
          "id": "2026-05-11T00:00:00.000Z-e8688b9e",
          "sessionId": "GLOBAL-LEDGER",
          "ts": "2026-05-11T00:00:00.000Z",
          "tool": "ledger.genesis",
          "governance": "audit-logged",
          "input": {
            "actor": "system",
            "seq": 1,
            "meta": null
          },
          "hmac": "sha256:4f388a7b6b6d544233031e5bf4856b0d973c6a45e3edc8ec1b44fcd92498a463"
        }
      },
      {
        "fromSeq": 2,
        "entry": {
          "id": "2026-05-11T00:00:01.000Z-a7dbd708",
          "sessionId": "soc_abc12345",
          "ts": "2026-05-11T00:00:01.000Z",
          "tool": "mercadopago.preapproval.create",
          "governance": "audit-logged",
          "input": {
            "actor": "mercadopago",
            "seq": 2,
            "meta": {
              "amount": 1500,
              "currency": "ARS",
              "governance": "audit-logged"
            }
          },
          "hmac": "sha256:aa17e8dbffa19a634a6e2d3bc1713703c6bc1d6b057f80d2817832e571a55b82"
        }
      },
      {
        "fromSeq": 3,
        "entry": {
          "id": "2026-05-11T00:00:02.000Z-33eb348a",
          "sessionId": "soc_abc12345",
          "ts": "2026-05-11T00:00:02.000Z",
          "tool": "afip.factura.emitir",
          "governance": "requires-confirmation",
          "input": {
            "actor": "afip",
            "seq": 3,
            "meta": {
              "cae": "75123456789012",
              "governance": "requires-confirmation"
            }
          },
          "hmac": "sha256:bdf086a31b8d6a3222774a1b2d67aacc492c3e4510391a2d10d5273de87fdcc7"
        }
      }
    ]
  },
  "exportBundle": {
    "description": "The real regulator artifact: Vultur /api/society/[slug]/export bundle. Per-society NON-contiguous slice (RFC-006 §4.2 recordsOnly); timestamp column is `createdAt` and the canonical hash material's `ts` := new Date(createdAt).toISOString(). Attestation nested under `.attestation` (RFC-006 §7/§8). A conformant verifier MUST: Ed25519-verify the attestation against its embedded SPKI publicKey; bind attestation↔bundle (chain.societyEventCount === auditEvents.length, society slug/cuit match); recordsOnly-verify every auditEvents row with the createdAt→ts mapping.",
    "bundle": {
      "exportedAt": "2026-05-17T10:05:00.000Z",
      "society": {
        "denominacion": "DEMO SOCIEDAD IA S.A.",
        "slug": "demo-sa",
        "tipo": "SA",
        "status": "ACTIVE",
        "cuit": "30715000017",
        "objeto": "Desarrollo de software",
        "plan": "pro",
        "createdAt": "2026-05-01T00:00:00.000Z"
      },
      "movements": [],
      "invoices": [
        {
          "cae": "75123456789012",
          "tipo": "C",
          "total": 15000
        }
      ],
      "auditEvents": [
        {
          "seq": 2,
          "prevHash": "f42abddc54f1e1714920dd47b15a7bb2ea483af4db4f7b86bc74e68b254d7790",
          "hash": "4dae2ce71002069b2c12a087c6d3f29b2f2c69badb73077baffefb90a538ec69",
          "societyId": "soc_demo01",
          "actor": "mercadopago",
          "action": "mercadopago.preapproval.create",
          "meta": {
            "amount": 15000,
            "currency": "ARS"
          },
          "createdAt": "2026-05-17T10:00:01.000Z"
        },
        {
          "seq": 3,
          "prevHash": "4dae2ce71002069b2c12a087c6d3f29b2f2c69badb73077baffefb90a538ec69",
          "hash": "db585d990d40017dabf39fc2ce31632e6bb2838af731d2daaeba911461dd1322",
          "societyId": "soc_demo01",
          "actor": "afip",
          "action": "afip.factura.emitir",
          "meta": {
            "cae": "75123456789012",
            "tipo": "C"
          },
          "createdAt": "2026-05-17T10:00:02.000Z"
        },
        {
          "seq": 5,
          "prevHash": "42956c1f672a70b5743f39fcf80439ac3ed48c672d4239b0257a74503f7b48f0",
          "hash": "11aeb212ad550b81ce2a7972d9ee75c97dc767233634fefc57461d81680fc556",
          "societyId": "soc_demo01",
          "actor": "afip",
          "action": "afip.factura.emitir",
          "meta": {
            "cae": "75123456789099",
            "tipo": "C"
          },
          "createdAt": "2026-05-17T10:00:04.000Z"
        }
      ],
      "ledgerVerification": {
        "valid": true,
        "count": 3
      },
      "attestation": {
        "body": {
          "kind": "vultur.compliance.attestation",
          "version": 1,
          "issuedAt": "2026-05-17T10:05:00.000Z",
          "society": {
            "id": "cmsoc_demo",
            "slug": "demo-sa",
            "denominacion": "DEMO SOCIEDAD IA S.A.",
            "cuit": "30715000017"
          },
          "chain": {
            "globalHeadSeq": 5,
            "globalHeadHash": "11aeb212ad550b81ce2a7972d9ee75c97dc767233634fefc57461d81680fc556",
            "societyEventCount": 3,
            "verification": {
              "valid": true,
              "count": 3
            }
          },
          "mode": "production"
        },
        "signature": "sha256:61164118f9e30c77afd3f282dcdf3f289b9408f645062dee0952baf171577a46",
        "sig": "y+AW4Qapn8Fh2iJZ+EvlippaX/1x93wkEN4OCTfUMpSCDo/wUvvSt0rwc/H2u/mSMNmCfDwAs5NkwkCQPzvcDQ==",
        "publicKey": "MCowBQYDK2VwAyEABXLzwau38jFXlRf48x+DcJpj6Ezj1kjO+5qJn6V+t84=",
        "alg": "Ed25519"
      },
      "notice": "Secrets (payment tokens, encrypted AFIP credentials) are excluded by design."
    },
    "expect": {
      "attestationValid": true,
      "societyEventCount": 3,
      "recordsOnly": {
        "valid": true,
        "count": 3
      }
    }
  },
  "exportBundleTampered": {
    "description": "auditEvents[1].meta.cae mutated, hash left intact. recordsOnly MUST flag the mutated record; the attestation Ed25519 still verifies (it signs only the head summary) — which is exactly why attestation↔bundle binding is normative.",
    "bundle": {
      "exportedAt": "2026-05-17T10:05:00.000Z",
      "society": {
        "denominacion": "DEMO SOCIEDAD IA S.A.",
        "slug": "demo-sa",
        "tipo": "SA",
        "status": "ACTIVE",
        "cuit": "30715000017",
        "objeto": "Desarrollo de software",
        "plan": "pro",
        "createdAt": "2026-05-01T00:00:00.000Z"
      },
      "movements": [],
      "invoices": [
        {
          "cae": "75123456789012",
          "tipo": "C",
          "total": 15000
        }
      ],
      "auditEvents": [
        {
          "seq": 2,
          "prevHash": "f42abddc54f1e1714920dd47b15a7bb2ea483af4db4f7b86bc74e68b254d7790",
          "hash": "4dae2ce71002069b2c12a087c6d3f29b2f2c69badb73077baffefb90a538ec69",
          "societyId": "soc_demo01",
          "actor": "mercadopago",
          "action": "mercadopago.preapproval.create",
          "meta": {
            "amount": 15000,
            "currency": "ARS"
          },
          "createdAt": "2026-05-17T10:00:01.000Z"
        },
        {
          "seq": 3,
          "prevHash": "4dae2ce71002069b2c12a087c6d3f29b2f2c69badb73077baffefb90a538ec69",
          "hash": "db585d990d40017dabf39fc2ce31632e6bb2838af731d2daaeba911461dd1322",
          "societyId": "soc_demo01",
          "actor": "afip",
          "action": "afip.factura.emitir",
          "meta": {
            "cae": "00000000000000",
            "tipo": "C"
          },
          "createdAt": "2026-05-17T10:00:02.000Z"
        },
        {
          "seq": 5,
          "prevHash": "42956c1f672a70b5743f39fcf80439ac3ed48c672d4239b0257a74503f7b48f0",
          "hash": "11aeb212ad550b81ce2a7972d9ee75c97dc767233634fefc57461d81680fc556",
          "societyId": "soc_demo01",
          "actor": "afip",
          "action": "afip.factura.emitir",
          "meta": {
            "cae": "75123456789099",
            "tipo": "C"
          },
          "createdAt": "2026-05-17T10:00:04.000Z"
        }
      ],
      "ledgerVerification": {
        "valid": true,
        "count": 3
      },
      "attestation": {
        "body": {
          "kind": "vultur.compliance.attestation",
          "version": 1,
          "issuedAt": "2026-05-17T10:05:00.000Z",
          "society": {
            "id": "cmsoc_demo",
            "slug": "demo-sa",
            "denominacion": "DEMO SOCIEDAD IA S.A.",
            "cuit": "30715000017"
          },
          "chain": {
            "globalHeadSeq": 5,
            "globalHeadHash": "11aeb212ad550b81ce2a7972d9ee75c97dc767233634fefc57461d81680fc556",
            "societyEventCount": 3,
            "verification": {
              "valid": true,
              "count": 3
            }
          },
          "mode": "production"
        },
        "signature": "sha256:61164118f9e30c77afd3f282dcdf3f289b9408f645062dee0952baf171577a46",
        "sig": "y+AW4Qapn8Fh2iJZ+EvlippaX/1x93wkEN4OCTfUMpSCDo/wUvvSt0rwc/H2u/mSMNmCfDwAs5NkwkCQPzvcDQ==",
        "publicKey": "MCowBQYDK2VwAyEABXLzwau38jFXlRf48x+DcJpj6Ezj1kjO+5qJn6V+t84=",
        "alg": "Ed25519"
      },
      "notice": "Secrets (payment tokens, encrypted AFIP credentials) are excluded by design."
    },
    "expect": {
      "attestationValid": true,
      "recordsOnly": {
        "valid": false,
        "brokenAtSeq": 3
      }
    }
  },
  "conformance": {
    "vectorsCount": 17,
    "referenceGenerator": "tools/arg-verify/_gen-rfc006-vectors.mjs",
    "independentVerifier": "tools/arg-verify/arg-verify.mjs (vectors)",
    "repo": "https://github.com/ar-agents/ar-agents",
    "howToClaimConformance": "Reproduce every link.hash, every anchor.signature, every projection.entry (canonical-equal) and its hmac (string-equal); verifyChain must match each expect block; every projected entry must pass RFC-004 §3 verifyEntry with secrets.projection. Then add your library to tools/arg-verify/CONFORMANCE-REGISTRY.md."
  }
}
