{"_id":"@accord-protocol/core","_rev":"3-0ca2a7bcb820283a33a26cbb00d0af7f","name":"@accord-protocol/core","dist-tags":{"latest":"0.4.2"},"versions":{"0.4.0":{"name":"@accord-protocol/core","version":"0.4.0","keywords":["accord-protocol","agent-payments","agreement","verification-receipt","settlement-receipt","canonical-json","blake2b256"],"author":{"name":"bez111"},"license":"MIT","_id":"@accord-protocol/core@0.4.0","maintainers":[{"name":"accord-protocol","email":"alexander.bezkrovny@gmail.com"}],"homepage":"https://github.com/accord-protocol/accord-protocol/tree/main/packages/accord-core","bugs":{"url":"https://github.com/accord-protocol/accord-protocol/issues"},"dist":{"shasum":"79ce284c23c578096fb9cf23030c5624867bc8ad","tarball":"https://registry.npmjs.org/@accord-protocol/core/-/core-0.4.0.tgz","fileCount":6,"integrity":"sha512-c5X3hbKKBGgx2vfQRSne5+07omGt3KXNXseBE+ar+wF7oF1yGFXT+GbslnSnrIyB0wIH/MBrXR2wmRqJZIWuRQ==","signatures":[{"sig":"MEUCIDGgaxOQrKoJVIRd+SEpxIgtkaCqfxGnxwv5ENa85NlFAiEAkL+eIv54mAMc2xHswD3n5r+KLVUjYRVdG+F79za7xc4=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":42805},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"gitHead":"3de0b386d2e83302cac87206d198a8a799b6baa8","scripts":{"test":"npx tsx --test src/__tests__/*.test.ts","build":"tsup src/index.ts --format esm,cjs --dts --clean","typecheck":"tsc --noEmit"},"_npmUser":{"name":"accord-protocol","email":"alexander.bezkrovny@gmail.com"},"repository":{"url":"git+https://github.com/accord-protocol/accord-protocol.git","type":"git","directory":"packages/accord-core"},"_npmVersion":"10.9.4","description":"Accord Protocol core SDK — canonicalize, hash, validate Agreement / Verification Receipt / Settlement Receipt v0 objects. Rail-agnostic. See specs/ACCORD-000-overview.md.","directories":{},"_nodeVersion":"22.21.1","dependencies":{"@noble/hashes":"^1.8.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.0.0","tsup":"^8.0.0","typescript":"^5.0.0","@types/node":"^20.0.0"},"_npmOperationalInternal":{"tmp":"tmp/core_0.4.0_1778775546901_0.09447308663738463","host":"s3://npm-registry-packages-npm-production"}},"0.4.1":{"name":"@accord-protocol/core","version":"0.4.1","keywords":["accord-protocol","agent-payments","agreement","verification-receipt","settlement-receipt","canonical-json","blake2b256"],"author":{"name":"bez111"},"license":"MIT","_id":"@accord-protocol/core@0.4.1","maintainers":[{"name":"accord-protocol","email":"alexander.bezkrovny@gmail.com"}],"homepage":"https://github.com/accord-protocol/accord-protocol/tree/main/packages/accord-core","bugs":{"url":"https://github.com/accord-protocol/accord-protocol/issues"},"dist":{"shasum":"aa7bf1df5fe94c311b5989a5eb5ee706ce586655","tarball":"https://registry.npmjs.org/@accord-protocol/core/-/core-0.4.1.tgz","fileCount":6,"integrity":"sha512-RHlnG6dfbfBoiO/wZTTDSrLvckT+uK71RBoTh4QlHaI1EpHQu6ztHcEjAkkFISp7HoOOu1B19NmJPw/EkP+ohw==","signatures":[{"sig":"MEQCIEybquQmhHNqhR/sjREH0rl+8dw9or/vI7EhgG/AFNRIAiBBGQk8XgdmoCHy84raLH4ghvgSiFi16qilBBT6hhmbvA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@accord-protocol%2fcore@0.4.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":46595},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"gitHead":"e42de427235ef205df05351fb51e607b159d23b6","scripts":{"test":"npx tsx --test src/__tests__/*.test.ts","build":"tsup src/index.ts --format esm,cjs --dts --clean","typecheck":"tsc --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:66de1b47-da39-4c48-b14d-e3f684b958f4"}},"repository":{"url":"git+https://github.com/accord-protocol/accord-protocol.git","type":"git","directory":"packages/accord-core"},"_npmVersion":"11.14.1","description":"Accord Protocol core SDK — canonicalize, hash, validate Agreement / Verification Receipt / Settlement Receipt v0 objects. Rail-agnostic. See specs/ACCORD-000-overview.md.","directories":{},"_nodeVersion":"24.15.0","dependencies":{"@noble/hashes":"^1.8.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.0.0","tsup":"^8.0.0","typescript":"^5.0.0","@types/node":"^20.0.0"},"_npmOperationalInternal":{"tmp":"tmp/core_0.4.1_1778872849941_0.8536250291683847","host":"s3://npm-registry-packages-npm-production"}},"0.4.2":{"name":"@accord-protocol/core","version":"0.4.2","description":"Accord Protocol core SDK — canonicalize, hash, validate Agreement / Verification Receipt / Settlement Receipt v0 objects. Rail-agnostic. See specs/ACCORD-000-overview.md.","type":"module","main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"scripts":{"build":"tsup src/index.ts --format esm,cjs --dts --clean","typecheck":"tsc --noEmit","test":"npx tsx --test src/__tests__/*.test.ts"},"keywords":["accord-protocol","agent-payments","agreement","verification-receipt","settlement-receipt","canonical-json","blake2b256"],"author":{"name":"bez111"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/accord-protocol/accord-protocol.git","directory":"packages/accord-core"},"homepage":"https://accordprotocol.ai/learn/agreement-object-explained/","bugs":{"url":"https://github.com/accord-protocol/accord-protocol/issues"},"dependencies":{"@noble/hashes":"^1.8.0"},"devDependencies":{"@types/node":"^20.0.0","tsup":"^8.0.0","tsx":"^4.0.0","typescript":"^5.0.0"},"engines":{"node":">=18"},"publishConfig":{"access":"public"},"gitHead":"437febb0a70b3162d4b10b19874f1a0026a59bdf","_id":"@accord-protocol/core@0.4.2","_nodeVersion":"24.15.0","_npmVersion":"11.15.0","dist":{"integrity":"sha512-beS95Pznm54lcWtdg6/QxBaL7/+t6w7Lzc57YmXuPwFEhNGJctJQqzgrfzzLlJOWbY0QZwJHpfmRuJ2QSflD2Q==","shasum":"745d7b94f27118a928272474e5a3afe7bac73f5e","tarball":"https://registry.npmjs.org/@accord-protocol/core/-/core-0.4.2.tgz","fileCount":6,"unpackedSize":46752,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@accord-protocol%2fcore@0.4.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDEZuhf/cnDkf7auJBFPVtGLgpH4Z8jaXTsdWlSKIBW3gIhAIm2is6unx4LeeJVhmhUQrPUViNq79phd/8Z/6KzlcrN"}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:66de1b47-da39-4c48-b14d-e3f684b958f4"}},"directories":{},"maintainers":[{"name":"accord-protocol","email":"alexander.bezkrovny@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/core_0.4.2_1779581997754_0.9233048962062587"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-14T16:19:06.775Z","modified":"2026-05-24T00:19:58.207Z","0.4.0":"2026-05-14T16:19:07.089Z","0.4.1":"2026-05-15T19:20:50.156Z","0.4.2":"2026-05-24T00:19:57.919Z"},"bugs":{"url":"https://github.com/accord-protocol/accord-protocol/issues"},"author":{"name":"bez111"},"license":"MIT","homepage":"https://accordprotocol.ai/learn/agreement-object-explained/","keywords":["accord-protocol","agent-payments","agreement","verification-receipt","settlement-receipt","canonical-json","blake2b256"],"repository":{"type":"git","url":"git+https://github.com/accord-protocol/accord-protocol.git","directory":"packages/accord-core"},"description":"Accord Protocol core SDK — canonicalize, hash, validate Agreement / Verification Receipt / Settlement Receipt v0 objects. Rail-agnostic. See specs/ACCORD-000-overview.md.","maintainers":[{"name":"accord-protocol","email":"alexander.bezkrovny@gmail.com"}],"readme":"# `@accord-protocol/core`\n\nCore SDK for [Accord Protocol](https://accordprotocol.ai/). Canonicalize, hash, and validate the three v0 protocol objects.\n\nPublic docs: [Learn](https://accordprotocol.ai/learn/) · [Status](https://accordprotocol.ai/status/) · [Repository](https://github.com/accord-protocol/accord-protocol)\n\nThe three v0 protocol objects:\n\n| Object | Spec | Type literal |\n|---|---|---|\n| Agreement | [ACCORD-001](../../specs/ACCORD-001-agreement-object.md) | `accord.agreement.v0` |\n| Verification Receipt | [ACCORD-002](../../specs/ACCORD-002-verification-receipt.md) | `accord.verification_receipt.v0` |\n| Settlement Receipt | [ACCORD-003](../../specs/ACCORD-003-settlement-receipt.md) | `accord.settlement_receipt.v0` |\n\nThis package is **rail-agnostic**. It knows nothing about Ergo, Base, Rosen, or x402 — those live in `@accord-protocol/rails-*` adapters.\n\n## Install\n\n```bash\nnpm install @accord-protocol/core\n```\n\n## Usage\n\n### Hashing\n\n```ts\nimport { accordHashV0, withPrefix } from \"@accord-protocol/core\";\n\nconst agreement = { /* …matches schemas/agreement.v0.schema.json… */ };\nconst hex   = accordHashV0(agreement);          // \"a1b2c3…\"  (64 lower-case hex)\nconst wire  = withPrefix(hex);                  // \"blake2b256:0xa1b2c3…\"\n```\n\n`accord_hash_v0 = BLAKE2b-256(canonical_json_bytes(object))`. The wire form (`blake2b256:0x…`) is what `agreement_hash` / `verification_receipts[i]` carry inside protocol objects.\n\n### Signing a Verification Receipt\n\nThe signing input is the receipt with the `signature` field stripped, canonicalized, then BLAKE2b-256-hashed:\n\n```ts\nimport { signingHashRaw } from \"@accord-protocol/core\";\n\nconst signingInput = signingHashRaw(receipt);  // 32-byte digest\nconst signature = sign(privateKey, signingInput);\nreceipt.signature = { scheme: \"ed25519\", public_key, signature };\n```\n\n### Validating\n\n```ts\nimport {\n  validateAgreement,\n  validateVerificationReceipt,\n  validateSettlementReceipt,\n} from \"@accord-protocol/core\";\n\nconst r = validateAgreement(agreement);\nif (!r.ok) {\n  for (const p of r.problems) console.error(p.code, p.path, p.message);\n}\n```\n\nValidation enforces the **cross-field rules** that JSON Schema can't easily express — see [`src/validate.ts`](./src/validate.ts) for the full list. Use it alongside JSON-Schema validation against [`schemas/`](../../schemas), not instead of it.\n\n### Per-rail mode allow-list\n\n```ts\nimport { RAIL_MODE_ALLOWLIST } from \"@accord-protocol/core\";\n\nRAIL_MODE_ALLOWLIST.ergo\n// → [\"note_redeemed\", \"reserve_refunded\", \"batch_settled\"]\n```\n\n## What's NOT in this package\n\n- Rail adapters (Ergo / Rosen / Base / x402) → `@accord-protocol/rails-*`\n- HTTP transport (Accord/402) → `@accord-protocol/gateway`\n- MCP transport (Accord/MCP) → `@accord-protocol/mcp`\n- Conformance suite → `@accord-protocol/conformance`\n- Signing / verification primitives — bring your own libsodium / secp256k1 / ergo-sigma binding; this package only computes the signing-input hash.\n\n## License\n\nMIT.\n","readmeFilename":"README.md"}