hd-wallet-wasm 2.0.20 → 2.0.26

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.
@@ -0,0 +1,105 @@
1
+ import type { HDWalletModule } from './index.js';
2
+
3
+ export type EpmSignatureCurve = 'ed25519' | 'secp256k1';
4
+
5
+ export interface EpmSignatureOptions {
6
+ curve?: EpmSignatureCurve;
7
+ }
8
+
9
+ export interface EpmSignatureResult {
10
+ signature: string;
11
+ timestamp: number;
12
+ }
13
+
14
+ export interface CanonicalPayloadParams {
15
+ xpub: string;
16
+ signingPubKeyHex: string;
17
+ encryptionPubKeyHex: string;
18
+ issuedAt: number;
19
+ identityPubKeyHex?: string;
20
+ version?: string;
21
+ }
22
+
23
+ export interface ChainKeyParams {
24
+ address: string;
25
+ publicKeyHex: string;
26
+ privateKey: Uint8Array;
27
+ keyPath: string;
28
+ canonicalPayload: string;
29
+ }
30
+
31
+ export interface AllChainProofsParams {
32
+ canonicalPayload: string;
33
+ bitcoin?: Omit<ChainKeyParams, 'canonicalPayload'>;
34
+ ethereum?: Omit<ChainKeyParams, 'canonicalPayload'>;
35
+ solana?: Omit<ChainKeyParams, 'canonicalPayload'>;
36
+ }
37
+
38
+ export interface ChainProofData {
39
+ CHAIN: string;
40
+ ADDRESS: string;
41
+ PUBLIC_KEY: string;
42
+ KEY_PATH: string;
43
+ SIGNATURE: string;
44
+ SIGNED_PAYLOAD: string;
45
+ ALGORITHM: string;
46
+ ENCODING: string;
47
+ }
48
+
49
+ export interface ChainProofResult {
50
+ chain: string;
51
+ valid: boolean;
52
+ }
53
+
54
+ export interface ChainProofVerifyResult {
55
+ valid: boolean;
56
+ results: ChainProofResult[];
57
+ }
58
+
59
+ export function buildCanonicalPayload(params: CanonicalPayloadParams): string;
60
+
61
+ export function buildEPMSigningContent(epm: Record<string, unknown>): Uint8Array;
62
+
63
+ export function signEPMContent(
64
+ wallet: HDWalletModule,
65
+ epm: Record<string, unknown>,
66
+ privateKey: Uint8Array,
67
+ options?: EpmSignatureOptions,
68
+ ): EpmSignatureResult;
69
+
70
+ export function verifyEPMSignature(
71
+ wallet: HDWalletModule,
72
+ epm: Record<string, unknown>,
73
+ publicKey: Uint8Array,
74
+ options?: EpmSignatureOptions,
75
+ ): boolean;
76
+
77
+ export function buildBitcoinChainProof(
78
+ wallet: HDWalletModule,
79
+ params: ChainKeyParams,
80
+ ): ChainProofData;
81
+
82
+ export function buildEthereumChainProof(
83
+ wallet: HDWalletModule,
84
+ params: ChainKeyParams,
85
+ ): ChainProofData;
86
+
87
+ export function buildSolanaChainProof(
88
+ wallet: HDWalletModule,
89
+ params: ChainKeyParams,
90
+ ): ChainProofData;
91
+
92
+ export function buildAllChainProofs(
93
+ wallet: HDWalletModule,
94
+ params: AllChainProofsParams,
95
+ ): ChainProofData[];
96
+
97
+ export function verifyChainProof(
98
+ wallet: HDWalletModule,
99
+ proof: ChainProofData,
100
+ ): boolean;
101
+
102
+ export function verifyAllChainProofs(
103
+ wallet: HDWalletModule,
104
+ chainProofs: ChainProofData[],
105
+ ): ChainProofVerifyResult;
@@ -212,17 +212,25 @@ export function buildEPMSigningContent(epm) {
212
212
  }
213
213
 
