{"_id":"@algorandfoundation/dp256","_rev":"7-533aadc2ea163d30e1f3415961137de3","name":"@algorandfoundation/dp256","dist-tags":{"latest":"1.1.0"},"versions":{"0.0.1":{"name":"@algorandfoundation/dp256","version":"0.0.1","keywords":[],"author":"","license":"MIT","_id":"@algorandfoundation/dp256@0.0.1","maintainers":[{"name":"bruno.martins.algorand.foundation","email":"bruno.martins@algorand.foundation"},{"name":"dev_algorand.foundation","email":"dev+npm@algorand.foundation"},{"name":"shane-at-algo","email":"shane.mcgovern@algorand.foundation"},{"name":"hmd2v","email":"yared@679labs.com"},{"name":"joe-p","email":"joepolny@gmail.com"},{"name":"bitd13co","email":"bit@d13.co"},{"name":"krby","email":"kyle.breeding@algorand.foundation"}],"dist":{"shasum":"7758da6a167763ef35715fd367de5ea2dc0f941c","tarball":"https://registry.npmjs.org/@algorandfoundation/dp256/-/dp256-0.0.1.tgz","fileCount":1,"integrity":"sha512-LOniKpS7mTkTNsGO1VKhJxZ+Np76fVdhwemrunYgSGVy9TvaNFHIDvtQjap/5eyzNd7gQ1iqBBItNvXG8icZ3w==","signatures":[{"sig":"MEUCIEbdvmVplNSGoYVUJD2gF3kOr0CAiiAHUfFp86xUcbBmAiEAgQADWop2ZwVXO/dBDEFC1Z4nIK0mkwJ4sFjUZlxynHQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":261},"main":"index.js","type":"commonjs","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"dev_algorand.foundation","email":"dev+npm@algorand.foundation"},"_npmVersion":"11.6.0","description":"","directories":{},"_nodeVersion":"24.8.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/dp256_0.0.1_1758545566606_0.1708184412893068","host":"s3://npm-registry-packages-npm-production"}},"1.0.0":{"name":"@algorandfoundation/dp256","version":"1.0.0","keywords":["p256","ecdsa","bip39","deterministic","cryptography","webauthn","passkeys"],"author":{"name":"Algorand Foundation"},"license":"Apache-2.0","_id":"@algorandfoundation/dp256@1.0.0","maintainers":[{"name":"bruno.martins.algorand.foundation","email":"bruno.martins@algorand.foundation"},{"name":"dev_algorand.foundation","email":"dev+npm@algorand.foundation"},{"name":"shane-at-algo","email":"shane.mcgovern@algorand.foundation"},{"name":"hmd2v","email":"yared@679labs.com"},{"name":"joe-p","email":"joepolny@gmail.com"},{"name":"bitd13co","email":"bit@d13.co"},{"name":"krby","email":"kyle.breeding@algorand.foundation"}],"homepage":"https://github.com/algorandfoundation/deterministic-p256-ts#readme","bugs":{"url":"https://github.com/algorandfoundation/deterministic-p256-ts/issues"},"dist":{"shasum":"ce79fbdf9e780c22481b294b787cbaaf81804b3c","tarball":"https://registry.npmjs.org/@algorandfoundation/dp256/-/dp256-1.0.0.tgz","fileCount":10,"integrity":"sha512-ZvTI/ElpG6mkBsOWCEil9xlddIg8Xcihzm3ui5pRcNhYkrjt3025hbEODhuho3jZCfraPDlCZVAjrIfC+WCAqw==","signatures":[{"sig":"MEUCIQDBnV96bwY58EXT5Jf2DjoUCUkOC6Ev4MTogEa/EHbRuQIgIci8ozeMaQKIkI9zTkP7GxUmNe8AQxoeMZS81KIDuuc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@algorandfoundation%2fdp256@1.0.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":44012},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"e7311df1a6f8c70b315cec8fba67513d83001074","scripts":{"ci":"npm run lint:check && npm run format:check && npm run test && npm run build","dev":"tsc --watch","lint":"eslint src/**/*.ts","test":"jest","build":"npm run clean && tsc","clean":"rm -rf dist","format":"prettier --write 'src/**/*.ts'","lint:check":"eslint src/**/*.ts --max-warnings 0","test:watch":"jest --watch","format:check":"prettier --check 'src/**/*.ts'","test:coverage":"jest --coverage","prepublishOnly":"npm run build","semantic-release":"semantic-release"},"_npmUser":{"name":"dev_algorand.foundation","email":"dev+npm@algorand.foundation"},"repository":{"url":"git+https://github.com/algorandfoundation/deterministic-p256-ts.git","type":"git"},"_npmVersion":"10.9.3","description":"Package used to deterministically generate P256 keypairs, using BIP39.","directories":{},"_nodeVersion":"20.19.5","dependencies":{"@scure/bip39":"^1.6.0","@noble/curves":"^1.9.6"},"publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.5.0","eslint":"^8.57.1","ts-jest":"^29.1.0","audit-ci":"^6.6.1","prettier":"^3.6.2","typescript":"^5.0.0","@types/jest":"^29.5.0","@types/node":"^20.0.0","semantic-release":"^24.2.0","@semantic-release/git":"^10.0.1","@semantic-release/npm":"^12.0.1","eslint-config-prettier":"^9.1.2","eslint-plugin-prettier":"^5.5.4","@semantic-release/github":"^11.0.0","@typescript-eslint/parser":"^6.21.0","@semantic-release/changelog":"^6.0.3","@typescript-eslint/eslint-plugin":"^6.21.0"},"_npmOperationalInternal":{"tmp":"tmp/dp256_1.0.0_1758558579808_0.659972254510536","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@algorandfoundation/dp256","version":"1.0.1","keywords":["p256","ecdsa","bip39","deterministic","cryptography","webauthn","passkeys"],"author":{"name":"Algorand Foundation"},"license":"Apache-2.0","_id":"@algorandfoundation/dp256@1.0.1","maintainers":[{"name":"bruno.martins.algorand.foundation","email":"bruno.martins@algorand.foundation"},{"name":"dev_algorand.foundation","email":"dev+npm@algorand.foundation"},{"name":"shane-at-algo","email":"shane.mcgovern@algorand.foundation"},{"name":"hmd2v","email":"yared@679labs.com"},{"name":"joe-p","email":"joepolny@gmail.com"},{"name":"bitd13co","email":"bit@d13.co"},{"name":"krby","email":"kyle.breeding@algorand.foundation"}],"homepage":"https://github.com/algorandfoundation/deterministic-p256-ts#readme","bugs":{"url":"https://github.com/algorandfoundation/deterministic-p256-ts/issues"},"dist":{"shasum":"9bc472a44aa40866eb16dccf5e85df15af47207e","tarball":"https://registry.npmjs.org/@algorandfoundation/dp256/-/dp256-1.0.1.tgz","fileCount":10,"integrity":"sha512-qpbzGGlZ76yrvkaxcgpTMBfbusTgJPl5+ytS+q6U8H/494REgw9eL/b9uGVWRZyqukCCNXmdKvm+ouv7puYFkg==","signatures":[{"sig":"MEUCIQDbvpQFDwBoRUf7QzpEcva7ADyuvVI45YJV+5BkXQ+QWAIgKb894ZYwbiVJSePGBkuqaIRS9DhzLFDtcRgJytV2MtY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@algorandfoundation%2fdp256@1.0.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":44341},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"9f8ebfcee2f7d0cbc15109078d11aef8d98866f4","scripts":{"ci":"npm run lint:check && npm run format:check && npm run test && npm run build","dev":"tsc --watch","lint":"eslint src/**/*.ts","test":"jest","build":"npm run clean && tsc","clean":"rm -rf dist","format":"prettier --write 'src/**/*.ts'","lint:check":"eslint src/**/*.ts --max-warnings 0","test:watch":"jest --watch","format:check":"prettier --check 'src/**/*.ts'","test:coverage":"jest --coverage","prepublishOnly":"npm run build","semantic-release":"semantic-release"},"_npmUser":{"name":"dev_algorand.foundation","email":"dev+npm@algorand.foundation"},"repository":{"url":"git+https://github.com/algorandfoundation/deterministic-p256-ts.git","type":"git"},"_npmVersion":"10.9.3","description":"Package used to deterministically generate P256 keypairs, using BIP39.","directories":{},"_nodeVersion":"20.19.5","dependencies":{"@scure/bip39":"^1.6.0","@noble/curves":"^1.9.6"},"publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.5.0","eslint":"^8.57.1","ts-jest":"^29.1.0","audit-ci":"^6.6.1","prettier":"^3.6.2","typescript":"^5.0.0","@types/jest":"^29.5.0","@types/node":"^20.0.0","semantic-release":"^24.2.0","@semantic-release/git":"^10.0.1","@semantic-release/npm":"^12.0.1","eslint-config-prettier":"^9.1.2","eslint-plugin-prettier":"^5.5.4","@semantic-release/github":"^11.0.0","@typescript-eslint/parser":"^6.21.0","@semantic-release/changelog":"^6.0.3","@typescript-eslint/eslint-plugin":"^6.21.0"},"_npmOperationalInternal":{"tmp":"tmp/dp256_1.0.1_1758562837751_0.49791948917967277","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"@algorandfoundation/dp256","version":"1.1.0","keywords":["p256","ecdsa","bip39","deterministic","cryptography","webauthn","passkeys"],"author":{"name":"Algorand Foundation"},"license":"Apache-2.0","_id":"@algorandfoundation/dp256@1.1.0","maintainers":[{"name":"bruno.martins.algorand.foundation","email":"bruno.martins@algorand.foundation"},{"name":"dev_algorand.foundation","email":"dev+npm@algorand.foundation"},{"name":"shane-at-algo","email":"shane.mcgovern@algorand.foundation"},{"name":"hmd2v","email":"yared@679labs.com"},{"name":"joe-p","email":"joepolny@gmail.com"},{"name":"bitd13co","email":"bit@d13.co"},{"name":"krby","email":"kyle.breeding@algorand.foundation"}],"homepage":"https://github.com/algorandfoundation/deterministic-p256-ts#readme","bugs":{"url":"https://github.com/algorandfoundation/deterministic-p256-ts/issues"},"dist":{"shasum":"e1050ed302fe0eee80c257912e65df13610576c1","tarball":"https://registry.npmjs.org/@algorandfoundation/dp256/-/dp256-1.1.0.tgz","fileCount":10,"integrity":"sha512-s+ZQG3WK6eWskfmjh0bbMImyO+SIR297s+7vQoercbM0hYvilzTBT/rEcvs4ZQxU6TxkTXLq4BRj1USjGFpsCA==","signatures":[{"sig":"MEUCIQDMsLDstfy1b18lzEaYUGgQZuYNvtrfaTu3HeUta5EITwIgQ7Ex8/XC2qm6AuOu5bH9ez5tfRvpXw0ikDTcr8rEBMw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@algorandfoundation%2fdp256@1.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":44218},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"6511bf0d0c90c9236278f100a61f2b808f5ec61e","scripts":{"ci":"npm run lint:check && npm run format:check && npm run test && npm run build","dev":"tsc --watch","lint":"eslint src/**/*.ts","test":"jest","build":"npm run clean && tsc","clean":"rm -rf dist","format":"prettier --write 'src/**/*.ts'","lint:check":"eslint src/**/*.ts --max-warnings 0","test:watch":"jest --watch","format:check":"prettier --check 'src/**/*.ts'","test:coverage":"jest --coverage","prepublishOnly":"npm run build","semantic-release":"semantic-release"},"_npmUser":{"name":"dev_algorand.foundation","email":"dev+npm@algorand.foundation"},"repository":{"url":"git+https://github.com/algorandfoundation/deterministic-p256-ts.git","type":"git"},"_npmVersion":"11.6.4","description":"Package used to deterministically generate P256 keypairs, using BIP39.","directories":{},"_nodeVersion":"24.11.1","dependencies":{"@scure/bip39":"1.6.0","@noble/curves":"1.9.6","@noble/hashes":"1.8.0"},"publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.5.0","eslint":"^8.57.1","ts-jest":"^29.1.0","audit-ci":"^6.6.1","prettier":"^3.6.2","typescript":"^5.0.0","@types/jest":"^29.5.0","@types/node":"^20.0.0","semantic-release":"^25.0.2","@semantic-release/git":"^10.0.1","@semantic-release/npm":"^13.1.2","eslint-config-prettier":"^9.1.2","eslint-plugin-prettier":"^5.5.4","@semantic-release/github":"^11.0.0","@typescript-eslint/parser":"^6.21.0","@semantic-release/changelog":"^6.0.3","@typescript-eslint/eslint-plugin":"^6.21.0"},"_npmOperationalInternal":{"tmp":"tmp/dp256_1.1.0_1765187115694_0.8151932346306323","host":"s3://npm-registry-packages-npm-production"}}},"time":{"created":"2025-09-22T12:52:46.518Z","modified":"2026-04-08T12:51:25.720Z","0.0.1":"2025-09-22T12:52:46.786Z","1.0.0":"2025-09-22T16:29:40.015Z","1.0.1":"2025-09-22T17:40:37.932Z","1.1.0":"2025-12-08T09:45:15.881Z"},"bugs":{"url":"https://github.com/algorandfoundation/deterministic-p256-ts/issues"},"author":{"name":"Algorand Foundation"},"license":"Apache-2.0","homepage":"https://github.com/algorandfoundation/deterministic-p256-ts#readme","keywords":["p256","ecdsa","bip39","deterministic","cryptography","webauthn","passkeys"],"repository":{"url":"git+https://github.com/algorandfoundation/deterministic-p256-ts.git","type":"git"},"description":"Package used to deterministically generate P256 keypairs, using BIP39.","maintainers":[{"email":"bruno.martins@algorand.foundation","name":"bruno.martins.algorand.foundation"},{"email":"dev+npm@algorand.foundation","name":"dev_algorand.foundation"},{"email":"shane.mcgovern@algorand.foundation","name":"shane-at-algo"},{"email":"joepolny@gmail.com","name":"joe-p"},{"email":"bit@d13.co","name":"bitd13co"},{"email":"kyle.breeding@algorand.foundation","name":"krby"}],"readme":"# Deterministic P256 TypeScript\n\nA TypeScript implementation for generating deterministic P-256 keypairs from BIP39 mnemonic phrases. This library enables the creation of reproducible cryptographic keypairs for WebAuthn/FIDO2 authentication across different devices.\n\n## Features\n\n- 🔐 Generate deterministic P-256 keypairs from BIP39 mnemonic phrases\n- 🌐 Domain-specific key generation for WebAuthn/FIDO2 use cases\n- 🔄 Cross-platform compatibility (equivalent to Swift and Kotlin implementations)\n- 🧪 Comprehensive test coverage\n- 📦 Modern TypeScript with full type support\n\n## Installation\n\n```bash\nnpm install @algorandfoundation/dp256\n```\n\n## Usage\n\n### Basic Example\n\n```typescript\nimport { DeterministicP256 } from '@algorandfoundation/dp256';\n\nconst dp256 = new DeterministicP256();\n\n// Step 1: Generate derived main key from BIP39 phrase\nconst phrase =\n  'abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about';\nconst derivedKey = await dp256.genDerivedMainKeyWithBIP39(phrase);\n\n// Step 2: Generate domain-specific keypair\nconst privateKey = await dp256.genDomainSpecificKeyPair(\n  derivedKey,\n  'webauthn.example.com', // origin/domain\n  'alice@example.com' // user handle\n);\n\n// Step 3: Get public key bytes\nconst publicKeyBytes = dp256.getPurePKBytes(privateKey);\n\n// Step 4: Sign a payload\nconst payload = new TextEncoder().encode('authenticate user alice');\nconst signature = dp256.signWithDomainSpecificKeyPair(privateKey, payload);\n\nconsole.log('Private key length:', privateKey.length); // 32 bytes\nconsole.log('Public key length:', publicKeyBytes.length); // 64 bytes (X + Y coordinates)\nconsole.log('Signature length:', signature.length); // 64 bytes\n```\n\n### Advanced Configuration\n\n```typescript\n// Custom salt and iteration count\nconst customDerivedKey = await dp256.genDerivedMainKeyWithBIP39(\n  phrase,\n  new TextEncoder().encode('custom-salt'), // custom salt\n  100_000, // iteration count\n  512 // key length in bits\n);\n\n// Multiple keypairs for same domain using counter\nconst keypair1 = await dp256.genDomainSpecificKeyPair(derivedKey, 'example.com', 'user', 0);\nconst keypair2 = await dp256.genDomainSpecificKeyPair(derivedKey, 'example.com', 'user', 1);\n```\n\n## API Reference\n\n### `genDerivedMainKeyWithBIP39(phrase, salt?, iterationCount?, keyLength?)`\n\nGenerates a derived main key from a BIP39 mnemonic phrase using PBKDF2-HMAC-SHA512.\n\n- **phrase**: BIP39 mnemonic phrase\n- **salt**: Salt for key derivation (default: `\"liquid\"`)\n- **iterationCount**: PBKDF2 iterations (default: `210_000`)\n- **keyLength**: Key length in bits (default: `512`)\n\nReturns: `Promise<Uint8Array>`\n\n### `genDomainSpecificKeyPair(derivedMainKey, origin, userHandle, counter?)`\n\nGenerates a domain-specific P-256 private key.\n\n- **derivedMainKey**: Output from `genDerivedMainKeyWithBIP39`\n- **origin**: Domain/origin identifier\n- **userHandle**: User identifier\n- **counter**: Optional counter for multiple keys (default: `0`)\n\nReturns: `Promise<Uint8Array>`\n\n### `signWithDomainSpecificKeyPair(privateKey, payload)`\n\nSigns a payload using the private key.\n\n- **privateKey**: Private key from `genDomainSpecificKeyPair`\n- **payload**: Data to sign\n\nReturns: `Uint8Array` (64-byte signature)\n\n### `getPurePKBytes(privateKey)`\n\nExtracts the raw public key bytes from a private key.\n\n- **privateKey**: Private key from `genDomainSpecificKeyPair`\n\nReturns: `Uint8Array` (64-byte uncompressed public key coordinates)\n\n## Security Considerations\n\n- The BIP39 mnemonic phrase should be generated with sufficient entropy\n- Store the derived main key securely and never expose the original mnemonic\n- This library is designed for deterministic key generation across devices\n- The PBKDF2 iteration count provides additional security hardening\n\n## Development\n\n```bash\n# Install dependencies\nnpm install\n\n# Build\nnpm run build\n\n# Run tests\nnpm test\n\n# Run tests in watch mode\nnpm run test:watch\n```\n\n## License\n\nApache-2.0\n\n## Compatibility\n\nThis implementation is equivalent to the Swift and Kotlin versions and produces identical keypairs for the same inputs across all platforms.\n","readmeFilename":"README.md"}