@qntx/wallet-native 0.11.0 → 0.12.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.
@@ -901,7 +901,7 @@
901
901
  var init_objectSpread2 = __esmMin((() => {
902
902
  init_defineProperty();
903
903
  }));
904
- // packages/wallet/dist/protocol-DqBfdhN5.mjs
904
+ // packages/wallet/dist/protocol-C8x0H3Rr.mjs
905
905
  init_objectSpread2();
906
906
  /**
907
907
  * Backup-envelope wire validators (design/backup.mdx): the strict structural shape the kernel and
@@ -942,6 +942,7 @@
942
942
  createdAt: safeTime
943
943
  });
944
944
  var template = union(literal("evm.bip44"), literal("solana.bip44-change"), union(literal("btc.bip44"), literal("btc.bip49"), literal("btc.bip84")), literal("btc.bip86"));
945
+ var btcTemplate = union(literal("btc.bip44"), literal("btc.bip49"), literal("btc.bip84"), literal("btc.bip86"));
945
946
  var caip2 = str(200, /^[a-z0-9-]{3,64}:[0-9a-zA-Z-]{1,128}$/);
946
947
  var addressResult = (t) => obj({
947
948
  template: literal(t),
@@ -1022,9 +1023,16 @@
1022
1023
  }), obj({
1023
1024
  kind: literal("bitcoin.psbt"),
1024
1025
  network: caip2,
1025
- account: accountRef,
1026
+ account: obj({
1027
+ kind: literal("hd"),
1028
+ walletId,
1029
+ groupIndex
1030
+ }),
1026
1031
  psbt: bytes(1, 131072),
1027
- sign: arr(int(0, 1024), 1024)
1032
+ sign: arr(obj({
1033
+ index: int(0, 1024),
1034
+ template: btcTemplate
1035
+ }), 1024)
1028
1036
  }), obj({
1029
1037
  kind: literal("bitcoin.message"),
1030
1038
  network: caip2,
@@ -19758,13 +19766,21 @@ zoo`.split("\n"));
19758
19766
  };
19759
19767
  var DEFAULT_SIGHASH = 0;
19760
19768
  var SIGHASH_ALL = 1;
19769
+ var TEMPLATES = /* @__PURE__ */ new Set([
19770
+ "btc.bip44",
19771
+ "btc.bip49",
19772
+ "btc.bip84",
19773
+ "btc.bip86"
19774
+ ]);
19775
+ var isSignEntry = (value) => isRecord$1$1(value) && typeof value["index"] === "number" && Number.isSafeInteger(value["index"]) && value["index"] >= 0 && typeof value["template"] === "string" && TEMPLATES.has(value["template"]);
19761
19776
  var isTaprootInput = (input) => input.tapInternalKey !== void 0 || getInputType(input).type === "taproot";
19762
19777
  /**
19763
19778
  * Validates and canonicalizes a bitcoin.psbt request (network already checked by the caller).
19764
19779
  * `strictPrevoutValidation` makes btc-signer verify every `nonWitnessUtxo`'s txid against its
19765
- * outpoint.
19780
+ * outpoint. The returned `sign` is sorted ascending by index — a normalized request is canonical.
19766
19781
  */
19767
19782
  var normalizeBitcoinPsbt = (psbt, sign, network) => {
19783
+ var _sorted$at;
19768
19784
  const net = bitcoinNetwork(network);
19769
19785
  let tx;
19770
19786
  try {
@@ -19772,15 +19788,16 @@ zoo`.split("\n"));
19772
19788
  } catch (_unused) {
19773
19789
  throw new ChainError("invalid-request", "PSBT failed to decode");
19774
19790
  }
19775
- if (!Array.isArray(sign) || sign.length === 0 || !sign.every((i) => Number.isSafeInteger(i) && i >= 0)) throw new ChainError("invalid-request", "sign must be a non-empty array of input indices");
19776
- const unique = [...new Set(sign.map(Number))].sort((a, b) => a - b);
19777
- const last = unique.at(-1);
19778
- if (unique.length !== sign.length || last === void 0 || last >= tx.inputsLength) throw new ChainError("invalid-request", "sign must be unique, ascending, and in range");
19791
+ if (!Array.isArray(sign) || sign.length === 0 || !sign.every(isSignEntry)) throw new ChainError("invalid-request", "sign must be a non-empty array of {index, template} entries");
19792
+ const sorted = [...sign].sort((a, b) => a.index - b.index);
19793
+ const indices = new Set(sorted.map((s) => s.index));
19794
+ const last = (_sorted$at = sorted.at(-1)) === null || _sorted$at === void 0 ? void 0 : _sorted$at.index;
19795
+ if (indices.size !== sorted.length || last === void 0 || last >= tx.inputsLength) throw new ChainError("invalid-request", "sign must be unique, ascending, and in range");
19779
19796
  checkDerivations(tx, net.coinType);
19780
- for (const idx of unique) {
19797
+ for (const { index: idx, template } of sorted) {
19781
19798
  const input = tx.getInput(idx);
19782
19799
  if (input.witnessUtxo === void 0 && input.nonWitnessUtxo === void 0) throw new ChainError("invalid-request", `input ${idx} carries neither witnessUtxo nor nonWitnessUtxo`);
19783
- if (input.bip32Derivation === void 0 && input.tapBip32Derivation === void 0) throw new ChainError("invalid-request", `input ${idx} is missing a bip32 derivation`);
19800
+ if (template === "btc.bip86" ? input.tapBip32Derivation === void 0 : input.bip32Derivation === void 0) throw new ChainError("invalid-request", `input ${idx} is missing a bip32 derivation`);
19784
19801
  const { type } = getInputType(input);
19785
19802
  if ((type === "legacy" || type === "nonwitness-script") && input.nonWitnessUtxo === void 0) throw new ChainError("invalid-request", `input ${idx} is missing nonWitnessUtxo`);
19786
19803
  const sighash = input.sighashType;
@@ -19789,7 +19806,7 @@ zoo`.split("\n"));
19789
19806
  }