214
214
  /**
215
- * Sign EPM content with an Ed25519 private key.
215
+ * Sign EPM content. Default curve is ed25519 (fast, the network default); pass
216
+ * `{ curve: 'secp256k1' }` to sign with secp256k1 (ECDSA-DER over sha256(content),
217
+ * byte-compatible with the Go/C++ EPM verifiers). The content canonicalization is
218
+ * identical for both curves; only the signature differs.
216
219
  *
217
220
  * @param {Object} wallet - Initialized HDWalletModule
218
221
  * @param {Object} epm - EPM fields as a plain object (without SIGNATURE/SIGNATURE_TIMESTAMP)
219
- * @param {Uint8Array} ed25519PrivateKey - 32-byte Ed25519 private key (seed)
222
+ * @param {Uint8Array} privateKey - 32-byte private key (ed25519 seed or secp256k1 key)
223
+ * @param {{ curve?: 'ed25519'|'secp256k1' }} [options]
220
224
  * @returns {{ signature: string, timestamp: number }} Hex signature and Unix timestamp
221
225
  */
222
- export function signEPMContent(wallet, epm, ed25519PrivateKey) {
226
+ export function signEPMContent(wallet, epm, privateKey, options = {}) {
227
+ const curve = String(options.curve || 'ed25519').toLowerCase();
223
228
  const timestamp = Math.floor(Date.now() / 1000);
224
229
  const content = buildEPMSigningContent({ ...epm, SIGNATURE_TIMESTAMP: timestamp });
225
- const sig = wallet.curves.ed25519.sign(content, ed25519PrivateKey);
230
+ const sig =
231
+ curve === 'secp256k1'
232
+ ? wallet.curves.secp256k1.sign(wallet.utils.sha256(content), privateKey)
233
+ : wallet.curves.ed25519.sign(content, privateKey);
226
234
  return {
227
235
  signature: wallet.utils.encodeHex(sig),
228
236
  timestamp,
@@ -230,20 +238,30 @@ export function signEPMContent(wallet, epm, ed25519PrivateKey) {
230
238
  }
231
239
 
232
240
  /**
233
- * Verify an EPM content signature.
241
+ * Verify an EPM content signature. Dispatches on the explicit `options.curve`,
242
+ * else infers from the public key length (32 = ed25519; 33/65 = secp256k1).
243
+ * secp256k1 is verified as ECDSA-DER over sha256(content), matching signEPMContent
244
+ * and the Go/C++ verifiers.
234
245
  *
235
246
  * @param {Object} wallet - Initialized HDWalletModule
236
247
  * @param {Object} epm - Full EPM object including SIGNATURE and SIGNATURE_TIMESTAMP
237
- * @param {Uint8Array} ed25519PublicKey - 32-byte Ed25519 public key
248
+ * @param {Uint8Array} publicKey - ed25519 (32B) or secp256k1 (33/65B) public key
249
+ * @param {{ curve?: 'ed25519'|'secp256k1' }} [options]
238
250
  * @returns {boolean} True if signature is valid
239
251
  */
240
- export function verifyEPMSignature(wallet, epm, ed25519PublicKey) {
252
+ export function verifyEPMSignature(wallet, epm, publicKey, options = {}) {
241
253
  const sigHex = epm.SIGNATURE || epm.signature;
242
254
  if (!sigHex) return false;
243
255
 
244
256
  const content = buildEPMSigningContent(epm);
245
257
  const sig = wallet.utils.decodeHex(sigHex);
246
- return wallet.curves.ed25519.verify(content, sig, ed25519PublicKey);
258
+ const curve = String(
259
+ options.curve || (publicKey && publicKey.length === 32 ? 'ed25519' : 'secp256k1'),
260
+ ).toLowerCase();
261
+ if (curve === 'secp256k1') {
262
+ return wallet.curves.secp256k1.verify(wallet.utils.sha256(content), sig, publicKey);
263
+ }
264
+ return wallet.curves.ed25519.verify(content, sig, publicKey);
247
265
  }
248
266
 
249
267
  // =============================================================================
@@ -10,7 +10,7 @@
10
10
  */
11
11
 
12
12
  // Import aligned API types
13
- import { AlignedAPI } from './aligned';
13
+ import { AlignedAPI } from './aligned.js';
14
14
 
15
15
  export type BinaryLike = Uint8Array | ArrayBuffer | ArrayBufferView;
16
16
  export type X509CertificateInput = string | BinaryLike;
@@ -142,6 +142,193 @@ export interface SdnPluginContract {
142
142
  verify_detached(request: { inputs: SdnPluginFrame[] }): SdnPluginInvocationResult;
143
143
  }
144
144
 
145
+ declare const sdnIdentityHandleBrand: unique symbol;
146
+
147
+ export interface SdnIdentityHandle {
148
+ readonly [sdnIdentityHandleBrand]: true;
149
+ }
150
+
151
+ export interface SdnWasmKeyDescriptor {
152
+ purpose: 'asset-review-approval' | 'contact-encryption' | 'sdn-authentication';
153
+ identityScheme: 'sdn-bip32-slip10-purpose-v1'
154
+ | 'sdn-fast-password-auth-v1-legacy' | 'sdn-bip39-auth-v1-legacy';
155
+ seedProfile: 'password-scrypt-v2' | 'password-fast-v1-legacy'
156
+ | 'bip39-mnemonic-v1-legacy';
157
+ signatureProfile: 'ed25519-over-sha256-jcs-v1'
158
+ | 'ed25519-raw-32-v1' | null;
159
+ curve: 'ed25519' | 'x25519';
160
+ derivation: 'slip10' | 'bip32-scalar-as-ed25519-seed';
161
+ path: string;
162
+ encoding: 'raw';
163
+ publicKeyHex: string;
164
+ bip32Fingerprint: null;
165
+ keyId: `sha256:${string}`;
166
+ }
167
+
168
+ export interface SdnWasmPublicIdentity {
169
+ schemaVersion: 1;
170
+ identityScheme: SdnWasmKeyDescriptor['identityScheme'];
171
+ seedProfile: SdnWasmKeyDescriptor['seedProfile'];
172
+ accountIndex: 0 | 1;
173
+ accountLabel: null;
174
+ accountXpub: string;
175
+ accountPeerId: string;
176
+ accountFingerprint: string;
177
+ keys: readonly SdnWasmKeyDescriptor[];
178
+ }
179
+
180
+ export type SdnRegistryRowId =
181
+ | 'sdn-node-console-v2'
182
+ | 'asset-review-authority-activation-v1'
183
+ | 'asset-review-decision-v1';
184
+
185
+ export interface RawWalletSignature {
186
+ schemaVersion: 1;
187
+ keyId: `sha256:${string}`;
188
+ identityScheme: 'sdn-fast-password-auth-v1-legacy' | 'sdn-bip39-auth-v1-legacy';
189
+ algorithm: 'ed25519';
190
+ encoding: 'raw';
191
+ signatureProfile: 'ed25519-raw-32-v1';
192
+ signatureHex: string;
193
+ }
194
+
195
+ export interface CanonicalWalletSignature {
196
+ schemaVersion: 1;
197
+ keyId: `sha256:${string}`;
198
+ identityScheme: 'sdn-bip32-slip10-purpose-v1';
199
+ algorithm: 'ed25519';
200
+ encoding: 'raw';
201
+ signatureProfile: 'ed25519-over-sha256-jcs-v1';
202
+ canonicalEnvelope: string;
203
+ signedDigestSha256: string;
204
+ signatureHex: string;
205
+ }
206
+
207
+ export interface SdnLoginV2WireRequest {
208
+ audience: string;
209
+ challengeBase64url: string;
210
+ expiresAt: string;
211
+ issuedAt: string;
212
+ nonce: string;
213
+ protocolVersion: 2;
214
+ }
215
+
216
+ export interface ReviewedTransform {
217
+ translation: readonly [number, number, number];
218
+ rotation: readonly [number, number, number, number];
219
+ scale: readonly [number, number, number];
220
+ upAxis: 'X_UP' | 'Y_UP' | 'Z_UP';
221
+ sourceUnits: 'm' | 'cm' | 'mm' | 'km';
222
+ metersPerSourceUnit: number;
223
+ }
224
+
225
+ interface AssetReviewApprovalRequestBase {
226
+ protocolVersion: 1;
227
+ audience: 'asset-review:assets.ipfs.01';
228
+ requestOrigin: 'https://review.spacedatanetwork.org';
229
+ clientId: 'sdn-asset-review-v1';
230
+ challengeId: string;
231
+ nonce: string;
232
+ issuedAt: string;
233
+ expiresAt: string;
234
+ candidateKey: string;
235
+ modelCid: string;
236
+ modelSha256: string;
237
+ modelBytes: number;
238
+ metadataSha256: string;
239
+ previousDecisionHead: string | null;
240
+ }
241
+
242
+ export interface AssetReviewApproveRequest extends AssetReviewApprovalRequestBase {
243
+ decision: 'approve';
244
+ reviewedTransform: ReviewedTransform;
245
+ note: string | null;
246
+ }
247
+
248
+ export interface AssetReviewDisapproveRequest extends AssetReviewApprovalRequestBase {
249
+ decision: 'disapprove';
250
+ reason: string;
251
+ }
252
+
253
+ export type AssetReviewApprovalRequest =
254
+ | AssetReviewApproveRequest
255
+ | AssetReviewDisapproveRequest;
256
+
257
+ export interface AssetReviewAuthorityActivationRequest {
258
+ protocolVersion: 1;
259
+ audience: 'asset-review-authority:assets.ipfs.01';
260
+ requestOrigin: 'https://review.spacedatanetwork.org';
261
+ clientId: 'sdn-asset-review-v1';
262
+ serviceInstance: 'assets.ipfs.01/asset-review-attestation';
263
+ purpose: 'asset-review-authority-activation';
264
+ nonce: string;
265
+ issuedAt: string;
266
+ expiresAt: string;
267
+ publicKeyHex: string;
268
+ keyId: `sha256:${string}`;
269
+ identityScheme: 'sdn-bip32-slip10-purpose-v1';
270
+ signatureProfile: 'ed25519-over-sha256-jcs-v1';
271
+ }
272
+
273
+ export interface RememberWalletSealInput {
274
+ passwordUtf8: Uint8Array;
275
+ prfOutput: Uint8Array;
276
+ hkdfSalt: Uint8Array;
277
+ nonce: Uint8Array;
278
+ canonicalAad: string;
279
+ }
280
+
281
+ export interface SdnIdentityCapabilities {
282
+ derivePasswordIdentity(input: {
283
+ usernameUtf8: Uint8Array;
284
+ passwordUtf8: Uint8Array;
285
+ accountIndex: 0 | 1;
286
+ }): Promise<{ handle: SdnIdentityHandle; identity: SdnWasmPublicIdentity }>;
287
+ deriveLegacyPasswordIdentity(input: {
288
+ usernameUtf8: Uint8Array;
289
+ passwordUtf8: Uint8Array;
290
+ accountIndex: 0 | 1;
291
+ }): Promise<{ handle: SdnIdentityHandle; identity: SdnWasmPublicIdentity }>;
292
+ importLegacyMnemonicIdentity(input: {
293
+ mnemonicUtf8: Uint8Array;
294
+ accountIndex: 0 | 1;
295
+ }): Promise<{ handle: SdnIdentityHandle; identity: SdnWasmPublicIdentity }>;
296
+ importRememberedIdentity(input: {
297
+ ciphertextAndTag: Uint8Array;
298
+ prfOutput: Uint8Array;
299
+ hkdfSalt: Uint8Array;
300
+ nonce: Uint8Array;
301
+ canonicalUsernameUtf8: Uint8Array;
302
+ canonicalAad: string;
303
+ }): { handle: SdnIdentityHandle; identity: SdnWasmPublicIdentity };
304
+ signSdnLoginV1(handle: SdnIdentityHandle, challenge: Uint8Array): RawWalletSignature;
305
+ signSdnLoginV2(
306
+ handle: SdnIdentityHandle,
307
+ request: SdnLoginV2WireRequest,
308
+ registryRow: 'sdn-node-console-v2',
309
+ ): CanonicalWalletSignature;
310
+ signAssetReviewAuthorityActivation(
311
+ handle: SdnIdentityHandle,
312
+ request: AssetReviewAuthorityActivationRequest,
313
+ registryRow: 'asset-review-authority-activation-v1',
314
+ ): CanonicalWalletSignature;
315
+ signAssetReviewDecision(
316
+ handle: SdnIdentityHandle,
317
+ request: AssetReviewApprovalRequest,
318
+ registryRow: 'asset-review-decision-v1',
319
+ ): CanonicalWalletSignature;
320
+ sealRememberedIdentity(
321
+ handle: SdnIdentityHandle,
322
+ input: RememberWalletSealInput,
323
+ ): Uint8Array;
324
+ destroySdnIdentity(handle: SdnIdentityHandle): void;
325
+ }
326
+
327
+ export interface WalletOriginCapabilities {
328
+ readonly sdn: SdnIdentityCapabilities;
329
+ readonly sha256: (bytes: Uint8Array) => Uint8Array;
330
+ }
331
+
145
332
  // =============================================================================
146
333
  // Module Types
147
334
  // =============================================================================
@@ -219,6 +406,12 @@ export interface HDWalletModule {
219
406
  // Canonical SDN plugin-facing contract
220
407
  plugin: SdnPluginContract;
221
408
 
409
+ // Purpose-separated, instance-bound SDN wallet capabilities
410
+ readonly sdn: SdnIdentityCapabilities;
411
+
412
+ // Authenticated, immutable binding used only by the wallet-origin runtime
413
+ readonly walletOriginCapabilities: WalletOriginCapabilities;
414
+
222
415
  // Aligned binary API for efficient batch operations
223
416
  aligned: AlignedAPI;
224
417
  }
@@ -934,15 +1127,18 @@ export enum WellKnownCoinType {
934
1127
 
935
1128
  /**
936
1129
  * Initialize the HD Wallet WASM module
937
- * @param wasmPath - Optional path to WASM file
938
1130
  */
939
- export default function init(wasmPath?: string): Promise<HDWalletModule>;
1131
+ export default function init(): Promise<HDWalletModule>;
940
1132
 
941
1133
  /**
942
1134
  * Create HD Wallet instance (alternative syntax)
943
- * @param wasmPath - Optional path to WASM file
944
1135
  */
945
- export function createHDWallet(wasmPath?: string): Promise<HDWalletModule>;
1136
+ export function createHDWallet(): Promise<HDWalletModule>;
1137
+
1138
+ /** Resolve the immutable wallet-origin binding for its exact initialized owner. */
1139
+ export function getWalletOriginCapabilities(
1140
+ module: HDWalletModule,
1141
+ ): WalletOriginCapabilities;
946
1142
 
947
1143
  export const HD_WALLET_SDN_PLUGIN_MANIFEST: SdnPluginManifest;
948
1144
  export const SDN_PLUGIN_MANIFEST_EXPORTS: {
@@ -950,76 +1146,6 @@ export const SDN_PLUGIN_MANIFEST_EXPORTS: {
950
1146
  sizeSymbol: string;
951
1147
  };
952
1148
 
953
- // =============================================================================
954
- // EPM Attestation
955
- // =============================================================================
956
-
957
- export interface ChainProofData {
958
- CHAIN: string;
959
- ADDRESS: string;
960
- PUBLIC_KEY: string;
961
- KEY_PATH: string;
962
- SIGNATURE: string;
963
- SIGNED_PAYLOAD: string;
964
- ALGORITHM: string;
965
- ENCODING: string;
966
- }
967
-
968
- export interface CanonicalPayloadParams {
969
- xpub: string;
970
- signingPubKeyHex: string;
971
- encryptionPubKeyHex: string;
972
- issuedAt: number;
973
- identityPubKeyHex?: string;
974
- version?: string;
975
- }
976
-
977
- export interface ChainKeyParams {
978
- address: string;
979
- publicKeyHex: string;
980
- privateKey: Uint8Array;
981
- keyPath: string;
982
- canonicalPayload: string;
983
- }
984
-
985
- export interface AllChainProofsParams {
986
- canonicalPayload: string;
987
- bitcoin?: Omit<ChainKeyParams, 'canonicalPayload'>;
988
- ethereum?: Omit<ChainKeyParams, 'canonicalPayload'>;
989
- solana?: Omit<ChainKeyParams, 'canonicalPayload'>;
990
- }
991
-
992
- export interface ChainProofVerifyResult {
993
- valid: boolean;
994
- results: Array<{ chain: string; valid: boolean }>;
995
- }
996
-
997
- /** Build a canonical attestation payload for chain proof signing */
998
- export function buildCanonicalPayload(params: CanonicalPayloadParams): string;
999
-
1000
- /** Build canonical EPM content bytes for signing (excludes SIGNATURE and SIGNATURE_TIMESTAMP) */
1001
- export function buildEPMSigningContent(epm: Record<string, unknown>): Uint8Array;
1002
-
1003
- /** Sign EPM content with an Ed25519 private key */
1004
- export function signEPMContent(wallet: HDWalletModule, epm: Record<string, unknown>, ed25519PrivateKey: Uint8Array): { signature: string; timestamp: number };
1005
-
1006
- /** Verify an EPM content signature */
1007
- export function verifyEPMSignature(wallet: HDWalletModule, epm: Record<string, unknown>, ed25519PublicKey: Uint8Array): boolean;
1008
-
1009
- /** Build a Bitcoin chain proof */
1010
- export function buildBitcoinChainProof(wallet: HDWalletModule, params: ChainKeyParams): ChainProofData;
1011
-
1012
- /** Build an Ethereum chain proof */
1013
- export function buildEthereumChainProof(wallet: HDWalletModule, params: ChainKeyParams): ChainProofData;
1014
-
1015
- /** Build a Solana chain proof */
1016
- export function buildSolanaChainProof(wallet: HDWalletModule, params: ChainKeyParams): ChainProofData;
1017
-
1018
- /** Build all chain proofs for a full identity attestation */
1019
- export function buildAllChainProofs(wallet: HDWalletModule, params: AllChainProofsParams): ChainProofData[];
1020
-
1021
- /** Verify a single chain proof */
1022
- export function verifyChainProof(wallet: HDWalletModule, proof: ChainProofData): boolean;
1023
-
1024
- /** Verify all chain proofs in an EPM */
1025
- export function verifyAllChainProofs(wallet: HDWalletModule, chainProofs: ChainProofData[]): ChainProofVerifyResult;
1149
+ // Keep the root declaration surface identical to the dedicated attestation
1150
+ // subpath instead of maintaining a second, diverging copy of these types.
1151
+ export * from './epm-attestation.js';
@@ -9,7 +9,7 @@
9
9
  * - Transaction building and signing
10
10
  *
11
11
  * @module hd-wallet-wasm
12
- * @version 2.0.9
12
+ * @version 2.0.26
13
13
  */
14
14
 
15
15
  // Import aligned API for batch operations
@@ -19,6 +19,56 @@ import {
19
19
  SDN_PLUGIN_MANIFEST_EXPORTS
20
20
  } from './sdn-plugin.mjs';
21
21
  import { HD_WALLET_SDN_PLUGIN_MANIFEST } from './sdn-plugin-manifest-source.mjs';
22
+ import { createSdnTypedCapabilities } from './sdn-typed.mjs';
23
+
24
+ const walletOriginCapabilitiesByModule = new WeakMap();
25
+
26
+ function createWalletOriginCapabilitiesBinding(module) {
27
+ const sdn = module.sdn;
28
+ const utils = module.utils;
29
+ const wasmSha256 = utils.sha256;
30
+ return Object.freeze({
31
+ sdn,
32
+ sha256(bytes) {
33
+ return wasmSha256(bytes);
34
+ },
35
+ });
36
+ }
37
+
38
+ function installWalletOriginCapabilities(module) {
39
+ const binding = createWalletOriginCapabilitiesBinding(module);
40
+ Object.defineProperty(module, 'walletOriginCapabilities', {
41
+ value: binding,
42
+ enumerable: false,
43
+ writable: false,
44
+ configurable: false,
45
+ });
46
+ walletOriginCapabilitiesByModule.set(module, binding);
47
+ }
48
+
49
+ /**
50
+ * Resolve the wallet-origin binding only for the exact initialized owner.
51
+ * Forged pairs and copied bindings are never accepted as module authority.
52
+ *
53
+ * @param {Object} module - An initialized HDWalletModule returned by init().
54
+ * @returns {{sdn: Object, sha256: (bytes: Uint8Array) => Uint8Array}}
55
+ */
56
+ export function getWalletOriginCapabilities(module) {
57
+ if (module === null || typeof module !== 'object') {
58
+ throw new TypeError('Invalid HD wallet module');
59
+ }
60
+ const binding = walletOriginCapabilitiesByModule.get(module);
61
+ if (!binding) throw new TypeError('Invalid HD wallet module');
62
+ const descriptor = Object.getOwnPropertyDescriptor(
63
+ module,
64
+ 'walletOriginCapabilities',
65
+ );
66
+ if (!descriptor || descriptor.value !== binding || descriptor.enumerable ||
67
+ descriptor.writable || descriptor.configurable) {
68
+ throw new TypeError('Invalid HD wallet module');
69
+ }
70
+ return binding;
71
+ }
22
72
 
23
73
  // =============================================================================
24
74
  // Enums (matching TypeScript definitions)
@@ -1183,7 +1233,7 @@ async function loadWasmModule() {
1183
1233
  let HDWalletWasm;
1184
1234
 
1185
1235
  try {
1186
- const module = await import('../dist/hd-wallet.js');
1236
+ const module = await import('../hd-wallet.js');
1187
1237
  HDWalletWasm = module.default;
1188
1238
  } catch (e) {
1189
1239
  if (typeof globalThis !== 'undefined' && globalThis.HDWalletWasm) {
@@ -4586,6 +4636,13 @@ function createModule(wasm) {
4586
4636
  }
4587
4637
  };
4588
4638
 
4639
+ Object.defineProperty(module, 'sdn', {
4640
+ value: createSdnTypedCapabilities(wasm),
4641
+ enumerable: true,
4642
+ writable: false,
4643
+ configurable: false,
4644
+ });
4645
+ installWalletOriginCapabilities(module);
4589
4646
  module.plugin = createSdnPluginContract({ wallet: module, wasm });
4590
4647
  return module;
4591
4648
  }