{"_id":"@axonmed/crypto","name":"@axonmed/crypto","dist-tags":{"experimental":"0.1.0-experimental","latest":"0.1.0-experimental"},"versions":{"0.1.0-experimental":{"name":"@axonmed/crypto","version":"0.1.0-experimental","private":false,"description":"Public verifier primitives for AXONMED Cohort Verification Hash attestations and encrypted wellness vault payloads.","license":"Apache-2.0","type":"module","sideEffects":false,"homepage":"https://github.com/Axonmed-Protocol/axonmed-monorepo/tree/main/packages/crypto#readme","bugs":{"url":"https://github.com/Axonmed-Protocol/axonmed-monorepo/issues"},"engines":{"node":">=20.20.0"},"main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./vault":{"types":"./dist/vault/index.d.ts","import":"./dist/vault/index.js"},"./attestation":{"types":"./dist/attestation/index.d.ts","import":"./dist/attestation/index.js"}},"scripts":{"clean":"node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\"","build":"pnpm run clean && tsc -p tsconfig.build.json","prepack":"pnpm run build","typecheck":"tsc --noEmit","test":"vitest run","verify":"pnpm run build && node verify.mjs"},"publishConfig":{"access":"public","tag":"experimental"},"keywords":["axonmed","solana","attestation","cvh","verifier"],"repository":{"type":"git","url":"git+https://github.com/Axonmed-Protocol/axonmed-monorepo.git","directory":"packages/crypto"},"dependencies":{"@noble/hashes":"^1.5.0","@solana/web3.js":"^1.95.0","tweetnacl":"^1.0.3"},"devDependencies":{"typescript":"^5.6.0","vitest":"^2.0.0"},"gitHead":"3cb6db23c1d1ec984c863d3a8e3fbcb6662043de","_id":"@axonmed/crypto@0.1.0-experimental","_nodeVersion":"25.8.1","_npmVersion":"11.11.0","dist":{"integrity":"sha512-fFbz+TkbAoaN+NzMLGWsv+8dX/Vqf7CYCJXL/x9CmLD4rOsiVXUtfSdgAkNOWgd2hQ0sgHZnaqu612Xzcv8DxQ==","shasum":"9ea7d84dc8ff57f66008176a749fb3a1b7b17f73","tarball":"https://registry.npmjs.org/@axonmed/crypto/-/crypto-0.1.0-experimental.tgz","fileCount":12,"unpackedSize":28258,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDIbz4Bg4+gBCs25nCs5KR0TeBcJf9qrXSegU/fswdVzAIgIOm6aUYYZ0r/D/A9vPt4F5s/5p1+j3aJvWdVYc6NVGI="}]},"_npmUser":{"name":"axonmed","email":"axonmed@proton.me"},"directories":{},"maintainers":[{"name":"axonmed","email":"axonmed@proton.me"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/crypto_0.1.0-experimental_1777851292940_0.8520924389970663"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-03T23:34:52.866Z","0.1.0-experimental":"2026-05-03T23:34:53.075Z","modified":"2026-05-03T23:34:53.330Z"},"maintainers":[{"name":"axonmed","email":"axonmed@proton.me"}],"description":"Public verifier primitives for AXONMED Cohort Verification Hash attestations and encrypted wellness vault payloads.","homepage":"https://github.com/Axonmed-Protocol/axonmed-monorepo/tree/main/packages/crypto#readme","keywords":["axonmed","solana","attestation","cvh","verifier"],"repository":{"type":"git","url":"git+https://github.com/Axonmed-Protocol/axonmed-monorepo.git","directory":"packages/crypto"},"bugs":{"url":"https://github.com/Axonmed-Protocol/axonmed-monorepo/issues"},"license":"Apache-2.0","readme":"# @axonmed/crypto\n\nEXPERIMENTAL · Apache-2.0 · The public verifier layer for AXONMED.\n\nTwo primitives:\n\n- **`vault`** — AES-256-GCM with HKDF-SHA256-derived per-user keys (Vault Encryption Protocol, VEP).\n- **`attestation`** — Cohort Verification Hash (CVH) protocol: SHA-256 over RFC 8785 canonical JSON, signed by the AXONMED attestation key, and anchored on Solana via the Memo program.\n\n## Verify a published Finding\n\nEvery Finding on the AXONMED Findings Atlas links to a Solana memo signature. To verify:\n\n```bash\npnpm add @axonmed/crypto@0.1.0-experimental\n```\n\n```ts\nimport {\n  computeAttestationHash,\n  parseMemoData,\n  verifySignedAttestation,\n} from '@axonmed/crypto/attestation'\n\n// Pull the memo from the Solana transaction (e.g. via Helius getTransaction)\nconst memoText = '...'\nconst expectedHash = parseMemoData(memoText)\nconst attestationSignatureHex = '...' // 64-byte detached Ed25519 signature, hex-encoded\nconst attestationAuthority = '...' // AXONMED attestation authority public key\n\n// The Finding's published metadata\nconst payload = {\n  queryPlan: '...',\n  cohortHash: '...',\n  sampleSize: 87,\n  resultDigest: '...',\n  timestamp: 1747353600000,\n  nonce: '...',\n}\n\nconst recomputed = computeAttestationHash(payload)\nconst verified =\n  expectedHash !== null &&\n  recomputed === expectedHash &&\n  verifySignedAttestation(payload, expectedHash, attestationSignatureHex, attestationAuthority)\n\nconsole.log(verified ? 'verified' : 'MISMATCH')\n```\n\nIf it verifies, the published Finding is byte-identical to the signed CVH and the detached signature matches the AXONMED attestation authority.\n\nThe public API is ESM-only and intentionally small:\n\n- `@axonmed/crypto` exports the `attestation` and `vault` namespaces.\n- `@axonmed/crypto/attestation` exports CVH hashing, Memo payload helpers, and detached Ed25519 verification.\n- `@axonmed/crypto/vault` exports VEP key derivation plus AES-256-GCM encrypt/decrypt helpers.\n\n## Package Checks\n\n```bash\npnpm -F @axonmed/crypto typecheck\npnpm -F @axonmed/crypto test\npnpm -F @axonmed/crypto build\npnpm -F @axonmed/crypto verify\n(cd packages/crypto && npm pack --dry-run)\n```\n\nThe npm package ships compiled ESM and `.d.ts` files from `dist/`, plus this README, Apache-2.0 license text, package metadata, and the local verifier self-check script. Source tests, env files, source maps, and key material are excluded from the published bundle.\n","readmeFilename":"README.md","_rev":"1-78cfef3d22931754757550470f8ff183"}