19790
19807
  return {
19791
19808
  psbt: tx.toPSBT(0),
19792
- sign: unique
19809
+ sign: sorted
19793
19810
  };
19794
19811
  };
19795
19812
  var SATS = "sats";
@@ -19830,7 +19847,7 @@ zoo`.split("\n"));
19830
19847
  var decodeBitcoinPsbt = (request, ownScripts = /* @__PURE__ */ new Set()) => {
19831
19848
  const tx = parsePsbt(request.psbt);
19832
19849
  const coder = Address(bitcoinNetwork(request.network).params);
19833
- const signed = new Set(request.sign);
19850
+ const signed = new Set(request.sign.map((s) => s.index));
19834
19851
  const outflows = [];
19835
19852
  let canFee = true;
19836
19853
  let outSum = 0n;
@@ -19867,7 +19884,7 @@ zoo`.split("\n"));
19867
19884
  }
19868
19885
  const external = tx.inputsLength - signed.size > 0;
19869
19886
  const undecodable = outflows.some((o) => !o.verified);
19870
- const listing = request.sign.some((i) => tx.getInput(i).sighashType === SIGHASH_SINGLE_ANYONECANPAY);
19887
+ const listing = request.sign.some((s) => tx.getInput(s.index).sighashType === SIGHASH_SINGLE_ANYONECANPAY);
19871
19888
  const verifiability = external ? "opaque" : listing || undecodable ? "partial" : "full";
19872
19889
  return {
19873
19890
  family: "bitcoin",
@@ -19919,19 +19936,28 @@ zoo`.split("\n"));
19919
19936
  */
19920
19937
  var normalizeBitcoin = (request) => {
19921
19938
  if (!isRecord$3(request) || typeof request["kind"] !== "string") throw new ChainError("invalid-request", "request must be an object with a kind");
19922
- const { network, account } = common(request);
19923
19939
  if (request["kind"] === "bitcoin.psbt") {
19924
- const { psbt } = request;
19940
+ const { network, account, psbt } = request;
19941
+ if (typeof network !== "string") throw new ChainError("invalid-request", "request.network must be a string");
19942
+ bitcoinNetwork(network);
19943
+ if (!isRecord$3(account) || account["kind"] !== "hd") throw new ChainError("invalid-request", "request.account must be a wallet group");
19944
+ const { walletId, groupIndex } = account;
19945
+ if (typeof walletId !== "string" || typeof groupIndex !== "number" || !Number.isSafeInteger(groupIndex) || groupIndex < 0) throw new ChainError("invalid-request", "request.account must be a wallet group");
19925
19946
  if (!(psbt instanceof Uint8Array)) throw new ChainError("invalid-request", "psbt must be bytes");
19926
19947
  const normalized = normalizeBitcoinPsbt(psbt, request["sign"], network);
19927
19948
  return {
19928
19949
  kind: "bitcoin.psbt",
19929
19950
  network,
19930
- account,
19951
+ account: {
19952
+ kind: "hd",
19953
+ walletId,
19954
+ groupIndex
19955
+ },
19931
19956
  psbt: normalized.psbt,
19932
19957
  sign: normalized.sign
19933
19958
  };
19934
19959
  }
19960
+ const { network, account } = common(request);
19935
19961
  if (request["kind"] === "bitcoin.message") {
19936
19962
  const { format } = request;
19937
19963
  const target = messageTarget(request["address"], network, format);
@@ -29010,6 +29036,23 @@ zoo`.split("\n"));
29010
29036
  init_transaction();
29011
29037
  var isPath = (path) => Array.isArray(path) && path.every((p) => typeof p === "number");
29012
29038
  var hex$1 = (bytes) => bytes.reduce((acc, b) => acc + b.toString(16).padStart(2, "0"), "");
