{"_id":"@asylia/btc-core","_rev":"3-554082f6469a6ccecf43f6149ada773a","name":"@asylia/btc-core","dist-tags":{"latest":"1.0.1"},"versions":{"0.1.0":{"name":"@asylia/btc-core","version":"0.1.0","keywords":["bitcoin","multisig","p2wsh","wsh","sortedmulti","bip48","bip380","psbt","psbt-v2","bip370","descriptor","bitcoin-descriptor","coin-selection","hardware-wallet","typescript","self-custody","asylia"],"author":{"name":"Asylia"},"license":"MIT","_id":"@asylia/btc-core@0.1.0","maintainers":[{"name":"asylion21","email":"infodavidzita@gmail.com"}],"homepage":"https://github.com/Asylia/bitcoin-toolkit/tree/main/packages/btc-core#readme","bugs":{"url":"https://github.com/Asylia/bitcoin-toolkit/issues"},"dist":{"shasum":"a1276e43b954f0db78d65b2ba62ec0b5ea64bfa0","tarball":"https://registry.npmjs.org/@asylia/btc-core/-/btc-core-0.1.0.tgz","fileCount":8,"integrity":"sha512-ZDSi7ls8MUnS+wrBHdPOmVrZ5x0AZCRHtiSnZje6oIgzjFrnxjfru0l75hWm4TMyxRmVcoE9ssxVwpNsdFPbmA==","signatures":[{"sig":"MEQCIDeO24sEFKBMvVidI0knI3EwvmfXw7pC72VsYhZbfQTLAiBqUsod9EqUA4i58d7aSA2s2xMzjNUHpBsYX7wKD5ZOdg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":403418},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"lint":"eslint .","test":"vitest run","build":"tsup src/index.ts --format esm --dts --sourcemap --clean --out-dir dist --tsconfig tsconfig.build.json","clean":"rimraf dist .turbo node_modules/.tmp","type-check":"tsc --noEmit","test:coverage":"vitest run --coverage"},"_npmUser":{"name":"asylion21","email":"infodavidzita@gmail.com"},"repository":{"url":"git+https://github.com/Asylia/bitcoin-toolkit.git","type":"git","directory":"packages/btc-core"},"_npmVersion":"10.9.2","description":"Auditable Bitcoin TypeScript core for native-SegWit P2WSH multisig, BIP-48 derivation, BIP-380 descriptors, PSBT v2, signature verification, and coin selection.","directories":{},"_nodeVersion":"22.14.0","dependencies":{"bip32":"^5.0.1","@caravan/psbt":"^2.1.0","@noble/hashes":"^1.8.0","bitcoinjs-lib":"^7.0.1","@bitcoinerlab/secp256k1":"^1.2.0"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.1","rimraf":"^6.1.3","vitest":"^4.1.5","typescript":"^6.0.3","@vitest/coverage-v8":"^4.1.5"},"_npmOperationalInternal":{"tmp":"tmp/btc-core_0.1.0_1777723328510_0.42306323881662755","host":"s3://npm-registry-packages-npm-production"}},"1.0.0":{"name":"@asylia/btc-core","version":"1.0.0","keywords":["bitcoin","multisig","p2wsh","wsh","sortedmulti","bip48","bip380","psbt","psbt-v2","bip370","descriptor","bitcoin-descriptor","coin-selection","hardware-wallet","typescript","self-custody","asylia"],"author":{"name":"Asylia"},"license":"MIT","_id":"@asylia/btc-core@1.0.0","maintainers":[{"name":"asylion21","email":"infodavidzita@gmail.com"}],"homepage":"https://github.com/Asylia/bitcoin-toolkit/tree/main/packages/btc-core#readme","bugs":{"url":"https://github.com/Asylia/bitcoin-toolkit/issues"},"dist":{"shasum":"28bedc398e23d6710444cc29bef7f677247c5714","tarball":"https://registry.npmjs.org/@asylia/btc-core/-/btc-core-1.0.0.tgz","fileCount":8,"integrity":"sha512-nvjGWSXJVgS3XFvTYG1lCXxXk9ZHJvt/TOrsRNe1O66x5cDNXPb6H+4LI628hWq2wBM+x1PMQ5AJUUJi0ggpPA==","signatures":[{"sig":"MEUCIQDa/mSuWzFMdJmK1c0ApYdtNTdOXjikY9Kk9E3CNKTBwgIgEUSkFd6wctXCRXrbV32zG9Q1LrwTSsV8AQrW26XZyJQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":410439},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"9472028259c7ecd4e1becd42fd837267dfdd7fca","scripts":{"lint":"eslint .","test":"vitest run","build":"tsup src/index.ts --format esm --dts --sourcemap --clean --out-dir dist --tsconfig tsconfig.build.json","clean":"rimraf dist .turbo node_modules/.tmp","type-check":"tsc --noEmit","test:coverage":"vitest run --coverage"},"_npmUser":{"name":"asylion21","email":"infodavidzita@gmail.com"},"repository":{"url":"git+https://github.com/Asylia/bitcoin-toolkit.git","type":"git","directory":"packages/btc-core"},"_npmVersion":"10.9.2","description":"Auditable Bitcoin TypeScript core for native-SegWit P2WSH multisig, BIP-48 derivation, BIP-380 descriptors, PSBT v2, signature verification, and coin selection.","directories":{},"_nodeVersion":"22.14.0","dependencies":{"bip32":"^5.0.1","@caravan/psbt":"^2.1.0","@noble/hashes":"^1.8.0","bitcoinjs-lib":"^7.0.1","@bitcoinerlab/secp256k1":"^1.2.0"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.1","rimraf":"^6.1.3","vitest":"^4.1.5","typescript":"^6.0.3","@vitest/coverage-v8":"^4.1.5"},"_npmOperationalInternal":{"tmp":"tmp/btc-core_1.0.0_1777891158704_0.628326199106447","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@asylia/btc-core","version":"1.0.1","type":"module","description":"Auditable Bitcoin TypeScript core for native-SegWit P2WSH multisig, BIP-48 derivation, BIP-380 descriptors, PSBT v2, signature verification, and coin selection.","license":"MIT","author":{"name":"Asylia"},"repository":{"type":"git","url":"git+https://github.com/Asylia/bitcoin-toolkit.git","directory":"packages/btc-core"},"homepage":"https://github.com/Asylia/bitcoin-toolkit/tree/main/packages/btc-core#readme","bugs":{"url":"https://github.com/Asylia/bitcoin-toolkit/issues"},"keywords":["bitcoin","multisig","p2wsh","wsh","sortedmulti","bip48","bip380","psbt","psbt-v2","bip370","descriptor","bitcoin-descriptor","coin-selection","hardware-wallet","typescript","self-custody","asylia"],"main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"build":"tsup src/index.ts --format esm --dts --sourcemap --clean --out-dir dist --tsconfig tsconfig.build.json","type-check":"tsc --noEmit","lint":"eslint .","test":"vitest run","test:coverage":"vitest run --coverage","clean":"rimraf dist .turbo node_modules/.tmp"},"devDependencies":{"@vitest/coverage-v8":"^4.1.6","eslint":"^10.3.0","rimraf":"^6.1.3","tsup":"^8.5.1","typescript":"^6.0.3","vitest":"^4.1.6"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"dependencies":{"@bitcoinerlab/secp256k1":"^1.2.0","@caravan/psbt":"^2.1.0","@noble/hashes":"^1.8.0","bip32":"^5.0.1","bitcoinjs-lib":"^7.0.1"},"_id":"@asylia/btc-core@1.0.1","gitHead":"d269e09a317e911fc1438e068c02a209abc5dac4","_nodeVersion":"21.7.3","_npmVersion":"10.7.0","dist":{"integrity":"sha512-52eHk8KXZbHAqRSPrekIt0l8gSWSRV0GmBErNlgQdF3gvNJoc92Al90pqXDALMIQbq3yEeQh7/72XpOSWcnykw==","shasum":"1b1242cc704062201453dd682b718f383643a05b","tarball":"https://registry.npmjs.org/@asylia/btc-core/-/btc-core-1.0.1.tgz","fileCount":8,"unpackedSize":490649,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCICy1gvn4T3GI7dPvQTSDFHvKHyBLcAx73ph7csrI41s2AiBhHIC4q81zWPgkHR+J904d4/LC1mwqvyNBhnV3PEi9nw=="}]},"_npmUser":{"name":"asylion21","email":"infodavidzita@gmail.com"},"directories":{},"maintainers":[{"name":"asylion21","email":"infodavidzita@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/btc-core_1.0.1_1778785887197_0.674611108400009"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-02T12:02:08.380Z","modified":"2026-05-14T19:11:27.529Z","0.1.0":"2026-05-02T12:02:08.656Z","1.0.0":"2026-05-04T10:39:18.882Z","1.0.1":"2026-05-14T19:11:27.362Z"},"bugs":{"url":"https://github.com/Asylia/bitcoin-toolkit/issues"},"author":{"name":"Asylia"},"license":"MIT","homepage":"https://github.com/Asylia/bitcoin-toolkit/tree/main/packages/btc-core#readme","keywords":["bitcoin","multisig","p2wsh","wsh","sortedmulti","bip48","bip380","psbt","psbt-v2","bip370","descriptor","bitcoin-descriptor","coin-selection","hardware-wallet","typescript","self-custody","asylia"],"repository":{"type":"git","url":"git+https://github.com/Asylia/bitcoin-toolkit.git","directory":"packages/btc-core"},"description":"Auditable Bitcoin TypeScript core for native-SegWit P2WSH multisig, BIP-48 derivation, BIP-380 descriptors, PSBT v2, signature verification, and coin selection.","maintainers":[{"name":"asylion21","email":"infodavidzita@gmail.com"}],"readme":"<p align=\"center\">\n  <img src=\"../../apps/wallet/resources/logo.svg\" alt=\"Asylia\" width=\"96\" />\n</p>\n\n# @asylia/btc-core\n\nFramework-agnostic Bitcoin primitives for the Asylia self-custody platform:\nnative-SegWit P2WSH multisig descriptors, BIP-48 derivation, deterministic\naddress generation, PSBT v2 construction and inspection, signature verification,\nand coin-selection helpers.\n\nThis is the core audit package behind Asylia's wallet. It contains no Vue, DOM,\nSupabase, browser storage, or product UI code. The same functions can run in the\nwallet SPA, a future Capacitor signer, Node-based audit tooling, or independent\nreview harnesses.\n\nKeywords: Bitcoin, multisig, P2WSH, `wsh(sortedmulti(...))`, BIP-48, BIP-380,\nPSBT v2, BIP-370, descriptor checksum, hardware wallet signing, TypeScript,\nself-custody.\n\n## Maintainer And Support\n\n`@asylia/btc-core` is maintained by [Asylian21](https://github.com/Asylian21).\n\n> **Support Asylia Bitcoin tooling**\n>\n> If this work helps your wallet, audit, integration, or research, you can\n> support ongoing development with a Bitcoin donation:\n> `bc1qrdchup8497xz0972v35q4nr0fx5egghf0z23c3`\n\n## Status\n\n`1.0.0`. The package ships the stable Asylia Bitcoin primitive API for the\nnative-SegWit multisig wallet toolkit.\n\n## Installation\n\n```bash\nnpm install @asylia/btc-core\n```\n\n## Script Policy\n\n`@asylia/btc-core` supports exactly one wallet script family:\n\n```text\nwsh(sortedmulti(N, key1, key2, ...))\n```\n\nAsylia uses the native-SegWit BIP-48 multisig branch:\n\n```text\nm/48'/0'/0'/2'\n```\n\nThe package does not expose a generic script-type switch. Nested SegWit\nP2SH-P2WSH (`sh(wsh(...))`), Taproot, legacy P2PKH, and arbitrary scripts are\nintentionally out of scope. A single script family keeps descriptor building,\naddress derivation, PSBT construction, hardware-wallet mapping, and audits small\nenough to reason about carefully.\n\n## Public API\n\nEvery public export is defined by the source barrel and published from the\npackage root. The most important surfaces are:\n\n| Area | Exports |\n| --- | --- |\n| Descriptors | `buildWshSortedMultiDescriptor`, `descriptorChecksum`, `withChecksum`, `toCanonicalXpub` |\n| Imports | `parseAsyliaVaultConfig`, `parseCaravanWalletConfig`, `parseSparrowWalletConfig`, `parseDescriptorImport` |\n| Vault identity | `vaultIdentityKey` |\n| Address derivation | `deriveWshSortedMultiAddress`, `deriveWshSortedMultiAddressBatch`, `buildWshSortedMultiInstance` |\n| Address parsing | `parseBitcoinAddress`, `describeBitcoinAddressType` |\n| PSBT build/inspect/policy | `buildWshSortedMultiPsbt`, `extractPsbtInputs`, `inspectPsbtV2`, `checkWshSortedMultiPsbtPolicy`, `addressFromScript`, `bip32PathToAddressN` |\n| Signatures | `addPartialSignaturesToPsbt`, `computeBip143SighashAll`, `verifySegwitV0SignatureAgainstPubkey`, `findSegwitV0SignatureOwner`, `findSegwitV0SignatureOwnerForPsbt` |\n| Finalization | `countPsbtSigners`, `collectSignerFingerprints`, `finaliseAndExtractTransaction` |\n| Coin selection | `selectCoinsLargestFirst`, `selectCoinsLargestFirstFixedFee`, `maxSpendableSats` |\n\n## Example\n\n```ts\nimport {\n  buildWshSortedMultiDescriptor,\n  deriveWshSortedMultiAddress,\n} from '@asylia/btc-core';\n\nconst keys = [\n  {\n    fingerprint: 'd34db33f',\n    derivationPath: \"48'/0'/0'/2'\",\n    xpub: 'xpub...',\n  },\n  {\n    fingerprint: 'f00dbabe',\n    derivationPath: \"48'/0'/0'/2'\",\n    xpub: 'xpub...',\n  },\n  {\n    fingerprint: '8badf00d',\n    derivationPath: \"48'/0'/0'/2'\",\n    xpub: 'xpub...',\n  },\n] as const;\n\nconst descriptor = buildWshSortedMultiDescriptor({\n  network: 'mainnet',\n  requiredSignatures: 2,\n  keys,\n});\n\nconst firstReceive = deriveWshSortedMultiAddress({\n  network: 'mainnet',\n  requiredSignatures: 2,\n  keys,\n  chain: 0,\n  index: 0,\n});\n```\n\n## Import Guarantees\n\nImport helpers normalize Asylia, Caravan, Sparrow, raw BIP-380 descriptor, and\nBitcoin Core `importdescriptors` inputs into one `ParsedMultisigImport` shape.\nValidation is strict by design:\n\n- mainnet only,\n- native P2WSH only,\n- valid BIP-380 checksum when supplied,\n- valid fingerprints, derivation paths, and xpub material,\n- deterministic signer ordering for duplicate detection.\n\nMalformed input is rejected at the boundary instead of becoming a broken vault\nrow downstream.\n\n## PSBT and Hardware Wallets\n\nThe PSBT surface is designed for hardware-wallet adapters:\n\n- `buildWshSortedMultiPsbt` creates PSBT v2 spends with witness scripts and\n  per-cosigner BIP-32 derivation metadata.\n- `inspectPsbtV2` gives adapters a typed view of inputs, outputs, existing\n  partial signatures, and derivation records.\n- `computeBip143SighashAll` and `findSegwitV0SignatureOwner` let adapters verify\n  that a returned signature belongs to the expected cosigner before it is merged.\n- `addressFromScript` lets adapters recover standard recipient addresses for\n  device prompts.\n\n## Hardened PSBT Policy\n\n`checkWshSortedMultiPsbtPolicy` is the shared policy checker used by the wallet\nand the `proposal-psbt` Edge Function before a signed proposal is trusted. It\nvalidates:\n\n- the exact input set and values reserved for the proposal,\n- the expected recipient and optional platform-fee recipient allowlist,\n- the expected recipient amount,\n- wallet change output shape and derivation,\n- vbyte, absolute-fee, fee-rate, and amount bounds,\n- optional required signer fingerprint,\n- optional final raw transaction binding.\n\n`expectedChange` is nullable on purpose. A no-change drain passes\n`expectedChange: null`, and the checker then requires the PSBT to contain no\nwallet change output. If change is expected, there must be exactly one wallet\nchange output and it must match the derived P2WSH script, address, amount,\nchain `1`, and concrete index supplied by the caller.\n\n## Not in Scope\n\nThis package does not:\n\n- store seed phrases, private keys, passphrases, or hardware-wallet secrets,\n- fetch blockchain data,\n- broadcast transactions,\n- own wallet persistence,\n- render UI,\n- depend on Vue, Supabase, or any Asylia application module,\n- support scripts outside `wsh(sortedmulti(...))`.\n\nIf a feature needs upstream chain data, use `@asylia/blockchain-data-btc`. If it\nneeds a device SDK, use `@asylia/hw-trezor` or `@asylia/hw-ledger`.\n\n## Testing\n\n```bash\nyarn workspace @asylia/btc-core type-check\nyarn workspace @asylia/btc-core test\nyarn workspace @asylia/btc-core test:coverage\n```\n\n## Versioning and Audit Stance\n\nStable releases use semantic versioning, changelog entries, git tags, and\ndocumented audit scope. Vulnerability disclosure is covered in\n[`SECURITY.md`](./SECURITY.md).\n\n## License\n\nMIT - see [`LICENSE`](./LICENSE).\n","readmeFilename":"README.md"}