{"_id":"@constellation-network/digital-evidence-sdk-x402","_rev":"3-fa537f36cc8659536c5241293e59f43c","name":"@constellation-network/digital-evidence-sdk-x402","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.0":{"name":"@constellation-network/digital-evidence-sdk-x402","version":"0.1.0","keywords":["constellation","ded","digital-evidence","x402","micropayment","eip3009","eip712"],"author":{"name":"Constellation Network"},"license":"Apache-2.0","_id":"@constellation-network/digital-evidence-sdk-x402@0.1.0","maintainers":[{"name":"marcus.girolneto","email":"marcus@constellationnetwork.io"},{"name":"alexbrandes","email":"alex@alexbrandes.io"},{"name":"james-constellation","email":"james@constellationnetwork.io"},{"name":"ffox77","email":"ffox77@yahoo.com"}],"homepage":"https://github.com/Constellation-Labs/digital-evidence-sdk#readme","bugs":{"url":"https://github.com/Constellation-Labs/digital-evidence-sdk/issues"},"dist":{"shasum":"ea17f00fbfb2c9f2cca31053ec62d8d4a85d595d","tarball":"https://registry.npmjs.org/@constellation-network/digital-evidence-sdk-x402/-/digital-evidence-sdk-x402-0.1.0.tgz","fileCount":13,"integrity":"sha512-yyewrSIgoyuAE9P/fi6RT4JERhGtIGDZpLgtWBmxJwsjOVyyX9WgHNWShSGoQsnXJrhNKsZqfndC4mO8Tf09hw==","signatures":[{"sig":"MEUCIGLz8dpyn0yR+bxY1yeC5Rte9oR16UVEdd2UidcxFg3sAiEA67ALBZuHHgndM4ua9+v6n6M3ieE6OOkArmFDKO2pl1E=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@constellation-network%2fdigital-evidence-sdk-x402@0.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":122455},"main":"dist/cjs/index.js","type":"module","types":"dist/types/index.d.ts","module":"dist/esm/index.js","engines":{"node":">=20.19.0"},"exports":{".":{"types":"./dist/types/index.d.ts","import":"./dist/esm/index.js","require":"./dist/cjs/index.js"}},"gitHead":"488e0efd0346950540305c2b7ed1eb2ee094e9e3","scripts":{"lint":"eslint src tests","test":"jest","build":"npm run build:bundle && npm run build:types && npm run build:fixup","format":"prettier --write src tests","build:fixup":"echo '{\"type\":\"commonjs\"}' > dist/cjs/package.json","build:types":"tsc -p tsconfig.types.json","build:bundle":"rollup -c","format:check":"prettier --check src tests","test:coverage":"jest --coverage","prepublishOnly":"npm run build && npm test"},"_npmUser":{"name":"james-constellation","email":"james@constellationnetwork.io"},"repository":{"url":"git+https://github.com/Constellation-Labs/digital-evidence-sdk.git","type":"git","directory":"packages/typescript-x402"},"_npmVersion":"11.12.1","description":"x402 micropayment extension for the Digital Evidence Depository SDK","directories":{},"_nodeVersion":"20.20.1","dependencies":{"@constellation-network/digital-evidence-sdk":"^0.3.0"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^30.2.0","tslib":"^2.8.1","rollup":"^4.59.0","ts-jest":"^29.0.0","prettier":"^3.0.0","typescript":"^5.0.0","@types/jest":"^30.0.0","@types/node":"^25.3.3","@rollup/plugin-typescript":"^12.3.0","@rollup/plugin-node-resolve":"^16.0.3"},"peerDependencies":{"ethers":"^6.0.0"},"peerDependenciesMeta":{"ethers":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/digital-evidence-sdk-x402_0.1.0_1775060045128_0.729513254508283","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@constellation-network/digital-evidence-sdk-x402","version":"0.1.1","keywords":["constellation","ded","digital-evidence","x402","micropayment","eip3009","eip712"],"author":{"name":"Constellation Network"},"license":"Apache-2.0","_id":"@constellation-network/digital-evidence-sdk-x402@0.1.1","maintainers":[{"name":"marcus.girolneto","email":"marcus@constellationnetwork.io"},{"name":"alexbrandes","email":"alex@alexbrandes.io"},{"name":"james-constellation","email":"james@constellationnetwork.io"},{"name":"ffox77","email":"ffox77@yahoo.com"}],"homepage":"https://github.com/Constellation-Labs/digital-evidence-sdk#readme","bugs":{"url":"https://github.com/Constellation-Labs/digital-evidence-sdk/issues"},"dist":{"shasum":"89601d3bd01abfa62ad09c71ddafc8e6b93c55b8","tarball":"https://registry.npmjs.org/@constellation-network/digital-evidence-sdk-x402/-/digital-evidence-sdk-x402-0.1.1.tgz","fileCount":14,"integrity":"sha512-kT7F9dBrOmYWNox0GWXduBOsaiXMm3RFO8fuZvdVnappFua3pRFHqYoPhhVkgE27sOGmMt11pp4WI9UNc0+Cww==","signatures":[{"sig":"MEQCIHSnGWhpvab6zC8jwmttndl+BW+0s8Rg26gdQS8Bt2qOAiA0v/gTW3FajOe55YWguMmsAOe1CbcmGH+UV/j1G7FGTA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@constellation-network%2fdigital-evidence-sdk-x402@0.1.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":126369},"main":"dist/cjs/index.js","type":"module","types":"dist/types/index.d.ts","module":"dist/esm/index.js","engines":{"node":">=20.19.0"},"exports":{".":{"types":"./dist/types/index.d.ts","import":"./dist/esm/index.js","require":"./dist/cjs/index.js"}},"gitHead":"f8dbbabb9eb6760b4e33ac020c6611bfcde42fcb","scripts":{"lint":"eslint src tests","test":"jest","build":"npm run build:bundle && npm run build:types && npm run build:fixup","format":"prettier --write src tests","build:fixup":"echo '{\"type\":\"commonjs\"}' > dist/cjs/package.json","build:types":"tsc -p tsconfig.types.json","build:bundle":"rollup -c","format:check":"prettier --check src tests","test:coverage":"jest --coverage","prepublishOnly":"npm run build && npm test"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:4f6ee8de-f6d6-4e59-9e99-da0e3821c69d"}},"repository":{"url":"git+https://github.com/Constellation-Labs/digital-evidence-sdk.git","type":"git","directory":"packages/typescript-x402"},"_npmVersion":"11.12.1","description":"x402 micropayment extension for the Digital Evidence Depository SDK","directories":{},"_nodeVersion":"20.20.1","dependencies":{"@constellation-network/digital-evidence-sdk":"^0.3.2"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^30.2.0","tslib":"^2.8.1","rollup":"^4.59.0","ts-jest":"^29.0.0","prettier":"^3.0.0","typescript":"^5.0.0","@types/jest":"^30.0.0","@types/node":"^25.3.3","@rollup/plugin-typescript":"^12.3.0","@rollup/plugin-node-resolve":"^16.0.3"},"peerDependencies":{"ethers":"^6.0.0"},"peerDependenciesMeta":{"ethers":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/digital-evidence-sdk-x402_0.1.1_1775071643888_0.31625854674784226","host":"s3://npm-registry-packages-npm-production"}}},"time":{"created":"2026-04-01T16:14:05.033Z","modified":"2026-05-20T22:33:05.400Z","0.1.0":"2026-04-01T16:14:05.362Z","0.1.1":"2026-04-01T19:27:24.023Z"},"bugs":{"url":"https://github.com/Constellation-Labs/digital-evidence-sdk/issues"},"author":{"name":"Constellation Network"},"license":"Apache-2.0","homepage":"https://github.com/Constellation-Labs/digital-evidence-sdk#readme","keywords":["constellation","ded","digital-evidence","x402","micropayment","eip3009","eip712"],"repository":{"url":"git+https://github.com/Constellation-Labs/digital-evidence-sdk.git","type":"git","directory":"packages/typescript-x402"},"description":"x402 micropayment extension for the Digital Evidence Depository SDK","maintainers":[{"email":"marcus@constellationnetwork.io","name":"marcus.girolneto"},{"email":"alex@alexbrandes.io","name":"alexbrandes"},{"email":"james@constellationnetwork.io","name":"james-constellation"},{"email":"gabriel@constellationnetwork.io","name":"gclaramunt"},{"email":"ffox77@yahoo.com","name":"ffox77"}],"readme":"# @constellation-network/digital-evidence-sdk-x402\n\n[![npm](https://img.shields.io/npm/v/@constellation-network/digital-evidence-sdk-x402)](https://www.npmjs.com/package/@constellation-network/digital-evidence-sdk-x402)\n[![CI](https://github.com/Constellation-Labs/digital-evidence-sdk/actions/workflows/ci.yml/badge.svg)](https://github.com/Constellation-Labs/digital-evidence-sdk/actions/workflows/ci.yml)\n[![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](../../LICENSE)\n\nx402 micropayment extension for the Digital Evidence Depository SDK. Pay-per-request fingerprint submission using USDC on **Base** via an Ethereum wallet — no API key required.\n\nFor full documentation including payment control, custom signers, and pricing, see the [x402 Payments guide](https://docs.constellationnetwork.io/sdk/digital-evidence/x402-payments).\n\n## Install\n\n```bash\nnpm install @constellation-network/digital-evidence-sdk-x402 ethers\n```\n\n## Quick start\n\n```typescript\nimport { ethers } from 'ethers';\nimport { DedX402Client, createEthersSigner } from '@constellation-network/digital-evidence-sdk-x402';\n\nconst wallet = new ethers.Wallet(process.env.ETH_PRIVATE_KEY!);\nconst client = new DedX402Client({\n  baseUrl: 'https://de-api.constellationnetwork.io',\n  signer: createEthersSigner(wallet),\n  signingPrivateKey: process.env.DAG_PRIVATE_KEY!,\n});\n\n// Generate a fingerprint (org/tenant IDs derived from wallet)\nconst submission = await client.generateFingerprint({\n  eventId: crypto.randomUUID(),\n  documentId: 'doc-001',\n  documentContent: 'Hello, world!',\n});\n\n// Submit — payment is handled automatically\nconst results = await client.fingerprints.submit([submission]);\n```\n\n## How it works\n\nThe client uses the [x402 protocol](https://www.x402.org/) to handle payments transparently. When the API responds with `402 Payment Required`, the client signs an EIP-3009 `TransferWithAuthorization` using your Ethereum wallet and retries the request with the payment header attached.\n\nOrganization and tenant IDs are deterministically derived from your wallet address (UUID v5), so no prior registration is needed.\n\n## Configuration\n\n```typescript\nconst client = new DedX402Client({\n  baseUrl: 'https://de-api.constellationnetwork.io',\n  signer: createEthersSigner(wallet),\n  signingPrivateKey: '...',  // DAG/SECP256K1 key for fingerprint signing (optional)\n  autoPay: true,             // Auto-pay on 402 responses (default: true)\n  timeout: 30000,            // Request timeout in ms (default: 30000)\n});\n```\n\nWhen `autoPay` is `false`, paid endpoints return a `PaymentRequiredResult` instead of paying automatically, allowing caller-driven payment flows.\n\n## API\n\n### Client\n\n| Property / Method | Description |\n|---|---|\n| `client.fingerprints` | Fingerprint API (submit, search, upload) |\n| `client.batches` | Batch status API |\n| `client.generateFingerprint(opts)` | Generate a signed fingerprint (requires `signingPrivateKey`) |\n| `client.orgId` | Deterministic org UUID from wallet |\n| `client.tenantId` | Deterministic tenant UUID from wallet |\n| `client.walletAddress` | Ethereum wallet address |\n\n### Fingerprints\n\n| Method | Payment | Description |\n|---|---|---|\n| `submit(submissions)` | Paid | Submit fingerprints for notarization |\n| `submitInBatches(submissions, batchSize?, delayMs?)` | Paid | Submit in batches (separate payment per batch) |\n| `upload(submissions, documents)` | Paid | Upload fingerprints with documents (multipart) |\n| `search(params)` | Paid | Search fingerprints with filtering and pagination |\n| `getByHash(hash)` | Public | Get fingerprint detail by hash |\n| `getProof(hash)` | Public | Get Merkle inclusion proof |\n| `getLatest(limit?, status?)` | Public | Get latest fingerprints |\n| `getStats()` | Public | Get platform-wide statistics |\n\n## Development\n\n```bash\nnpm install\nnpm test\nnpm run build\nnpm run lint\n```\n\n## License\n\n[Apache-2.0](../../LICENSE)","readmeFilename":"README.md"}