29039
+ var PURPOSES = [
29040
+ 44,
29041
+ 49,
29042
+ 84,
29043
+ 86
29044
+ ];
29045
+ var contextFor = (b, purpose) => {
29046
+ let ctx = b.purposes.get(purpose);
29047
+ if (ctx === void 0) {
29048
+ ctx = {
29049
+ accountNode: b.master.derive(`m/${purpose}'/${b.coinType}'/${b.groupIndex}'`),
29050
+ children: []
29051
+ };
29052
+ b.purposes.set(purpose, ctx);
29053
+ }
29054
+ return ctx;
29055
+ };
29013
29056
  /** The PSBT derivation entry that claims this account's fingerprint and path, if any. */
29014
29057
  var derivationOf = (owner, fingerprint, purpose) => {
29015
29058
  var _owner$bip32Derivatio;
@@ -29031,58 +29074,70 @@ zoo`.split("\n"));
29031
29074
  };
29032
29075
  var expectedPub = (purpose, pub) => purpose === 86 ? pub.slice(1) : pub;
29033
29076
  var expectedScript = (purpose, pub) => purpose === 86 ? p2tr(pub.slice(1)).script : purpose === 49 ? p2sh(p2wpkh(pub)).script : purpose === 44 ? p2pkh(pub).script : p2wpkh(pub).script;
29034
- /** Derives `m/purpose'/coin'/group'/change/index` — the only path shape this account may sign. */
29035
- var childAt = (b, path) => {
29077
+ /** Derives `m/purpose'/coin'/group'/change/index` — the only path shape this group may sign. */
29078
+ var childAt = (b, purpose, path) => {
29036
29079
  const [purposePath, coinPath, groupPath, change, index] = path;
29037
- if (path.length !== 5 || purposePath !== b.purpose + b.hardened || coinPath !== b.coinType + b.hardened || groupPath !== b.account.groupIndex + b.hardened || change === void 0 || index === void 0 || change !== 0 && change !== 1 || index < 0 || index >= b.hardened) throw new KernelError("invalid-input", "derivation path is not this account's");
29038
- const child = b.accountNode.deriveChild(change).deriveChild(index);
29039
- b.children.push(child);
29080
+ if (path.length !== 5 || purposePath !== purpose + b.hardened || coinPath !== b.coinType + b.hardened || groupPath !== b.groupIndex + b.hardened || change === void 0 || index === void 0 || change !== 0 && change !== 1 || index < 0 || index >= b.hardened) throw new KernelError("invalid-input", "derivation path is not this account's");
29081
+ const ctx = contextFor(b, purpose);
29082
+ const child = ctx.accountNode.deriveChild(change).deriveChild(index);
29083
+ ctx.children.push(child);
29040
29084
  return child;
29041
29085
  };
29042
29086
  /**
29043
- * Ownership check for one `request.sign` input: the derivation entry must be this account's, the
29044
- * claimed pubkey the derived child's, and the prevout script (witnessUtxo, or nonWitnessUtxo for
29045
- * P2PKH, plus redeemScript for P2SH-P2WPKH) the script of that key.
29087
+ * Ownership check for one `request.sign` entry: under the entry's own template, the derivation
29088
+ * entry must be this account's, the claimed pubkey the derived child's, and the prevout script
29089
+ * (witnessUtxo, or nonWitnessUtxo for P2PKH, plus redeemScript for P2SH-P2WPKH) the script of that
29090
+ * key. A template that disagrees with the input's script type fails the path or script check.
29046
29091
  */
29047
- var bitcoinInput = (b, tx, idx) => {
29092
+ var bitcoinInput = (b, tx, entry) => {
29093
+ const purpose = BTC_PURPOSE[entry.template];
29094
+ if (purpose === void 0) throw new KernelError("invalid-input", "sign template is not a bitcoin account template");
29095
+ const { index: idx } = entry;
29048
29096
  const input = tx.getInput(idx);
29049
- const entry = derivationOf(input, b.master.fingerprint, b.purpose);
29050
- if (entry === void 0) throw new KernelError("invalid-input", `input ${idx}: derivation entry is not this account's`);
29051
- const child = childAt(b, entry.path);
29097
+ const der = derivationOf(input, b.master.fingerprint, purpose);
29098
+ if (der === void 0) throw new KernelError("invalid-input", `input ${idx}: derivation entry is not this account's`);
29099
+ const child = childAt(b, purpose, der.path);
29052
29100
  const pub = child.publicKey;
29053
29101
  const priv = child.privateKey;
29054
29102
  if (pub === null || priv === null) throw new KernelError("integrity", "no key at derivation path");
29055
- if (!deepEqual(entry.pubkey, expectedPub(b.purpose, pub))) throw new KernelError("invalid-input", `input ${idx}: derivation pubkey is not ours`);
29056
- if (b.purpose === 44) {
29103
+ if (!deepEqual(der.pubkey, expectedPub(purpose, pub))) throw new KernelError("invalid-input", `input ${idx}: derivation pubkey is not ours`);
29104
+ if (purpose === 44) {
29057
29105
  var _outs$vout;
29058
29106
  if (input.nonWitnessUtxo === void 0) throw new KernelError("invalid-input", `input ${idx}: P2PKH spend requires nonWitnessUtxo`);
29059
29107
  const vout = input.index;
29060
29108
  const outs = input.nonWitnessUtxo.outputs;
29061
29109
  const prevScript = vout === void 0 ? void 0 : (_outs$vout = outs[vout]) === null || _outs$vout === void 0 ? void 0 : _outs$vout.script;
29062
- if (prevScript === void 0 || !deepEqual(prevScript, expectedScript(b.purpose, pub))) throw new KernelError("invalid-input", `input ${idx}: nonWitnessUtxo prevout is not this key's`);
29110
+ if (prevScript === void 0 || !deepEqual(prevScript, expectedScript(purpose, pub))) throw new KernelError("invalid-input", `input ${idx}: nonWitnessUtxo prevout is not this key's`);
29063
29111
  } else {
29064
29112
  const prevout = input.witnessUtxo;
29065
- if (prevout === void 0 || !deepEqual(prevout.script, expectedScript(b.purpose, pub))) throw new KernelError("invalid-input", `input ${idx}: prevout script is not this key's`);
29066
- if (b.purpose === 49 && (input.redeemScript === void 0 || !deepEqual(input.redeemScript, p2wpkh(pub).script))) throw new KernelError("invalid-input", `input ${idx}: redeemScript is not this key's`);
29113
+ if (prevout === void 0 || !deepEqual(prevout.script, expectedScript(purpose, pub))) throw new KernelError("invalid-input", `input ${idx}: prevout script is not this key's`);
29114
+ if (purpose === 49 && (input.redeemScript === void 0 || !deepEqual(input.redeemScript, p2wpkh(pub).script))) throw new KernelError("invalid-input", `input ${idx}: redeemScript is not this key's`);
29067
29115
  }
29068
29116
  return {
29069
29117
  index: idx,
29070
29118
  privateKey: priv
29071
29119
  };
29072
29120
  };
29073
- /** Output binding: the scripts of outputs that look like this account's (its change addresses). */
29121
+ /**
29122
+ * Output binding, independent of which templates sign inputs: an output is this group's own when it
29123
+ * carries a derivation entry with our fingerprint — tap entries only for bip86, bip32 entries for
29124
+ * 44/49/84 — whose path is a valid `m/purpose'/coin'/group'/{0,1}/i` of this group and whose script
29125
+ * equals that key's script for the purpose. Failures just mean "not own".
29126
+ */
29074
29127
  var bitcoinOwnScripts = (b, tx) => {
29075
29128
  const ownScripts = /* @__PURE__ */ new Set();
29076
29129
  for (let i = 0; i < tx.outputsLength; i++) {
29077
29130
  const output = tx.getOutput(i);
29078
29131
  if (output.script === void 0) continue;
29079
- const entry = derivationOf(output, b.master.fingerprint, b.purpose);
29080
- if (entry === void 0) continue;
29081
- try {
29082
- const pub = childAt(b, entry.path).publicKey;
29083
- if (pub !== null && deepEqual(output.script, expectedScript(b.purpose, pub))) ownScripts.add(hex$1(output.script));
29084
- } catch (_unused) {
29085
- continue;
29132
+ for (const purpose of PURPOSES) {
29133
+ const entry = derivationOf(output, b.master.fingerprint, purpose);
29134
+ if (entry === void 0) continue;
29135
+ try {
29136
+ const pub = childAt(b, purpose, entry.path).publicKey;
29137
+ if (pub !== null && deepEqual(output.script, expectedScript(purpose, pub))) ownScripts.add(hex$1(output.script));
29138
+ } catch (_unused) {
29139
+ continue;
29140
+ }
29086
29141
  }
29087
29142
  }
29088
29143
  return ownScripts;
@@ -29090,7 +29145,7 @@ zoo`.split("\n"));
29090
29145
  /** The PSBT path: input ownership, output binding, normalize, decode intent or sign. */
29091
29146
  var executeBitcoinPsbt = (b, request, random, intentOnly) => {
29092
29147
  const tx = Transaction.fromPSBT(request.psbt);
29093
- const inputs = request.sign.map((idx) => bitcoinInput(b, tx, idx));
29148
+ const inputs = request.sign.map((entry) => bitcoinInput(b, tx, entry));
29094
29149
  const ownScripts = bitcoinOwnScripts(b, tx);
29095
29150
  let normalized;
29096
29151
  try {
@@ -29112,19 +29167,19 @@ zoo`.split("\n"));
29112
29167
  };
29113
29168
  };
29114
29169
  /** The message path: the declared change/index must derive this address, then normalize/sign. */
29115
- var executeBitcoinMessage = (b, request, random, intentOnly) => {
29116
- if (request.format === "legacy" && b.account.template !== "btc.bip44") throw new KernelError("unsupported", "legacy message format is btc.bip44-only");
29117
- const child = childAt(b, [
29118
- b.purpose + b.hardened,
29170
+ var executeBitcoinMessage = (b, purpose, request, random, intentOnly) => {
29171
+ if (request.format === "legacy" && purpose !== 44) throw new KernelError("unsupported", "legacy message format is btc.bip44-only");
29172
+ const child = childAt(b, purpose, [
29173
+ purpose + b.hardened,
29119
29174
  b.coinType + b.hardened,
29120
- b.account.groupIndex + b.hardened,
29175
+ b.groupIndex + b.hardened,
29121
29176
  request.change,
29122
29177
  request.index
29123
29178
  ]);
29124
29179
  const pub = child.publicKey;
29125
29180
  const priv = child.privateKey;
29126
29181
  if (pub === null || priv === null) throw new KernelError("integrity", "no key at derivation path");
29127
- if ((b.purpose === 86 ? p2tr(pub.slice(1), void 0, b.net.params).address : b.purpose === 49 ? p2sh(p2wpkh(pub, b.net.params), b.net.params).address : b.purpose === 44 ? p2pkh(pub, b.net.params).address : p2wpkh(pub, b.net.params).address) !== request.address) throw new KernelError("invalid-input", "address is not ours");
29182
+ if ((purpose === 86 ? p2tr(pub.slice(1), void 0, b.net.params).address : purpose === 49 ? p2sh(p2wpkh(pub, b.net.params), b.net.params).address : purpose === 44 ? p2pkh(pub, b.net.params).address : p2wpkh(pub, b.net.params).address) !== request.address) throw new KernelError("invalid-input", "address is not ours");
29128
29183
  let normalized;
29129
29184
  try {
29130
29185
  normalized = normalizeBitcoin(request);
@@ -29146,31 +29201,25 @@ zoo`.split("\n"));
29146
29201
  var executeBitcoin = (random, request, account, seed, intentOnly) => {
29147
29202
  const net = bitcoinNetwork(request.network);
29148
29203
  const master = HDKey$1.fromMasterSeed(seed, net.bip32);
29204
+ const b = {
29205
+ master,
29206
+ purposes: /* @__PURE__ */ new Map(),
29207
+ coinType: net.coinType,
29208
+ hardened: 2147483648,
29209
+ groupIndex: account.groupIndex,
29210
+ net
29211
+ };
29149
29212
  try {
29150
- var _BTC_PURPOSE$account$;
29151
- const purpose = (_BTC_PURPOSE$account$ = BTC_PURPOSE[account.template]) !== null && _BTC_PURPOSE$account$ !== void 0 ? _BTC_PURPOSE$account$ : 84;
29152
- const { coinType } = net;
29153
- const hardened = 2147483648;
29154
- const accountNode = master.derive(`m/${purpose}'/${coinType}'/${account.groupIndex}'`);
29155
- const children = [];
29156
- const b = {
29157
- master,
29158
- accountNode,
29159
- children,
29160
- purpose,
29161
- coinType,
29162
- hardened,
29163
- account,
29164
- net
29165
- };
29166
- try {
29167
- if (request.kind === "bitcoin.psbt") return executeBitcoinPsbt(b, request, random, intentOnly);
29168
- return executeBitcoinMessage(b, request, random, intentOnly);
29169
- } finally {
29170
- for (const child of children) child.wipePrivateData();
29171
- accountNode.wipePrivateData();
29172
- }
29213
+ if (request.kind === "bitcoin.psbt") return executeBitcoinPsbt(b, request, random, intentOnly);
29214
+ if (request.account.kind !== "hd") throw new KernelError("unsupported", "imported accounts are not yet supported");
29215
+ const purpose = BTC_PURPOSE[request.account.template];
29216
+ if (purpose === void 0) throw new KernelError("invalid-input", "account template is not a bitcoin template");
29217
+ return executeBitcoinMessage(b, purpose, request, random, intentOnly);
29173
29218
  } finally {
29219
+ for (const ctx of b.purposes.values()) {
29220
+ for (const child of ctx.children) child.wipePrivateData();
29221
+ ctx.accountNode.wipePrivateData();
29222
+ }
29174
29223
  master.wipePrivateData();
29175
29224
  }
29176
29225
  };
@@ -29411,19 +29460,26 @@ zoo`.split("\n"));
29411
29460
  const { request, verify } = params;
29412
29461
  const { account } = request;
29413
29462
  if (account.kind !== "hd") throw new KernelError("unsupported", "imported accounts are not yet supported");
29414
- const [family] = request.kind.split(".", 1);
29415
- if (!(family === "evm" ? ["evm.bip44"] : family === "solana" ? ["solana.bip44-change"] : [
29416
- "btc.bip44",
29417
- "btc.bip49",
29418
- "btc.bip84",
29419
- "btc.bip86"
29420
- ]).includes(account.template)) throw new KernelError("invalid-input", "account template does not match the request family");
29463
+ if (request.kind === "bitcoin.psbt") {
29464
+ if (request.sign.some((s) => BTC_PURPOSE[s.template] === void 0)) throw new KernelError("invalid-input", "sign template is not a bitcoin account template");
29465
+ } else {
29466
+ const [family] = request.kind.split(".", 1);
29467
+ const expected = family === "evm" ? ["evm.bip44"] : family === "solana" ? ["solana.bip44-change"] : [
29468
+ "btc.bip44",
29469
+ "btc.bip49",
29470
+ "btc.bip84",
29471
+ "btc.bip86"
29472
+ ];
29473
+ if (!("template" in account) || !expected.includes(account.template)) throw new KernelError("invalid-input", "account template does not match the request family");
29474
+ }
29421
29475
  const record = ctx.image.records.find((entry) => entry.kind === "entropy" && entry.id === account.walletId);
29422
29476
  if (record === void 0) throw new KernelError("not-found", "no such wallet");
29423
29477
  const execute = (seed, intentOnly) => {
29424
- if (request.kind === "evm.transaction" || request.kind === "evm.personal-message" || request.kind === "evm.typed-data") return executeEvm(request, account, seed, intentOnly);
29425
- if (request.kind === "bitcoin.psbt" || request.kind === "bitcoin.message") return executeBitcoin(ctx.platform.random, request, account, seed, intentOnly);
29426
- return executeSolana(request, account, seed, intentOnly);
29478
+ if (request.kind === "bitcoin.psbt") return executeBitcoin(ctx.platform.random, request, request.account, seed, intentOnly);
29479
+ if (request.account.kind !== "hd") throw new KernelError("unsupported", "imported accounts are not yet supported");
29480
+ if (request.kind === "bitcoin.message") return executeBitcoin(ctx.platform.random, request, request.account, seed, intentOnly);
29481
+ if (request.kind === "evm.transaction" || request.kind === "evm.personal-message" || request.kind === "evm.typed-data") return executeEvm(request, request.account, seed, intentOnly);
29482
+ return executeSolana(request, request.account, seed, intentOnly);
29427
29483
  };
29428
29484
  const withSeed = async (run) => withWalletSeed(ctx.platform.pbkdf2, dek, record, run);
29429
29485
  const prepared = await withSeed((seed) => execute(seed, true));
@@ -29452,7 +29508,7 @@ zoo`.split("\n"));
29452
29508
  }
29453
29509
  };
29454
29510
  }
29455
- // node_modules/.bun/@qntx+nostr@0.15.3+ea9f70ecde856c26/node_modules/@qntx/nostr/dist/util-BcRBO6o-.mjs
29511
+ // node_modules/.bun/@qntx+nostr@0.15.4+cb72dcd9952e90a1/node_modules/@qntx/nostr/dist/util-D8wUYmm0.mjs
29456
29512
  init_utils$2();
29457
29513
  init_defineProperty();
29458
29514
  /** Base error for all @qntx/nostr failures. */
@@ -29550,7 +29606,7 @@ zoo`.split("\n"));
29550
29606
  }
29551
29607
  return false;
29552
29608
  }
29553
- // node_modules/.bun/@qntx+nostr@0.15.3+ea9f70ecde856c26/node_modules/@qntx/nostr/dist/kind-I2Tvbe82.mjs
29609
+ // node_modules/.bun/@qntx+nostr@0.15.4+cb72dcd9952e90a1/node_modules/@qntx/nostr/dist/kind-BAnfDHdg.mjs
29554
29610
  /** Kind numbers used by this package. */
29555
29611
  var Kind = {
29556
29612
  Metadata: 0,
@@ -29582,7 +29638,7 @@ zoo`.split("\n"));
29582
29638
  EmojiSet: 30030,
29583
29639
  StarterPack: 39089
29584
29640
  };
