@ducat-unit/wallet-snap 0.1.5 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ducat-unit/wallet-snap",
3
- "version": "0.1.5",
3
+ "version": "0.2.0",
4
4
  "description": "Ducat Bitcoin account and signing Snap for MetaMask.",
5
5
  "keywords": [
6
6
  "ducat",
@@ -29,16 +29,7 @@
29
29
  "images/",
30
30
  "snap.manifest.json",
31
31
  "README.md",
32
- "LICENSE",
33
- "PRIVACY.md",
34
- "SECURITY.md",
35
- "SUPPORT.md",
36
- "RELEASE_CHECKLIST.md",
37
- "LISTING.md",
38
- "DEMO_SCRIPT.md",
39
- "AUDIT_SCOPE.md",
40
- "SNAPPER_REVIEW.md",
41
- "DEPENDENCY_AUDIT.md"
32
+ "LICENSE"
42
33
  ],
43
34
  "scripts": {
44
35
  "build": "mm-snap build",
@@ -50,15 +41,13 @@
50
41
  "verify": "npm run type-check && npm test && npm run build && npm run manifest",
51
42
  "lint": "npm run type-check && npm test",
52
43
  "audit:prod": "npm audit --omit=dev",
53
- "fixture:capture": "node scripts/capture-submission-fixture.mjs",
54
44
  "harness:accounts": "node scripts/snap-simulation-harness.mjs accounts",
55
45
  "harness:smoke-signing": "node scripts/snap-simulation-harness.mjs smoke-signing",
56
- "verify:harness": "npm run harness:accounts && npm run harness:smoke-signing",
57
- "snapper": "npx --yes @sayfer_io/snapper --path . --output snapper-report.json",
58
- "verify:metadata": "node scripts/verify-release-metadata.js",
59
- "verify:release-manifest": "node scripts/verify-release-manifest.js",
60
- "verify:fixtures": "DUCAT_REQUIRE_SUBMISSION_FIXTURES=1 jest --runTestsByPath src/__tests__/submission-fixtures.test.ts --runInBand",
61
- "verify:submission-ready": "node scripts/verify-submission-ready.js",
46
+ "harness:session": "node scripts/snap-simulation-harness.mjs session",
47
+ "harness:bitvm3-reclaim": "node scripts/snap-simulation-harness.mjs bitvm3-reclaim",
48
+ "harness:bitvm3-reclaim-reject": "node scripts/snap-simulation-harness.mjs bitvm3-reclaim-reject",
49
+ "verify:bitvm3": "npm run harness:bitvm3-reclaim && npm run harness:bitvm3-reclaim-reject",
50
+ "verify:harness": "npm run harness:accounts && npm run harness:smoke-signing && npm run verify:bitvm3",
62
51
  "verify:release": "bash scripts/verify-release.sh",
63
52
  "pack:dry-run": "npm pack --dry-run",
64
53
  "prepublishOnly": "npm run verify:release"
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.1.5",
2
+ "version": "0.2.0",
3
3
  "description": "Ducat Bitcoin accounts, Ducat-aware confirmations, and PSBT/message signing for MetaMask.",
4
4
  "proposedName": "Ducat",
5
5
  "repository": {
@@ -7,7 +7,7 @@
7
7
  "url": "git+https://github.com/DUCAT-UNIT/ducat-snap.git"
8
8
  },
9
9
  "source": {
10
- "shasum": "RE0s+LP6Soq0Xn0R8P+DA2ChhPOB2pasPp9BsJng5/Y=",
10
+ "shasum": "Kj7mZpspXKh+MdQJXSYSzeoyr3zkbkNOrHY4b0J0mNE=",
11
11
  "location": {
12
12
  "npm": {
13
13
  "filePath": "dist/bundle.js",
package/AUDIT_SCOPE.md DELETED
@@ -1,46 +0,0 @@
1
- # Ducat Snap Audit Scope
2
-
3
- This file defines the minimum security review scope before MetaMask allowlisting for `@ducat-unit/wallet-snap@0.1.5`.
4
-
5
- ## In Scope
6
-
7
- - `snap.manifest.json` permissions and allowed origins.
8
- - BIP32 entropy use for `m/84'/0'`, `m/86'/0'`, `m/84'/1'`, and `m/86'/1'`.
9
- - Local BIP32 child derivation in `src/bip32.ts`.
10
- - Account derivation in `src/accounts.ts`.
11
- - BIP322-style message signing in `src/message.ts`.
12
- - PSBT parsing, validation, summarization, and signing in `src/psbt.ts`.
13
- - Taproot script-path commitment verification in `src/psbt.ts`.
14
- - Ducat vault sequence and OP_RETURN return-data decoding in `src/psbt.ts`.
15
- - Transfer construction, signing, and broadcast in `src/transfer.ts`.
16
- - RPC routing and origin authorization in `src/rpc.ts`.
17
- - User confirmation content in `src/confirmations.ts`.
18
- - State storage in `src/state.ts`.
19
- - Home page network fetches in `src/home.ts`.
20
- - Build artifacts produced by `npm run verify:release`.
21
-
22
- ## Required Findings To Rule Out
23
-
24
- - Any path that exports, logs, stores, or returns private keys or raw entropy.
25
- - Any signing path that signs an input not explicitly listed in `signInputs`.
26
- - Any signing path that signs inputs for addresses not derived by the Snap.
27
- - Any irreversible operation that can proceed without a MetaMask confirmation.
28
- - Any mainnet request that uses a testnet key path, testnet address, or testnet broadcast endpoint, and any testnet request that uses a mainnet key path, mainnet address, or mainnet broadcast endpoint.
29
- - Any unauthorized origin able to invoke Snap RPC methods.
30
- - Any malformed PSBT, wrong-network PSBT, unknown address, or unknown input index that is accepted.
31
- - Any package dependency that violates MetaMask Snap SES constraints or creates avoidable key-management risk.
32
- - Any Taproot script-path behavior that signs a Ducat vault input without proving the tapleaf is a Ducat cosign leaf, commits to the prevout output key, contains the derived vault pubkey in the client slot, and uses distinct client and guard pubkeys.
33
-
34
- ## Audit Evidence
35
-
36
- The final audit package should include:
37
-
38
- - Public source repository URL.
39
- - Audited commit hash.
40
- - Fixed commit hash, if fixes are required.
41
- - `npm pack --dry-run` output.
42
- - `npm audit --omit=dev` output.
43
- - `npm run verify:release` output.
44
- - Snapper/security scan output.
45
- - Final `snap.manifest.json` shasum.
46
- - Demo video URL following `DEMO_SCRIPT.md`.
package/DEMO_SCRIPT.md DELETED
@@ -1,35 +0,0 @@
1
- # Ducat Snap Demo Script
2
-
3
- Use this script for the MetaMask allowlist/directory submission video. Record against the audited build and the same package version submitted to npm.
4
-
5
- ## Setup
6
-
7
- 1. Build and serve the Snap with `npm run verify` and `npm run serve`.
8
- 2. Configure the Ducat frontend with `NEXT_PUBLIC_DUCAT_SNAP_ID` pointing at the local Snap during pre-submission testing, or `npm:@ducat-unit/wallet-snap` for the npm build.
9
- 3. Use the audited network being demonstrated. For mainnet demos, use small controlled amounts and the audited production validator/frontend configuration.
10
- 4. Fund the Snap-derived sats account with BTC for the selected network.
11
-
12
- ## Recording Steps
13
-
14
- 1. Open the Ducat frontend and choose MetaMask from the wallet list.
15
- 2. Show the MetaMask Snap install request and permissions.
16
- 3. Approve the Snap installation.
17
- 4. Connect and show the derived `sats`, `runes`, and `vault` addresses in the Ducat app.
18
- 5. Open MetaMask Snap home and show account addresses, BTC balance, UNIT balance, vault status, recent actions, clickable HTTPS app links, and copyable local routes.
19
- 6. Execute or stage a create-vault flow and show the compact Ducat PSBT confirmation summary, inputs, outputs, fees, warnings, and app metadata.
20
- 7. Execute or stage deposit BTC and show the confirmation summary.
21
- 8. Execute or stage borrow UNIT and show the confirmation summary.
22
- 9. Execute or stage repay UNIT and show the confirmation summary.
23
- 10. Execute or stage withdraw BTC and show the confirmation summary.
24
- 11. Execute or stage UNIT swap and show the confirmation summary.
25
- 12. Execute or stage liquidation/repossess and show the batch confirmation.
26
- 13. Sign an authentication message and show the message confirmation.
27
- 14. Disable and re-enable the Snap, then reconnect from the Ducat frontend.
28
-
29
- ## Evidence To Capture
30
-
31
- - Every irreversible signing action shows a MetaMask confirmation.
32
- - Confirmations include origin, network, signed input indexes, output summary, and fee when calculable.
33
- - Private keys are never exported or shown.
34
- - Mainnet, signet, and mutinynet all use the expected network-specific addresses, validator endpoints, and broadcast endpoints.
35
- - Xverse and UniSat remain available in the wallet list.
@@ -1,36 +0,0 @@
1
- # Dependency Audit Notes
2
-
3
- Last local production audit:
4
-
5
- ```bash
6
- npm run audit:prod
7
- ```
8
-
9
- Result: 0 production vulnerabilities.
10
-
11
- Last local full audit:
12
-
13
- ```bash
14
- npm audit
15
- ```
16
-
17
- Result: 31 development-toolchain vulnerabilities, all low or moderate.
18
-
19
- ## Current Assessment
20
-
21
- The published Snap package contains the production bundle and release metadata. `npm audit --omit=dev` is clean for production dependencies.
22
-
23
- Direct `dependencies` and `devDependencies` in `package.json` are pinned to exact versions. Transitive dependency versions are locked by `package-lock.json`.
24
-
25
- The full audit findings are in development tooling paths, primarily transitive dependencies of MetaMask Snap build/test tooling. `npm audit fix --package-lock-only` did not resolve them. npm reports that the remaining forced path would install older breaking versions of MetaMask Snap packages, so it was not applied locally.
26
-
27
- ## Release Requirement
28
-
29
- Before public submission, re-run:
30
-
31
- ```bash
32
- npm audit
33
- npm run audit:prod
34
- ```
35
-
36
- Then review whether newer compatible MetaMask Snap SDK/CLI releases are available, or document auditor approval for the remaining dev-toolchain findings if production dependencies remain clean.
package/LISTING.md DELETED
@@ -1,44 +0,0 @@
1
- # Ducat Snap Listing
2
-
3
- ## Short Description
4
-
5
- Ducat Bitcoin accounts and Ducat-aware transaction signing in MetaMask.
6
-
7
- ## Long Description
8
-
9
- Ducat is a MetaMask Snap for using Ducat with Bitcoin mainnet, signet, and mutinynet accounts derived inside MetaMask. The Snap derives deterministic Bitcoin accounts from the user's MetaMask Secret Recovery Phrase, keeps private keys inside MetaMask, and signs only explicit PSBT inputs requested by the Ducat web app.
10
-
11
- The Ducat web app remains the action surface for create, deposit, borrow, repay, withdraw, swap, liquidation, and repossess flows. The Snap provides account discovery, BIP322-style message signing, PSBT signing, batch PSBT signing, a simple transfer path, Ducat-aware MetaMask confirmations, pending/completed/failed action notifications, recent action history, and a Snap home page with copyable account addresses, BTC/UNIT balance, vault summary lookups, recent activity, and Ducat app routes.
12
-
13
- Mainnet is enabled in this audit candidate and must be covered by the third-party review before production distribution.
14
-
15
- ## Permissions Rationale
16
-
17
- - `endowment:rpc`: Allows only approved Ducat frontend origins to invoke the Snap.
18
- - `snap_getBip32Entropy`: Derives Bitcoin account keys for `m/84'/0'`, `m/86'/0'`, `m/84'/1'`, and `m/86'/1'`.
19
- - `snap_dialog`: Shows mandatory confirmations before message signing, PSBT signing, batch signing, or transfers.
20
- - `snap_manageState`: Stores recent Ducat action metadata for Snap home.
21
- - `snap_notify`: Shows informational MetaMask notifications for pending approvals, completed actions, and failed non-rejection actions.
22
- - `endowment:page-home`: Shows Ducat account status and Ducat app routes in MetaMask.
23
- - `endowment:network-access`: Fetches public balance, vault, fee, UTXO, and broadcast data.
24
- - `endowment:lifecycle-hooks`: Shows the install notice.
25
-
26
- ## Screenshot Checklist
27
-
28
- - Install approval screen for the Ducat Snap.
29
- - Ducat app wallet modal showing MetaMask as a connector.
30
- - Connected Ducat account addresses.
31
- - PSBT confirmation for create or deposit showing an action title, origin, network, compact summary rows, signed input details, output details, fees, warnings, and Ducat app metadata.
32
- - Batch confirmation for liquidation or repossess showing all-or-nothing signing, per-transaction rows, total fee, and warnings.
33
- - Message signing confirmation showing origin, network, signing account, BIP322 signature type, message fingerprint, message length, and copyable message body.
34
- - Transfer confirmation showing amount, fee, the `You pay` amount, change, sender, recipient, selected UTXOs, and broadcast endpoint.
35
- - Snap home showing structured cards for accounts, BTC balance, UNIT balance, vault status, recent actions, clickable HTTPS app links, and copyable local development routes.
36
-
37
- ## Listing Asset Checklist
38
-
39
- - Square icon: `images/icon.svg`.
40
- - Screenshots captured from the audited build.
41
- - Demo video following `DEMO_SCRIPT.md`.
42
- - Privacy policy from `PRIVACY.md` or approved legal URL.
43
- - Support and escalation contact from `SUPPORT.md`.
44
- - Security disclosure process from `SECURITY.md`.
package/PRIVACY.md DELETED
@@ -1,13 +0,0 @@
1
- # Privacy Policy
2
-
3
- Last updated: 2026-06-12
4
-
5
- The Ducat Snap derives Bitcoin accounts locally inside MetaMask using the user's MetaMask Secret Recovery Phrase. Private keys never leave MetaMask.
6
-
7
- The Snap stores only recent Ducat action metadata needed for the Snap home page, such as action type, action title, status, network, origin, timestamp, approximate amount, summary text, and transaction IDs. The Snap also remembers the last connected Ducat app origin and network so Snap Home can show the correct testnet and Ducat app routes.
8
-
9
- The Snap may query public Bitcoin indexer APIs and Ducat validator APIs to display balances, display vault status, estimate fees, fetch UTXOs, and broadcast transactions. Those services may receive public Bitcoin addresses, transaction identifiers, requested network, and normal request metadata such as IP address and user agent.
10
-
11
- The Snap does not collect analytics, sell user data, or expose private keys. The Snap does not store seed phrases, private keys, or signed transaction secrets in Snap state.
12
-
13
- Users can remove locally stored recent-action metadata by invoking the confirmed `ducat_clearRecentActions` RPC method from an approved Ducat frontend origin, or by removing the Snap from MetaMask.
@@ -1,55 +0,0 @@
1
- # Ducat Snap Release Checklist
2
-
3
- ## Completed For `0.1.5`
4
-
5
- - [x] Public repository contains the audit-candidate source tag.
6
- - [x] Audit candidate tag exists after the final handoff commit: `audit-candidate-0.1.5-20260615-audit-confirmation-hardening`.
7
- - [ ] `.github/workflows/verify.yml` succeeds on the current audit candidate.
8
- - [x] `npm run verify:release` succeeds locally.
9
- - [x] `npm run pack:dry-run` output reviewed.
10
- - [x] `npm run audit:prod` output reviewed.
11
- - [x] Dependency audit reviewed.
12
- - [x] Snapper/security scan reviewed.
13
- - [x] Console logs, unused permissions, accidental placeholders, and dead RPC methods removed or documented as external gates.
14
- - [x] Legacy Taproot script-path compatibility behavior removed and replaced with committed tapleaf verification.
15
- - [x] Deterministic MetaMask simulation harness covers account derivation and owned P2WPKH PSBT signing.
16
- - [x] Mainnet derivation, network parsing, endpoint selection, and release metadata added to the audit candidate.
17
- - [x] `@ducat-unit/wallet-snap@0.1.5` release metadata prepared for audit handoff.
18
- - [ ] Frontend PR #675 default Snap version range updated to `^0.1.5`.
19
-
20
- ## Required Before MetaMask Submission
21
-
22
- - [ ] Third-party audit completed because the Snap uses `snap_getBip32Entropy`.
23
- - [ ] Audit fixes merged and tagged, if the audit requires fixes.
24
- - [ ] `submission/metamask-directory.json` pending external fields are replaced.
25
- - [ ] `submission/ALLOWLIST_SUBMISSION.md` pending external fields are replaced.
26
- - [ ] Real create/deposit/borrow/repay/withdraw/swap/liquidation/repossess PSBT fixtures captured in `submission/fixtures/`.
27
- - [ ] Final mainnet/signet/mutinynet E2E evidence captured in `submission/e2e/evidence.json`.
28
- - [ ] Final screenshots captured in `submission/screenshots/`.
29
- - [ ] Demo video recorded with `DEMO_SCRIPT.md`.
30
- - [ ] Production support, escalation, and response-time details finalized.
31
- - [ ] `npm run verify:submission-ready` succeeds after external evidence is complete.
32
-
33
- ## Listing Assets
34
-
35
- - [x] Icon: `images/icon.svg`.
36
- - [x] Short description from `LISTING.md`.
37
- - [x] Long description from `LISTING.md`.
38
- - [x] Privacy policy source: `PRIVACY.md`.
39
- - [x] Security disclosure source: `SECURITY.md`.
40
- - [x] Support source: `SUPPORT.md`.
41
- - [ ] Final PNG screenshots captured from the audited build.
42
- - [ ] Demo video recorded from the audited build.
43
- - [ ] Support and escalation contact copied into the submission form.
44
-
45
- ## Submission
46
-
47
- - [ ] Submit MetaMask allowlist/directory request with the audited commit, fixed commit if any, audit report, npm URL, public repository URL, demo video, support details, and listing assets.
48
- - [ ] MetaMask allowlist approval received.
49
-
50
- ## Production Cutover
51
-
52
- - [ ] Frontend production config uses `NEXT_PUBLIC_DUCAT_SNAP_ID=npm:@ducat-unit/wallet-snap`.
53
- - [ ] Frontend production config uses the approved release range in `NEXT_PUBLIC_DUCAT_SNAP_VERSION`.
54
- - [ ] Existing Xverse and UniSat regression flows pass.
55
- - [ ] Mainnet/signet/mutinynet install, connect, create, deposit, borrow, repay, withdraw, swap, liquidation, and repossess E2E scenarios pass.
package/SECURITY.md DELETED
@@ -1,12 +0,0 @@
1
- # Security
2
-
3
- Report security issues privately to the Ducat maintainers before public disclosure.
4
-
5
- Release requirements:
6
-
7
- - Third-party audit for key-management usage of `snap_getBip32Entropy`.
8
- - MetaMask allowlist/directory review before production distribution.
9
- - Production dependency audit and Snapper/security scan for every release candidate.
10
- - Mainnet key derivation, signing, and broadcast support must be covered by the third-party audit before production distribution.
11
-
12
- `@ducat-unit/wallet-snap@0.1.5` supports mainnet, signet, and mutinynet. It signs only explicit PSBT input indexes that match Snap-derived addresses and requires MetaMask confirmation before message, PSBT, batch, or transfer signing.
package/SNAPPER_REVIEW.md DELETED
@@ -1,36 +0,0 @@
1
- # Snapper Review
2
-
3
- Last local command:
4
-
5
- ```bash
6
- npx --yes @sayfer_io/snapper --path . --output snapper-report.json
7
- ```
8
-
9
- Local result: 221 findings across the `ESLinting`, `ExcessiveComments`, and `HardcodedSecrets` categories.
10
-
11
- The three `HardcodedSecrets` findings are the Ducat guardian x-only **public** key (`ef8e6d84…ca2e`) hardcoded per network in `src/networks.ts`. It is a public key that is intended to be embedded so the Snap can pin the vault cosigner identity; it is not a secret. The remaining findings are style/comment-density scanner policy, not signing, key-export, origin-authorization, confirmation-bypass, or network-scope findings.
12
-
13
- ## Addressed Findings
14
-
15
- The first local scan reported 105 findings. The implementation now fixes the non-style/high-signal findings from that run:
16
-
17
- - Removed an unused `Buffer` import.
18
- - Replaced empty catch handling with explicit behavior.
19
- - Removed duplicate taproot key update catch logic by validating `tapInternalKey` before signing.
20
- - Removed an unused function parameter.
21
- - Removed an unused type import introduced during the confirmation cleanup.
22
- - Replaced `||` fallback logic with `??` where empty strings should remain meaningful.
23
- - Removed the content-type false positive from the hardcoded-secret detector.
24
-
25
- ## Remaining Finding Summary
26
-
27
- - 178 missing JSDoc comments.
28
- - External API response fields using snake_case, such as Esplora and Ducat validator fields (`funded_txo_sum`, `spent_txo_sum`, `chain_stats`, `mempool_stats`, `asset_balance`, `unit_balance`, and vault summary fields).
29
- - One object literal key using `vault_pubkey`, matching the Ducat validator API.
30
- - One `hmac(sha512, ...)` style warning in local BIP32 derivation.
31
-
32
- ## Review Notes
33
-
34
- The remaining findings should be reviewed by the external Snap auditor, but they are not currently treated as local release blockers because they are style or scanner-policy findings rather than signing, key-export, origin-authorization, confirmation-bypass, or network-scope findings.
35
-
36
- The generated `snapper-report.json` is intentionally ignored and not included in the npm package because it contains machine-local absolute paths. Keep it with release evidence for the audited commit rather than committing it to the public source repository.
package/SUPPORT.md DELETED
@@ -1,9 +0,0 @@
1
- # Support
2
-
3
- Use the Ducat Snap repository issue tracker for development support and bug reports:
4
-
5
- https://github.com/DUCAT-UNIT/ducat-snap/issues
6
-
7
- Security issues should not be filed as public issues. Follow `SECURITY.md` for private disclosure.
8
-
9
- Before MetaMask directory submission, copy the final public support URL, private escalation contact, and response-time expectation into `submission/ALLOWLIST_SUBMISSION.md`.