Commit graph

9 commits

Author SHA1 Message Date
Dagur Valberg Johannsson
c8c1000ae7 Add multislot extension: multiple sig/pubkey placeholders per input
Extend inputPaths tuples with an optional 4th `slot` element so a single
contract input can carry several sig/pubkey placeholders, each filled by
a different key. Gated behind a `multislot` capability the wallet
advertises in wallet_ready (session["hdwalletv1"].extensions.multislot);
dapps must not send slotted/repeated-index requests otherwise.

- core: widen inputPaths to [number, PathName, number, number?]; accept
  3- or 4-tuples (non-negative integer slot) in isSignTransactionRequest;
  add EXT_MULTISLOT constant.
- wallet: fix extractContractSighashBytes so a filled pubkey placeholder
  is no longer mis-read as a signature (only signature-length pushes
  carry a sighash flag); export validateSighashFlags / isP2PKH.
- docs: protocol.md (slot semantics, placeholder byte format, capability
  negotiation, SIGHASH 0x41/0x61 reconciliation), extensions.md
  (multislot), wallet.md, dapp.md.
- tests: multislot-signing.test.ts reference fill; sighash-validation
  pubkey-placeholder regression + slot cases; validator slot accept/
  reject; integration repeated-index-with-slots passthrough.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 09:21:24 +02:00
Dagur Valberg Johannsson
b96cb8e151
Add chunk transport extension for oversized messages
Splits ProtocolMessages exceeding NIP-44's 65,535-byte plaintext ceiling
across multiple gift-wrapped events. Symmetric (both directions),
fire-and-forget, backward-compatible via a new transport-level
\`extensions\` field on \`dapp_ready\` and \`wallet_ready\`. Resolves the
\"Failed to swap: invalid plaintext size\" error on aggregated swap
requests and enables signed-tx responses up to the 1 MB BCH consensus
limit (~2 MB hex).
2026-04-21 14:58:12 +02:00
jakobsn
e852e70a8e Dedup connection: conn.dappDiscovered = false; 2026-04-03 12:35:50 +00:00
Dagur Valberg Johannsson
08ea3da6aa
Re-send signature request on ready
User may need some time to open their wallet to approve signature
request and miss it.

If we have a active request, re-send it if we see a
wallet_ready signal, suggesting the wallet was just opened.
2026-04-03 13:22:40 +02:00
Dagur Valberg Johannsson
4d1ba8e207
Add 'extensions' to hdwalletv1 protocol
This backward compatible change allows wallets/dapps to add additional
features outside the basic transaction signature support to the
hdwalletv1 protocol.
2026-03-26 10:50:40 +01:00
Dagur Valberg Johannsson
55ff82bbec
Document SIGHASH_ALL requirement 2026-03-18 10:31:06 +01:00
Dagur Valberg Johannsson
81a67825fe
Don't require input path for all inputs
Not all inputs need a signature; only require it for the input paths
that do.
2026-03-16 16:54:32 +01:00
Dagur Valberg Johannsson
8ef04218b4
Add input paths for a signature request
This solves an issue where wallet has to scan address ranges for each
derivation path and match it to locking script to figure out what
private key to use for signature.

This is a waste of effort and unnecessary complex for wallet
implementations since the dapp side already knows what inputs its using.
2026-03-16 15:27:18 +01:00
Dagur Valberg Johannsson
6fce9b47cb
First commit for WizardConnect 2026-03-06 11:38:09 +01:00