29585
- // node_modules/.bun/@qntx+nostr@0.15.3+ea9f70ecde856c26/node_modules/@qntx/nostr/dist/event-DHtcm0jM.mjs
29641
+ // node_modules/.bun/@qntx+nostr@0.15.4+cb72dcd9952e90a1/node_modules/@qntx/nostr/dist/event-B__SmruU.mjs
29586
29642
  init_sha2();
29587
29643
  /** Type guard: a non-empty array of strings. */
29588
29644
  function isTag(value) {
@@ -29662,7 +29718,7 @@ zoo`.split("\n"));
29662
29718
  const serialized = serializeEvent(event);
29663
29719
  return bytesToHex$1(sha256$1(utf8Encoder.encode(serialized)));
29664
29720
  }
29665
- // node_modules/.bun/@qntx+nostr@0.15.3+ea9f70ecde856c26/node_modules/@qntx/nostr/dist/key-Bt0ow7mI.mjs
29721
+ // node_modules/.bun/@qntx+nostr@0.15.4+cb72dcd9952e90a1/node_modules/@qntx/nostr/dist/key-BxwA02Gx.mjs
29666
29722
  init_utils$2();
29667
29723
  init_sha2();
29668
29724
  init_secp256k1();
@@ -29809,7 +29865,7 @@ zoo`.split("\n"));
29809
29865
  markVerified(event);
29810
29866
  return event;
29811
29867
  }
29812
- // node_modules/.bun/@qntx+nostr@0.15.3+ea9f70ecde856c26/node_modules/@qntx/nostr/dist/verifier-DBSPHzGg.mjs
29868
+ // node_modules/.bun/@qntx+nostr@0.15.4+cb72dcd9952e90a1/node_modules/@qntx/nostr/dist/verifier-iQR5ivRF.mjs
29813
29869
  /**
29814
29870
  * Build an event verifier with exactly the semantics of {@link verifyEvent}, delegating the hash and
29815
29871
  * signature check to `backend`. Verified/failed results share `verifyEvent`'s WeakSet caches, so
@@ -29831,7 +29887,7 @@ zoo`.split("\n"));
29831
29887
  }
29832
29888
  /** Verify event id and BIP-340 signature. Uses WeakSet cache (does not mutate the event). */
29833
29889
  var verifyEvent = createEventVerifier(nobleBackend);
29834
- // node_modules/.bun/@qntx+nostr@0.15.3+ea9f70ecde856c26/node_modules/@qntx/nostr/dist/error-CoP2myne.mjs
29890
+ // node_modules/.bun/@qntx+nostr@0.15.4+cb72dcd9952e90a1/node_modules/@qntx/nostr/dist/error-Cord_cbw.mjs
29835
29891
  init_defineProperty();
29836
29892
  /** Thrown when a method is called on a signer after {@link NostrSigner dispose}. */
29837
29893
  var SignerDisposedError = class extends NostrError {
@@ -30133,7 +30189,7 @@ zoo`.split("\n"));
30133
30189
  }
30134
30190
  };
30135
30191
  });
30136
- // node_modules/.bun/@qntx+nostr@0.15.3+ea9f70ecde856c26/node_modules/@qntx/nostr/dist/nips/nip04.mjs
30192
+ // node_modules/.bun/@qntx+nostr@0.15.4+cb72dcd9952e90a1/node_modules/@qntx/nostr/dist/nips/nip04.mjs
30137
30193
  init_utils$2();
30138
30194
  init_base();
30139
30195
  /** NIP-04 legacy encrypted direct messages. Prefer NIP-44 for new applications. */
@@ -30194,7 +30250,7 @@ zoo`.split("\n"));
30194
30250
  if (parts.length !== 2 || ciphertext === void 0 || ciphertext === "" || iv === void 0 || iv === "") throw new CryptoError("invalid NIP-04 payload: missing iv");
30195
30251
  return [ciphertext, iv];
30196
30252
  }
30197
- // node_modules/.bun/@qntx+nostr@0.15.3+ea9f70ecde856c26/node_modules/@qntx/nostr/dist/nips/nip44.mjs
30253
+ // node_modules/.bun/@qntx+nostr@0.15.4+cb72dcd9952e90a1/node_modules/@qntx/nostr/dist/nips/nip44.mjs
30198
30254
  init_utils$2();
30199
30255
  init_sha2();
30200
30256
  init_base();
@@ -30316,7 +30372,7 @@ zoo`.split("\n"));
30316
30372
  if (!equalBytes$3(hmacAad(hmac_key, ciphertext, nonce), mac)) throw new CryptoError("invalid MAC");
30317
30373
  return unpad(chacha20(chacha_key, chacha_nonce, ciphertext));
30318
30374
  }
30319
- // node_modules/.bun/@qntx+nostr@0.15.3+ea9f70ecde856c26/node_modules/@qntx/nostr/dist/nips/nip59.mjs
30375
+ // node_modules/.bun/@qntx+nostr@0.15.4+cb72dcd9952e90a1/node_modules/@qntx/nostr/dist/nips/nip59.mjs
30320
30376
  init_defineProperty();
30321
30377
  init_objectSpread2();
30322
30378
  /**
@@ -30384,13 +30440,13 @@ zoo`.split("\n"));
30384
30440
  if (sealRaw.pubkey !== rumor.pubkey) throw new Nip59Error("seal pubkey does not match rumor pubkey");
30385
30441
  return rumor;
30386
30442
  }
30387
- // node_modules/.bun/@qntx+nostr@0.15.3+ea9f70ecde856c26/node_modules/@qntx/nostr/dist/nips/nip46.mjs
30443
+ // node_modules/.bun/@qntx+nostr@0.15.4+cb72dcd9952e90a1/node_modules/@qntx/nostr/dist/nips/nip46.mjs
30388
30444
  init_defineProperty();
30389
30445
  // \0@oxc-project+runtime@0.155.0/helpers/esm/classPrivateMethodInitSpec.js
30390
30446
  function _classPrivateMethodInitSpec(e, a) {
30391
30447
  _checkPrivateRedeclaration(e, a), a.add(e);
30392
30448
  }
30393
- // node_modules/.bun/@qntx+nostr@0.15.3+ea9f70ecde856c26/node_modules/@qntx/nostr/dist/signer-DQzjm3pt.mjs
30449
+ // node_modules/.bun/@qntx+nostr@0.15.4+cb72dcd9952e90a1/node_modules/@qntx/nostr/dist/signer-Y3gcghwd.mjs
30394
30450
  init_utils$2();
30395
30451
  init_objectSpread2();
30396
30452
  var _keys;
@@ -30487,7 +30543,7 @@ zoo`.split("\n"));
30487
30543
  }
30488
30544
  return key;
30489
30545
  }
30490
- // node_modules/.bun/@qntx+nostr@0.15.3+ea9f70ecde856c26/node_modules/@qntx/nostr/dist/nips/nip19.mjs
30546
+ // node_modules/.bun/@qntx+nostr@0.15.4+cb72dcd9952e90a1/node_modules/@qntx/nostr/dist/nips/nip19.mjs
30491
30547
  init_base();
30492
30548
  /** Maximum bech32 string length accepted by {@link decode} (NIP-19). */
30493
30549
  var Bech32MaxSize = 5e3;
@@ -30723,7 +30779,7 @@ zoo`.split("\n"));
30723
30779
  swap32IfBE(B32);
30724
30780
  return scryptOutput(password, dkLen, B, V, tmp);
30725
30781
  }
30726
- // node_modules/.bun/@qntx+nostr@0.15.3+ea9f70ecde856c26/node_modules/@qntx/nostr/dist/nips/nip49.mjs
30782
+ // node_modules/.bun/@qntx+nostr@0.15.4+cb72dcd9952e90a1/node_modules/@qntx/nostr/dist/nips/nip49.mjs
30727
30783
  init_utils$2();
30728
30784
  init_defineProperty();
30729
30785
  init_objectSpread2();
@@ -27,13 +27,13 @@
27
27
  },
28
28
  {
29
29
  "name": "@qntx/nostr",
30
- "version": "0.15.3",
31
- "integrity": "sha512-AefcRXe/3basIgDA0gBGzzQ2Y9k131SfrU0hZ+eJqfLzCSzsVJyum5XKzffJ74VU6FroQPbS/fSS7W5mGd22ow=="
30
+ "version": "0.15.4",
31
+ "integrity": "sha512-kxWfN3HxKm7bTDn7Mzd+X80J74fbzNwUHOx8in5qMcb89/FgytR0jXllnF6eqGyO7VYG3pKSj94JnhgbkV73BQ=="
32
32
  },
33
33
  {
34
34
  "name": "@qntx/nostr-native",
35
- "version": "0.15.3",
36
- "integrity": "sha512-0JB2sapmRUFONNeDF3lTCfsgzmiu1EKB3ue/msQCm18fSrmVYN6HV7WQzJsGa7GZXMvlZ13udrV1gDbmXv1/4A=="
35
+ "version": "0.15.4",
36
+ "integrity": "sha512-CUBflKqmXeIMyZbm4FP0ssZRmbtbu1IXfsuDso9nxLekPsnXYfo+0gzQNKNxpYTwvQ5ay608nmLsSQ4PV4soMw=="
37
37
  },
38
38
  {
39
39
  "name": "@qntx/siwx",
@@ -79,7 +79,7 @@
79
79
  "bundles": [
80
80
  {
81
81
  "file": "kernel-entry.js",
82
- "sha256": "00a0af04bbc6def811ca7cc50bbcbe94f887fcbf53a3e0984f75679d72542326"
82
+ "sha256": "9e09cbb8247ee2a2b04ca97037e6d3d734d7e473e11f478fd77efe7af845cde2"
83
83
  }
84
84
  ]
85
85
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qntx/wallet-native",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "description": "Native kernel runtime host for the qntx wallet — CBOR transport, KernelHost adapter and createNativeWallet",
5
5
  "license": "MIT OR Apache-2.0",
6
6
  "author": "QuantX <x@qntx.org>",
@@ -48,8 +48,8 @@
48
48
  },
49
49
  "devDependencies": {
50
50
  "@arethetypeswrong/cli": "0.18.5",
51
- "@qntx/nostr": "0.15.3",
52
- "@qntx/nostr-native": "0.15.3",
51
+ "@qntx/nostr": "0.15.4",
52
+ "@qntx/nostr-native": "0.15.4",
53
53
  "@qntx/spark": "0.5.2",
54
54
  "@qntx/spark-native": "0.5.2",
55
55
  "@qntx/tsconfig": "1.0.1",
@@ -59,9 +59,9 @@
59
59
  "react-native-nitro-modules": "0.37.1"
60
60
  },
61
61
  "peerDependencies": {
62
- "@qntx/nostr-native": "0.15.3",
62
+ "@qntx/nostr-native": "0.15.4",
63
63
  "@qntx/spark-native": "0.5.2",
64
- "@qntx/wallet": "0.11.0",
64
+ "@qntx/wallet": "0.12.0",
65
65
  "react-native": "~0.88.0",
66
66
  "react-native-nitro-modules": "~0.37.1"
67
67
  }