hd-wallet-wasm 2.0.21 → 2.0.27
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/LICENSE +190 -0
- package/README.md +104 -407
- package/dist/hd-wallet-wasi.wasm +0 -0
- package/dist/hd-wallet.js +1 -1
- package/dist/runtime/epm-attestation.d.ts +105 -0
- package/dist/{index.d.ts → runtime/index.d.ts} +204 -78
- package/{src → dist/runtime}/index.mjs +59 -2
- package/dist/runtime/sdn-plugin-manifest-codec.mjs +567 -0
- package/dist/runtime/sdn-typed.mjs +928 -0
- package/dist/wasm-loader.d.ts +76 -0
- package/package.json +18 -23
- package/dist/hd-wallet.wasm +0 -0
- package/src/index.d.ts +0 -1025
- /package/{src → dist/runtime}/aligned.d.ts +0 -0
- /package/{src → dist/runtime}/aligned.mjs +0 -0
- /package/{src → dist/runtime}/epm-attestation.mjs +0 -0
- /package/{src → dist/runtime}/generated/aligned/hd_wallet_aligned.mjs +0 -0
- /package/{src → dist/runtime}/generated/sdn_plugin_manifest.mjs +0 -0
- /package/{src → dist/runtime}/sdn-plugin-manifest-source.mjs +0 -0
- /package/{src → dist/runtime}/sdn-plugin.mjs +0 -0
package/src/index.d.ts
DELETED
|
@@ -1,1025 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* HD Wallet WASM - TypeScript Definitions
|
|
3
|
-
*
|
|
4
|
-
* Comprehensive HD wallet implementation with:
|
|
5
|
-
* - BIP-32/39/44/49/84 support
|
|
6
|
-
* - Multi-curve cryptography (secp256k1, Ed25519, P-256, P-384, X25519)
|
|
7
|
-
* - Multi-chain support (Bitcoin, Ethereum, Solana, Cosmos, Polkadot)
|
|
8
|
-
* - Hardware wallet abstraction (requires bridge)
|
|
9
|
-
* - Transaction building and signing
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
// Import aligned API types
|
|
13
|
-
import { AlignedAPI } from './aligned';
|
|
14
|
-
|
|
15
|
-
export type BinaryLike = Uint8Array | ArrayBuffer | ArrayBufferView;
|
|
16
|
-
export type X509CertificateInput = string | BinaryLike;
|
|
17
|
-
|
|
18
|
-
export interface SdnPluginTypeRef {
|
|
19
|
-
schemaName: string | null;
|
|
20
|
-
fileIdentifier: string | null;
|
|
21
|
-
schemaHash?: number[];
|
|
22
|
-
acceptsAnyFlatbuffer?: boolean;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export interface SdnPluginAcceptedTypeSet {
|
|
26
|
-
setId: string;
|
|
27
|
-
allowedTypes: SdnPluginTypeRef[];
|
|
28
|
-
description?: string | null;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export interface SdnPluginPortManifest {
|
|
32
|
-
portId: string;
|
|
33
|
-
displayName?: string | null;
|
|
34
|
-
acceptedTypeSets: SdnPluginAcceptedTypeSet[];
|
|
35
|
-
minStreams?: number;
|
|
36
|
-
maxStreams?: number;
|
|
37
|
-
required?: boolean;
|
|
38
|
-
description?: string | null;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export interface SdnPluginMethodManifest {
|
|
42
|
-
methodId: string;
|
|
43
|
-
displayName?: string | null;
|
|
44
|
-
inputPorts: SdnPluginPortManifest[];
|
|
45
|
-
outputPorts: SdnPluginPortManifest[];
|
|
46
|
-
maxBatch?: number;
|
|
47
|
-
drainPolicy?: string | null;
|
|
48
|
-
description?: string | null;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export interface SdnPluginCapabilityManifest {
|
|
52
|
-
capabilityId: string;
|
|
53
|
-
required?: boolean;
|
|
54
|
-
description?: string | null;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export interface SdnPluginExternalInterfaceManifest {
|
|
58
|
-
interfaceId: string;
|
|
59
|
-
kind?: string | null;
|
|
60
|
-
direction?: string | null;
|
|
61
|
-
capability?: string | null;
|
|
62
|
-
resource?: string | null;
|
|
63
|
-
protocolId?: string | null;
|
|
64
|
-
topic?: string | null;
|
|
65
|
-
path?: string | null;
|
|
66
|
-
required?: boolean;
|
|
67
|
-
acceptedTypes?: SdnPluginTypeRef[];
|
|
68
|
-
description?: string | null;
|
|
69
|
-
properties?: Record<string, unknown>;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export interface SdnPluginBuildArtifact {
|
|
73
|
-
artifactId: string;
|
|
74
|
-
kind?: string | null;
|
|
75
|
-
path: string;
|
|
76
|
-
target?: string | null;
|
|
77
|
-
entrySymbol?: string | null;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export interface SdnPluginManifest {
|
|
81
|
-
pluginId: string;
|
|
82
|
-
name?: string | null;
|
|
83
|
-
version?: string | null;
|
|
84
|
-
pluginFamily?: string | null;
|
|
85
|
-
description?: string | null;
|
|
86
|
-
methods: SdnPluginMethodManifest[];
|
|
87
|
-
capabilities: SdnPluginCapabilityManifest[];
|
|
88
|
-
externalInterfaces: SdnPluginExternalInterfaceManifest[];
|
|
89
|
-
schemasUsed: SdnPluginTypeRef[];
|
|
90
|
-
buildArtifacts: SdnPluginBuildArtifact[];
|
|
91
|
-
abiVersion?: number;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
export interface SdnPluginFrame {
|
|
95
|
-
portId: string;
|
|
96
|
-
typeRef?: SdnPluginTypeRef | null;
|
|
97
|
-
alignment?: number;
|
|
98
|
-
offset?: number;
|
|
99
|
-
size?: number;
|
|
100
|
-
ownership?: string;
|
|
101
|
-
generation?: number;
|
|
102
|
-
mutability?: string;
|
|
103
|
-
traceId?: string | null;
|
|
104
|
-
streamId?: number;
|
|
105
|
-
sequence?: number;
|
|
106
|
-
payload: any;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
export interface SdnPluginInvocationResult {
|
|
110
|
-
outputs: SdnPluginFrame[];
|
|
111
|
-
backlogRemaining: number;
|
|
112
|
-
yielded: boolean;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
export interface SdnPluginCapabilities {
|
|
116
|
-
randomBytes?: (length: number, context?: Record<string, unknown>) => BinaryLike;
|
|
117
|
-
walletSign?: (request: {
|
|
118
|
-
curve: string;
|
|
119
|
-
payload: any;
|
|
120
|
-
messageBytes: Uint8Array;
|
|
121
|
-
digest: Uint8Array | null;
|
|
122
|
-
}) => {
|
|
123
|
-
signature: BinaryLike;
|
|
124
|
-
publicKey: BinaryLike;
|
|
125
|
-
algorithm?: string;
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
export interface SdnPluginContract {
|
|
130
|
-
manifest: SdnPluginManifest;
|
|
131
|
-
manifestExports: {
|
|
132
|
-
bytesSymbol: string;
|
|
133
|
-
sizeSymbol: string;
|
|
134
|
-
};
|
|
135
|
-
getManifest(): SdnPluginManifest;
|
|
136
|
-
getManifestBytes(): Uint8Array;
|
|
137
|
-
withCapabilities(capabilities: SdnPluginCapabilities): SdnPluginContract;
|
|
138
|
-
invoke(methodId: string, request: { inputs: SdnPluginFrame[] }): SdnPluginInvocationResult;
|
|
139
|
-
encrypt_fields(request: { inputs: SdnPluginFrame[] }): SdnPluginInvocationResult;
|
|
140
|
-
decrypt_fields(request: { inputs: SdnPluginFrame[] }): SdnPluginInvocationResult;
|
|
141
|
-
sign_detached(request: { inputs: SdnPluginFrame[] }): SdnPluginInvocationResult;
|
|
142
|
-
verify_detached(request: { inputs: SdnPluginFrame[] }): SdnPluginInvocationResult;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
// =============================================================================
|
|
146
|
-
// Module Types
|
|
147
|
-
// =============================================================================
|
|
148
|
-
|
|
149
|
-
export interface HDWalletModule {
|
|
150
|
-
// Module info
|
|
151
|
-
getVersion(): string;
|
|
152
|
-
hasCryptopp(): boolean;
|
|
153
|
-
isFipsMode(): boolean;
|
|
154
|
-
getSupportedCoins(): string[];
|
|
155
|
-
getSupportedCurves(): string[];
|
|
156
|
-
|
|
157
|
-
// OpenSSL FIPS support (when built with HD_WALLET_USE_OPENSSL)
|
|
158
|
-
/** Initialize OpenSSL in FIPS mode. Returns true if FIPS mode activated, false if using fallback. */
|
|
159
|
-
initFips(): boolean;
|
|
160
|
-
/** Check if OpenSSL backend is being used for FIPS algorithms */
|
|
161
|
-
isOpenSSL(): boolean;
|
|
162
|
-
/** Check if running in FIPS mode (OpenSSL FIPS provider active) */
|
|
163
|
-
isOpenSSLFips(): boolean;
|
|
164
|
-
|
|
165
|
-
// WASI bridge
|
|
166
|
-
wasiHasFeature(feature: WasiFeature): boolean;
|
|
167
|
-
wasiGetWarning(feature: WasiFeature): WasiWarning;
|
|
168
|
-
wasiGetWarningMessage(feature: WasiFeature): string;
|
|
169
|
-
|
|
170
|
-
// Entropy
|
|
171
|
-
injectEntropy(entropy: Uint8Array): void;
|
|
172
|
-
getEntropyStatus(): EntropyStatus;
|
|
173
|
-
|
|
174
|
-
// BIP-39 Mnemonic
|
|
175
|
-
mnemonic: MnemonicAPI;
|
|
176
|
-
|
|
177
|
-
// BIP-32 HD Keys
|
|
178
|
-
hdkey: HDKeyAPI;
|
|
179
|
-
|
|
180
|
-
// Multi-curve cryptography
|
|
181
|
-
curves: CurvesAPI;
|
|
182
|
-
|
|
183
|
-
// Bitcoin
|
|
184
|
-
bitcoin: BitcoinAPI;
|
|
185
|
-
|
|
186
|
-
// Ethereum
|
|
187
|
-
ethereum: EthereumAPI;
|
|
188
|
-
|
|
189
|
-
// Cosmos
|
|
190
|
-
cosmos: CosmosAPI;
|
|
191
|
-
|
|
192
|
-
// Solana
|
|
193
|
-
solana: SolanaAPI;
|
|
194
|
-
|
|
195
|
-
// Polkadot
|
|
196
|
-
polkadot: PolkadotAPI;
|
|
197
|
-
|
|
198
|
-
// Hardware wallets (requires bridge)
|
|
199
|
-
hardware: HardwareWalletAPI;
|
|
200
|
-
|
|
201
|
-
// Keyring
|
|
202
|
-
keyring: KeyringAPI;
|
|
203
|
-
|
|
204
|
-
// Utilities
|
|
205
|
-
utils: UtilsAPI;
|
|
206
|
-
|
|
207
|
-
// X.509 certificates
|
|
208
|
-
x509: X509API;
|
|
209
|
-
|
|
210
|
-
// Key derivation helpers
|
|
211
|
-
buildSigningPath: typeof buildSigningPath;
|
|
212
|
-
buildEncryptionPath: typeof buildEncryptionPath;
|
|
213
|
-
getSigningKey: typeof getSigningKey;
|
|
214
|
-
getEncryptionKey: typeof getEncryptionKey;
|
|
215
|
-
|
|
216
|
-
// libp2p PeerID / IPNS
|
|
217
|
-
libp2p: Libp2pAPI;
|
|
218
|
-
|
|
219
|
-
// Canonical SDN plugin-facing contract
|
|
220
|
-
plugin: SdnPluginContract;
|
|
221
|
-
|
|
222
|
-
// Aligned binary API for efficient batch operations
|
|
223
|
-
aligned: AlignedAPI;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
// =============================================================================
|
|
227
|
-
// Enums
|
|
228
|
-
// =============================================================================
|
|
229
|
-
|
|
230
|
-
export enum Curve {
|
|
231
|
-
SECP256K1 = 0,
|
|
232
|
-
ED25519 = 1,
|
|
233
|
-
P256 = 2,
|
|
234
|
-
P384 = 3,
|
|
235
|
-
X25519 = 4
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
export enum CoinType {
|
|
239
|
-
BITCOIN = 0,
|
|
240
|
-
BITCOIN_TESTNET = 1,
|
|
241
|
-
LITECOIN = 2,
|
|
242
|
-
DOGECOIN = 3,
|
|
243
|
-
ETHEREUM = 60,
|
|
244
|
-
ETHEREUM_CLASSIC = 61,
|
|
245
|
-
COSMOS = 118,
|
|
246
|
-
STELLAR = 148,
|
|
247
|
-
BITCOIN_CASH = 145,
|
|
248
|
-
POLKADOT = 354,
|
|
249
|
-
KUSAMA = 434,
|
|
250
|
-
SOLANA = 501,
|
|
251
|
-
BINANCE = 714,
|
|
252
|
-
CARDANO = 1815
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
/**
|
|
256
|
-
* BIP-39 wordlist language selector.
|
|
257
|
-
* ENGLISH is supported in this build; other locale values are reserved and
|
|
258
|
-
* currently return NOT_SUPPORTED.
|
|
259
|
-
*/
|
|
260
|
-
export enum Language {
|
|
261
|
-
ENGLISH = 0,
|
|
262
|
-
JAPANESE = 1,
|
|
263
|
-
KOREAN = 2,
|
|
264
|
-
SPANISH = 3,
|
|
265
|
-
CHINESE_SIMPLIFIED = 4,
|
|
266
|
-
CHINESE_TRADITIONAL = 5,
|
|
267
|
-
FRENCH = 6,
|
|
268
|
-
ITALIAN = 7,
|
|
269
|
-
CZECH = 8,
|
|
270
|
-
PORTUGUESE = 9
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
export enum WasiFeature {
|
|
274
|
-
RANDOM = 0,
|
|
275
|
-
FILESYSTEM = 1,
|
|
276
|
-
NETWORK = 2,
|
|
277
|
-
USB_HID = 3,
|
|
278
|
-
CLOCK = 4,
|
|
279
|
-
ENVIRONMENT = 5
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
export enum WasiWarning {
|
|
283
|
-
NONE = 0,
|
|
284
|
-
NEEDS_ENTROPY = 1,
|
|
285
|
-
NEEDS_BRIDGE = 2,
|
|
286
|
-
NOT_AVAILABLE_WASI = 3,
|
|
287
|
-
DISABLED_FIPS = 4,
|
|
288
|
-
NEEDS_CAPABILITY = 5
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
export enum EntropyStatus {
|
|
292
|
-
NOT_INITIALIZED = 0,
|
|
293
|
-
INITIALIZED = 1,
|
|
294
|
-
SUFFICIENT = 2
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
export enum BitcoinAddressType {
|
|
298
|
-
P2PKH = 0,
|
|
299
|
-
P2SH = 1,
|
|
300
|
-
P2WPKH = 2,
|
|
301
|
-
P2WSH = 3,
|
|
302
|
-
P2TR = 4
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
export enum Network {
|
|
306
|
-
MAINNET = 0,
|
|
307
|
-
TESTNET = 1
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
export enum X509Encoding {
|
|
311
|
-
PEM = 0,
|
|
312
|
-
DER = 1,
|
|
313
|
-
PKCS12 = 2
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
// =============================================================================
|
|
317
|
-
// BIP-39 Mnemonic API
|
|
318
|
-
// =============================================================================
|
|
319
|
-
|
|
320
|
-
export interface MnemonicAPI {
|
|
321
|
-
/**
|
|
322
|
-
* Generate a random mnemonic phrase
|
|
323
|
-
* @param wordCount Number of words (12, 15, 18, 21, or 24)
|
|
324
|
-
* @param language Wordlist language (ENGLISH supported in default build)
|
|
325
|
-
* @throws If entropy not available (WASI) or invalid word count
|
|
326
|
-
*/
|
|
327
|
-
generate(wordCount?: number, language?: Language): string;
|
|
328
|
-
|
|
329
|
-
/**
|
|
330
|
-
* Validate a mnemonic phrase
|
|
331
|
-
*/
|
|
332
|
-
validate(mnemonic: string, language?: Language): boolean;
|
|
333
|
-
|
|
334
|
-
/**
|
|
335
|
-
* Convert mnemonic to 64-byte seed
|
|
336
|
-
*/
|
|
337
|
-
toSeed(mnemonic: string, passphrase?: string): Uint8Array;
|
|
338
|
-
|
|
339
|
-
/**
|
|
340
|
-
* Convert mnemonic to entropy bytes
|
|
341
|
-
*/
|
|
342
|
-
toEntropy(mnemonic: string, language?: Language): Uint8Array;
|
|
343
|
-
|
|
344
|
-
/**
|
|
345
|
-
* Convert entropy to mnemonic
|
|
346
|
-
*/
|
|
347
|
-
fromEntropy(entropy: Uint8Array, language?: Language): string;
|
|
348
|
-
|
|
349
|
-
/**
|
|
350
|
-
* Get wordlist for language
|
|
351
|
-
*/
|
|
352
|
-
getWordlist(language?: Language): string[];
|
|
353
|
-
|
|
354
|
-
/**
|
|
355
|
-
* Get word suggestions for autocomplete
|
|
356
|
-
*/
|
|
357
|
-
suggestWords(prefix: string, language?: Language, maxSuggestions?: number): string[];
|
|
358
|
-
|
|
359
|
-
/**
|
|
360
|
-
* Check if word is in wordlist
|
|
361
|
-
*/
|
|
362
|
-
checkWord(word: string, language?: Language): boolean;
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
// =============================================================================
|
|
366
|
-
// BIP-32 HD Key API
|
|
367
|
-
// =============================================================================
|
|
368
|
-
|
|
369
|
-
export interface HDKey {
|
|
370
|
-
/** Derivation path */
|
|
371
|
-
readonly path: string;
|
|
372
|
-
|
|
373
|
-
/** Key depth in derivation tree */
|
|
374
|
-
readonly depth: number;
|
|
375
|
-
|
|
376
|
-
/** Parent fingerprint */
|
|
377
|
-
readonly parentFingerprint: number;
|
|
378
|
-
|
|
379
|
-
/** Child index */
|
|
380
|
-
readonly childIndex: number;
|
|
381
|
-
|
|
382
|
-
/** Is this a neutered (public-only) key? */
|
|
383
|
-
readonly isNeutered: boolean;
|
|
384
|
-
|
|
385
|
-
/** Elliptic curve */
|
|
386
|
-
readonly curve: Curve;
|
|
387
|
-
|
|
388
|
-
/** Get private key (throws if neutered) */
|
|
389
|
-
privateKey(): Uint8Array;
|
|
390
|
-
|
|
391
|
-
/** Get public key (compressed) */
|
|
392
|
-
publicKey(): Uint8Array;
|
|
393
|
-
|
|
394
|
-
/** Get public key (uncompressed) */
|
|
395
|
-
publicKeyUncompressed(): Uint8Array;
|
|
396
|
-
|
|
397
|
-
/** Get chain code */
|
|
398
|
-
chainCode(): Uint8Array;
|
|
399
|
-
|
|
400
|
-
/** Get key fingerprint */
|
|
401
|
-
fingerprint(): number;
|
|
402
|
-
|
|
403
|
-
/** Derive child key */
|
|
404
|
-
deriveChild(index: number): HDKey;
|
|
405
|
-
|
|
406
|
-
/** Derive child key (hardened) */
|
|
407
|
-
deriveHardened(index: number): HDKey;
|
|
408
|
-
|
|
409
|
-
/** Derive key at path */
|
|
410
|
-
derivePath(path: string): HDKey;
|
|
411
|
-
|
|
412
|
-
/** Get neutered (public-only) version */
|
|
413
|
-
neutered(): HDKey;
|
|
414
|
-
|
|
415
|
-
/** Serialize as xprv */
|
|
416
|
-
toXprv(): string;
|
|
417
|
-
|
|
418
|
-
/** Serialize as xpub */
|
|
419
|
-
toXpub(): string;
|
|
420
|
-
|
|
421
|
-
/** Securely wipe key from memory */
|
|
422
|
-
wipe(): void;
|
|
423
|
-
|
|
424
|
-
/** Clone key */
|
|
425
|
-
clone(): HDKey;
|
|
426
|
-
|
|
427
|
-
/** Compute libp2p peerID (raw multihash bytes) */
|
|
428
|
-
peerId(): Uint8Array;
|
|
429
|
-
|
|
430
|
-
/** Get peerID as base58btc string */
|
|
431
|
-
peerIdString(): string;
|
|
432
|
-
|
|
433
|
-
/** Get IPNS hash (CIDv1 base36lower) */
|
|
434
|
-
ipnsHash(): string;
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
export interface HDKeyAPI {
|
|
438
|
-
/**
|
|
439
|
-
* Create master key from seed
|
|
440
|
-
*/
|
|
441
|
-
fromSeed(seed: Uint8Array, curve?: Curve): HDKey;
|
|
442
|
-
|
|
443
|
-
/**
|
|
444
|
-
* Parse extended private key
|
|
445
|
-
*/
|
|
446
|
-
fromXprv(xprv: string): HDKey;
|
|
447
|
-
|
|
448
|
-
/**
|
|
449
|
-
* Parse extended public key
|
|
450
|
-
*/
|
|
451
|
-
fromXpub(xpub: string): HDKey;
|
|
452
|
-
|
|
453
|
-
/**
|
|
454
|
-
* Build BIP-44 path
|
|
455
|
-
*/
|
|
456
|
-
buildPath(purpose: number, coinType: number, account?: number, change?: number, index?: number): string;
|
|
457
|
-
|
|
458
|
-
/**
|
|
459
|
-
* Parse BIP-44 path
|
|
460
|
-
*/
|
|
461
|
-
parsePath(path: string): {
|
|
462
|
-
purpose: number;
|
|
463
|
-
coinType: number;
|
|
464
|
-
account: number;
|
|
465
|
-
change: number;
|
|
466
|
-
index: number;
|
|
467
|
-
};
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
// =============================================================================
|
|
471
|
-
// Multi-Curve API
|
|
472
|
-
// =============================================================================
|
|
473
|
-
|
|
474
|
-
export interface CurvesAPI {
|
|
475
|
-
/**
|
|
476
|
-
* Derive public key from private key
|
|
477
|
-
*/
|
|
478
|
-
publicKeyFromPrivate(privateKey: Uint8Array, curve: Curve): Uint8Array;
|
|
479
|
-
|
|
480
|
-
/**
|
|
481
|
-
* Compress public key
|
|
482
|
-
*/
|
|
483
|
-
compressPublicKey(publicKey: Uint8Array, curve: Curve): Uint8Array;
|
|
484
|
-
|
|
485
|
-
/**
|
|
486
|
-
* Decompress public key
|
|
487
|
-
*/
|
|
488
|
-
decompressPublicKey(publicKey: Uint8Array, curve: Curve): Uint8Array;
|
|
489
|
-
|
|
490
|
-
// ECDSA (secp256k1)
|
|
491
|
-
secp256k1: {
|
|
492
|
-
sign(message: Uint8Array, privateKey: Uint8Array): Uint8Array;
|
|
493
|
-
signRecoverable(message: Uint8Array, privateKey: Uint8Array): { signature: Uint8Array; recoveryId: number };
|
|
494
|
-
verify(message: Uint8Array, signature: Uint8Array, publicKey: Uint8Array): boolean;
|
|
495
|
-
recover(message: Uint8Array, signature: Uint8Array, recoveryId: number): Uint8Array;
|
|
496
|
-
ecdh(privateKey: Uint8Array, publicKey: Uint8Array): Uint8Array;
|
|
497
|
-
};
|
|
498
|
-
|
|
499
|
-
// EdDSA (Ed25519)
|
|
500
|
-
ed25519: {
|
|
501
|
-
sign(message: Uint8Array, privateKey: Uint8Array): Uint8Array;
|
|
502
|
-
verify(message: Uint8Array, signature: Uint8Array, publicKey: Uint8Array): boolean;
|
|
503
|
-
};
|
|
504
|
-
|
|
505
|
-
// ECDSA (P-256)
|
|
506
|
-
p256: {
|
|
507
|
-
sign(message: Uint8Array, privateKey: Uint8Array): Uint8Array;
|
|
508
|
-
verify(message: Uint8Array, signature: Uint8Array, publicKey: Uint8Array): boolean;
|
|
509
|
-
ecdh(privateKey: Uint8Array, publicKey: Uint8Array): Uint8Array;
|
|
510
|
-
};
|
|
511
|
-
|
|
512
|
-
// ECDSA (P-384)
|
|
513
|
-
p384: {
|
|
514
|
-
sign(message: Uint8Array, privateKey: Uint8Array): Uint8Array;
|
|
515
|
-
verify(message: Uint8Array, signature: Uint8Array, publicKey: Uint8Array): boolean;
|
|
516
|
-
ecdh(privateKey: Uint8Array, publicKey: Uint8Array): Uint8Array;
|
|
517
|
-
};
|
|
518
|
-
|
|
519
|
-
// X25519 (key exchange only)
|
|
520
|
-
x25519: {
|
|
521
|
-
ecdh(privateKey: Uint8Array, publicKey: Uint8Array): Uint8Array;
|
|
522
|
-
};
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
// =============================================================================
|
|
526
|
-
// Bitcoin API
|
|
527
|
-
// =============================================================================
|
|
528
|
-
|
|
529
|
-
export interface BitcoinAPI {
|
|
530
|
-
/**
|
|
531
|
-
* Get address from public key
|
|
532
|
-
*/
|
|
533
|
-
getAddress(publicKey: Uint8Array, type: BitcoinAddressType, network?: Network): string;
|
|
534
|
-
|
|
535
|
-
/**
|
|
536
|
-
* Validate Bitcoin address
|
|
537
|
-
*/
|
|
538
|
-
validateAddress(address: string): boolean;
|
|
539
|
-
|
|
540
|
-
/**
|
|
541
|
-
* Decode Bitcoin address
|
|
542
|
-
*/
|
|
543
|
-
decodeAddress(address: string): { type: BitcoinAddressType; hash: Uint8Array; network: Network };
|
|
544
|
-
|
|
545
|
-
/**
|
|
546
|
-
* Sign message (Bitcoin Signed Message format)
|
|
547
|
-
*/
|
|
548
|
-
signMessage(message: string, privateKey: Uint8Array): string;
|
|
549
|
-
|
|
550
|
-
/**
|
|
551
|
-
* Verify signed message
|
|
552
|
-
*/
|
|
553
|
-
verifyMessage(message: string, signature: string, address: string): boolean;
|
|
554
|
-
|
|
555
|
-
/**
|
|
556
|
-
* Transaction builder
|
|
557
|
-
*/
|
|
558
|
-
tx: BitcoinTxBuilder;
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
export interface BitcoinTxBuilder {
|
|
562
|
-
create(): BitcoinTx;
|
|
563
|
-
}
|
|
564
|
-
|
|
565
|
-
export interface BitcoinTx {
|
|
566
|
-
addInput(txid: string, vout: number, sequence?: number): this;
|
|
567
|
-
addOutput(address: string, amount: bigint): this;
|
|
568
|
-
sign(inputIndex: number, privateKey: Uint8Array, redeemScript?: Uint8Array): this;
|
|
569
|
-
serialize(): Uint8Array;
|
|
570
|
-
getTxid(): string;
|
|
571
|
-
getSize(): number;
|
|
572
|
-
getVsize(): number;
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
// =============================================================================
|
|
576
|
-
// Ethereum API
|
|
577
|
-
// =============================================================================
|
|
578
|
-
|
|
579
|
-
export interface EthereumAPI {
|
|
580
|
-
/**
|
|
581
|
-
* Get address from public key
|
|
582
|
-
*/
|
|
583
|
-
getAddress(publicKey: Uint8Array): string;
|
|
584
|
-
|
|
585
|
-
/**
|
|
586
|
-
* Get checksummed address (EIP-55)
|
|
587
|
-
*/
|
|
588
|
-
getChecksumAddress(address: string): string;
|
|
589
|
-
|
|
590
|
-
/**
|
|
591
|
-
* Validate Ethereum address
|
|
592
|
-
*/
|
|
593
|
-
validateAddress(address: string): boolean;
|
|
594
|
-
|
|
595
|
-
/**
|
|
596
|
-
* Sign message (EIP-191)
|
|
597
|
-
*/
|
|
598
|
-
signMessage(message: string, privateKey: Uint8Array): string;
|
|
599
|
-
|
|
600
|
-
/**
|
|
601
|
-
* Sign typed data (EIP-712)
|
|
602
|
-
*/
|
|
603
|
-
signTypedData(typedData: object, privateKey: Uint8Array): string;
|
|
604
|
-
|
|
605
|
-
/**
|
|
606
|
-
* Verify message signature
|
|
607
|
-
*/
|
|
608
|
-
verifyMessage(message: string, signature: string): string;
|
|
609
|
-
|
|
610
|
-
/**
|
|
611
|
-
* Transaction builder
|
|
612
|
-
*/
|
|
613
|
-
tx: EthereumTxBuilder;
|
|
614
|
-
}
|
|
615
|
-
|
|
616
|
-
export interface EthereumTxBuilder {
|
|
617
|
-
create(params: {
|
|
618
|
-
nonce: number;
|
|
619
|
-
gasPrice?: bigint;
|
|
620
|
-
gasLimit: bigint;
|
|
621
|
-
to?: string;
|
|
622
|
-
value?: bigint;
|
|
623
|
-
data?: Uint8Array;
|
|
624
|
-
chainId: number;
|
|
625
|
-
}): EthereumTx;
|
|
626
|
-
|
|
627
|
-
createEIP1559(params: {
|
|
628
|
-
nonce: number;
|
|
629
|
-
maxFeePerGas: bigint;
|
|
630
|
-
maxPriorityFeePerGas: bigint;
|
|
631
|
-
gasLimit: bigint;
|
|
632
|
-
to?: string;
|
|
633
|
-
value?: bigint;
|
|
634
|
-
data?: Uint8Array;
|
|
635
|
-
chainId: number;
|
|
636
|
-
}): EthereumTx;
|
|
637
|
-
}
|
|
638
|
-
|
|
639
|
-
export interface EthereumTx {
|
|
640
|
-
sign(privateKey: Uint8Array): this;
|
|
641
|
-
serialize(): Uint8Array;
|
|
642
|
-
getHash(): string;
|
|
643
|
-
}
|
|
644
|
-
|
|
645
|
-
// =============================================================================
|
|
646
|
-
// Cosmos API
|
|
647
|
-
// =============================================================================
|
|
648
|
-
|
|
649
|
-
export interface CosmosAPI {
|
|
650
|
-
getAddress(publicKey: Uint8Array, prefix?: string): string;
|
|
651
|
-
validateAddress(address: string): boolean;
|
|
652
|
-
signAmino(doc: object, privateKey: Uint8Array): object;
|
|
653
|
-
signDirect(bodyBytes: Uint8Array, authInfoBytes: Uint8Array, chainId: string, accountNumber: bigint, privateKey: Uint8Array): object;
|
|
654
|
-
verify(signature: Uint8Array, message: Uint8Array, publicKey: Uint8Array): boolean;
|
|
655
|
-
}
|
|
656
|
-
|
|
657
|
-
// =============================================================================
|
|
658
|
-
// Solana API
|
|
659
|
-
// =============================================================================
|
|
660
|
-
|
|
661
|
-
export interface SolanaAPI {
|
|
662
|
-
getAddress(publicKey: Uint8Array): string;
|
|
663
|
-
validateAddress(address: string): boolean;
|
|
664
|
-
signMessage(message: Uint8Array, privateKey: Uint8Array): Uint8Array;
|
|
665
|
-
verifyMessage(message: Uint8Array, signature: Uint8Array, publicKey: Uint8Array): boolean;
|
|
666
|
-
}
|
|
667
|
-
|
|
668
|
-
// =============================================================================
|
|
669
|
-
// Polkadot API
|
|
670
|
-
// =============================================================================
|
|
671
|
-
|
|
672
|
-
export interface PolkadotAPI {
|
|
673
|
-
getAddress(publicKey: Uint8Array, ss58Prefix?: number): string;
|
|
674
|
-
validateAddress(address: string): boolean;
|
|
675
|
-
signMessage(message: Uint8Array, privateKey: Uint8Array): Uint8Array;
|
|
676
|
-
verifyMessage(message: Uint8Array, signature: Uint8Array, publicKey: Uint8Array): boolean;
|
|
677
|
-
}
|
|
678
|
-
|
|
679
|
-
// =============================================================================
|
|
680
|
-
// Hardware Wallet API (requires bridge)
|
|
681
|
-
// =============================================================================
|
|
682
|
-
|
|
683
|
-
export interface HardwareWalletAPI {
|
|
684
|
-
/**
|
|
685
|
-
* Check if hardware wallet features are available
|
|
686
|
-
* Returns false in WASI without bridge
|
|
687
|
-
*/
|
|
688
|
-
isAvailable(): boolean;
|
|
689
|
-
|
|
690
|
-
/**
|
|
691
|
-
* Enumerate connected hardware wallets
|
|
692
|
-
*/
|
|
693
|
-
enumerate(): Promise<HardwareWalletDevice[]>;
|
|
694
|
-
|
|
695
|
-
/**
|
|
696
|
-
* Connect to a hardware wallet
|
|
697
|
-
*/
|
|
698
|
-
connect(devicePath: string): Promise<HardwareWallet>;
|
|
699
|
-
}
|
|
700
|
-
|
|
701
|
-
export interface HardwareWalletDevice {
|
|
702
|
-
vendorId: number;
|
|
703
|
-
productId: number;
|
|
704
|
-
serialNumber: string;
|
|
705
|
-
manufacturer: string;
|
|
706
|
-
product: string;
|
|
707
|
-
path: string;
|
|
708
|
-
}
|
|
709
|
-
|
|
710
|
-
export interface HardwareWallet {
|
|
711
|
-
readonly vendor: string;
|
|
712
|
-
readonly model: string;
|
|
713
|
-
readonly firmwareVersion: string;
|
|
714
|
-
readonly isConnected: boolean;
|
|
715
|
-
|
|
716
|
-
getPublicKey(path: string, curve?: Curve): Promise<Uint8Array>;
|
|
717
|
-
signTransaction(path: string, transaction: Uint8Array): Promise<Uint8Array>;
|
|
718
|
-
signMessage(path: string, message: string): Promise<Uint8Array>;
|
|
719
|
-
ping(): Promise<boolean>;
|
|
720
|
-
disconnect(): void;
|
|
721
|
-
}
|
|
722
|
-
|
|
723
|
-
// =============================================================================
|
|
724
|
-
// Keyring API
|
|
725
|
-
// =============================================================================
|
|
726
|
-
|
|
727
|
-
export interface KeyringAPI {
|
|
728
|
-
create(): Keyring;
|
|
729
|
-
}
|
|
730
|
-
|
|
731
|
-
export interface Keyring {
|
|
732
|
-
addWallet(seed: Uint8Array, name?: string): string;
|
|
733
|
-
removeWallet(id: string): void;
|
|
734
|
-
getWalletCount(): number;
|
|
735
|
-
getAccounts(walletId: string, coinType: CoinType, count?: number): string[];
|
|
736
|
-
signTransaction(walletId: string, path: string, transaction: Uint8Array): Uint8Array;
|
|
737
|
-
signMessage(walletId: string, path: string, message: Uint8Array): Uint8Array;
|
|
738
|
-
destroy(): void;
|
|
739
|
-
}
|
|
740
|
-
|
|
741
|
-
// =============================================================================
|
|
742
|
-
// Utilities API
|
|
743
|
-
// =============================================================================
|
|
744
|
-
|
|
745
|
-
export interface UtilsAPI {
|
|
746
|
-
// Hashing (sync - Crypto++)
|
|
747
|
-
sha256(data: Uint8Array): Uint8Array;
|
|
748
|
-
sha512(data: Uint8Array): Uint8Array;
|
|
749
|
-
keccak256(data: Uint8Array): Uint8Array;
|
|
750
|
-
ripemd160(data: Uint8Array): Uint8Array;
|
|
751
|
-
hash160(data: Uint8Array): Uint8Array;
|
|
752
|
-
blake2b(data: Uint8Array, outputLength?: number): Uint8Array;
|
|
753
|
-
blake2s(data: Uint8Array, outputLength?: number): Uint8Array;
|
|
754
|
-
|
|
755
|
-
// Key derivation
|
|
756
|
-
hkdf(ikm: Uint8Array, salt: Uint8Array, info: Uint8Array, length: number): Uint8Array;
|
|
757
|
-
pbkdf2(password: Uint8Array, salt: Uint8Array, iterations: number, length: number): Uint8Array;
|
|
758
|
-
scrypt(password: Uint8Array, salt: Uint8Array, n: number, r: number, p: number, length: number): Uint8Array;
|
|
759
|
-
|
|
760
|
-
// AES-GCM encryption/decryption (WASM/OpenSSL)
|
|
761
|
-
aesGcm: {
|
|
762
|
-
encrypt(key: Uint8Array, plaintext: Uint8Array, iv: Uint8Array, aad?: Uint8Array): { ciphertext: Uint8Array; tag: Uint8Array };
|
|
763
|
-
decrypt(key: Uint8Array, ciphertext: Uint8Array, tag: Uint8Array, iv: Uint8Array, aad?: Uint8Array): Uint8Array;
|
|
764
|
-
};
|
|
765
|
-
|
|
766
|
-
// Random number generation
|
|
767
|
-
getRandomBytes(length: number): Uint8Array;
|
|
768
|
-
generateIv(): Uint8Array;
|
|
769
|
-
generateAesKey(bits?: number): Uint8Array;
|
|
770
|
-
|
|
771
|
-
// Encoding
|
|
772
|
-
encodeBase58(data: Uint8Array): string;
|
|
773
|
-
decodeBase58(str: string): Uint8Array;
|
|
774
|
-
encodeBase58Check(data: Uint8Array): string;
|
|
775
|
-
decodeBase58Check(str: string): Uint8Array;
|
|
776
|
-
encodeBech32(hrp: string, data: Uint8Array): string;
|
|
777
|
-
decodeBech32(str: string): { hrp: string; data: Uint8Array };
|
|
778
|
-
encodeHex(data: Uint8Array): string;
|
|
779
|
-
decodeHex(str: string): Uint8Array;
|
|
780
|
-
encodeBase64(data: Uint8Array): string;
|
|
781
|
-
decodeBase64(str: string): Uint8Array;
|
|
782
|
-
|
|
783
|
-
// Memory
|
|
784
|
-
secureWipe(data: Uint8Array): void;
|
|
785
|
-
}
|
|
786
|
-
|
|
787
|
-
// =============================================================================
|
|
788
|
-
// X.509 API
|
|
789
|
-
// =============================================================================
|
|
790
|
-
|
|
791
|
-
export interface X509WalletAttestationOptions {
|
|
792
|
-
curve: Curve;
|
|
793
|
-
privateKey: BinaryLike;
|
|
794
|
-
keyLabel?: string;
|
|
795
|
-
commentPrefix?: string;
|
|
796
|
-
}
|
|
797
|
-
|
|
798
|
-
export interface X509CertificateOptions {
|
|
799
|
-
subjectDn: string;
|
|
800
|
-
serialHex?: string;
|
|
801
|
-
notBeforeUnix: number;
|
|
802
|
-
notAfterUnix: number;
|
|
803
|
-
isCa?: boolean;
|
|
804
|
-
pathLen?: number;
|
|
805
|
-
dnsNames?: string[];
|
|
806
|
-
ipAddresses?: string[];
|
|
807
|
-
emailAddresses?: string[];
|
|
808
|
-
uriNames?: string[];
|
|
809
|
-
keyUsage?: string[];
|
|
810
|
-
extendedKeyUsage?: string[];
|
|
811
|
-
friendlyName?: string;
|
|
812
|
-
walletAttestation?: X509WalletAttestationOptions;
|
|
813
|
-
}
|
|
814
|
-
|
|
815
|
-
export interface X509ParsedCertificate {
|
|
816
|
-
subjectDn: string;
|
|
817
|
-
issuerDn: string;
|
|
818
|
-
serialHex: string;
|
|
819
|
-
notBefore: string;
|
|
820
|
-
notAfter: string;
|
|
821
|
-
isCa: boolean;
|
|
822
|
-
dnsNames: string[];
|
|
823
|
-
ipAddresses: string[];
|
|
824
|
-
emailAddresses: string[];
|
|
825
|
-
uriNames: string[];
|
|
826
|
-
walletAttestationComment: string;
|
|
827
|
-
walletAttestationValid: boolean;
|
|
828
|
-
}
|
|
829
|
-
|
|
830
|
-
export interface X509Pkcs12Bundle {
|
|
831
|
-
certificatePem: string;
|
|
832
|
-
privateKeyPem: string;
|
|
833
|
-
chainPem: string;
|
|
834
|
-
}
|
|
835
|
-
|
|
836
|
-
export interface X509API {
|
|
837
|
-
isAvailable(): boolean;
|
|
838
|
-
generatePrivateKey(curve: Curve): Uint8Array;
|
|
839
|
-
exportPrivateKeyPem(curve: Curve, privateKey: BinaryLike): string;
|
|
840
|
-
importPrivateKeyPem(curve: Curve, pem: string): Uint8Array;
|
|
841
|
-
createSelfSignedCertificate(
|
|
842
|
-
options: X509CertificateOptions,
|
|
843
|
-
certificateCurve: Curve,
|
|
844
|
-
certificatePrivateKey: BinaryLike,
|
|
845
|
-
outputEncoding?: X509Encoding
|
|
846
|
-
): string | Uint8Array;
|
|
847
|
-
issueCertificate(
|
|
848
|
-
options: X509CertificateOptions,
|
|
849
|
-
issuerCurve: Curve,
|
|
850
|
-
issuerPrivateKey: BinaryLike,
|
|
851
|
-
issuerCertificate: X509CertificateInput,
|
|
852
|
-
issuerCertificateEncoding: X509Encoding,
|
|
853
|
-
subjectCurve: Curve,
|
|
854
|
-
subjectPrivateKey: BinaryLike,
|
|
855
|
-
outputEncoding?: X509Encoding
|
|
856
|
-
): string | Uint8Array;
|
|
857
|
-
convertCertificate(
|
|
858
|
-
certificate: X509CertificateInput,
|
|
859
|
-
inputEncoding: X509Encoding,
|
|
860
|
-
outputEncoding: X509Encoding
|
|
861
|
-
): string | Uint8Array;
|
|
862
|
-
parseCertificate(certificate: X509CertificateInput, inputEncoding?: X509Encoding): X509ParsedCertificate;
|
|
863
|
-
verifyWalletAttestation(certificate: X509CertificateInput, inputEncoding?: X509Encoding): boolean;
|
|
864
|
-
exportPkcs12(
|
|
865
|
-
certificate: X509CertificateInput,
|
|
866
|
-
certificateEncoding: X509Encoding,
|
|
867
|
-
privateKeyCurve: Curve,
|
|
868
|
-
privateKey: BinaryLike,
|
|
869
|
-
password: string,
|
|
870
|
-
friendlyName?: string,
|
|
871
|
-
chainPem?: X509CertificateInput
|
|
872
|
-
): Uint8Array;
|
|
873
|
-
importPkcs12(pkcs12Bundle: BinaryLike, password: string): X509Pkcs12Bundle;
|
|
874
|
-
}
|
|
875
|
-
|
|
876
|
-
// =============================================================================
|
|
877
|
-
// libp2p PeerID / IPNS API
|
|
878
|
-
// =============================================================================
|
|
879
|
-
|
|
880
|
-
export interface Libp2pAPI {
|
|
881
|
-
/** Compute libp2p peerID from a public key */
|
|
882
|
-
peerIdFromPublicKey(publicKey: Uint8Array, curve: Curve): Uint8Array;
|
|
883
|
-
|
|
884
|
-
/** Encode peerID bytes as base58btc string */
|
|
885
|
-
peerIdToString(peerIdBytes: Uint8Array): string;
|
|
886
|
-
|
|
887
|
-
/** Compute IPNS hash (CIDv1 base36lower, 'k' prefix) */
|
|
888
|
-
ipnsHash(peerIdBytes: Uint8Array): string;
|
|
889
|
-
|
|
890
|
-
/** Compute IPNS hash (CIDv1 base32lower, 'b' prefix) */
|
|
891
|
-
ipnsHashBase32(peerIdBytes: Uint8Array): string;
|
|
892
|
-
|
|
893
|
-
/** Derive PeerID string directly from a Base58Check-encoded xpub */
|
|
894
|
-
peerIdFromXpub(xpub: string): string;
|
|
895
|
-
|
|
896
|
-
/** Derive IPNS hash (CIDv1 base36lower) directly from an xpub */
|
|
897
|
-
ipnsHashFromXpub(xpub: string): string;
|
|
898
|
-
}
|
|
899
|
-
|
|
900
|
-
// =============================================================================
|
|
901
|
-
// Key Derivation Path Helpers
|
|
902
|
-
// =============================================================================
|
|
903
|
-
|
|
904
|
-
/** Keypair result from getSigningKey / getEncryptionKey */
|
|
905
|
-
export interface DerivedKeypair {
|
|
906
|
-
privateKey: Uint8Array;
|
|
907
|
-
publicKey: Uint8Array;
|
|
908
|
-
path: string;
|
|
909
|
-
}
|
|
910
|
-
|
|
911
|
-
/** Build a BIP-44 signing key path: m/44'/coinType'/account'/0/index */
|
|
912
|
-
export function buildSigningPath(coinType: string | number, account?: string | number, index?: string | number): string;
|
|
913
|
-
|
|
914
|
-
/** Build a BIP-44 encryption key path: m/44'/coinType'/account'/1/index */
|
|
915
|
-
export function buildEncryptionPath(coinType: string | number, account?: string | number, index?: string | number): string;
|
|
916
|
-
|
|
917
|
-
/** Derive signing keypair at m/44'/coinType'/account'/0/index */
|
|
918
|
-
export function getSigningKey(hdRoot: HDKey, coinType: string | number, account?: string | number, index?: string | number): DerivedKeypair;
|
|
919
|
-
|
|
920
|
-
/** Derive encryption keypair at m/44'/coinType'/account'/1/index */
|
|
921
|
-
export function getEncryptionKey(hdRoot: HDKey, coinType: string | number, account?: string | number, index?: string | number): DerivedKeypair;
|
|
922
|
-
|
|
923
|
-
/** Well-known coin types */
|
|
924
|
-
export enum WellKnownCoinType {
|
|
925
|
-
SDN = 0,
|
|
926
|
-
BITCOIN = 0,
|
|
927
|
-
ETHEREUM = 60,
|
|
928
|
-
SOLANA = 501,
|
|
929
|
-
}
|
|
930
|
-
|
|
931
|
-
// =============================================================================
|
|
932
|
-
// Module Initialization
|
|
933
|
-
// =============================================================================
|
|
934
|
-
|
|
935
|
-
/**
|
|
936
|
-
* Initialize the HD Wallet WASM module
|
|
937
|
-
* @param wasmPath - Optional path to WASM file
|
|
938
|
-
*/
|
|
939
|
-
export default function init(wasmPath?: string): Promise<HDWalletModule>;
|
|
940
|
-
|
|
941
|
-
/**
|
|
942
|
-
* Create HD Wallet instance (alternative syntax)
|
|
943
|
-
* @param wasmPath - Optional path to WASM file
|
|
944
|
-
*/
|
|
945
|
-
export function createHDWallet(wasmPath?: string): Promise<HDWalletModule>;
|
|
946
|
-
|
|
947
|
-
export const HD_WALLET_SDN_PLUGIN_MANIFEST: SdnPluginManifest;
|
|
948
|
-
export const SDN_PLUGIN_MANIFEST_EXPORTS: {
|
|
949
|
-
bytesSymbol: string;
|
|
950
|
-
sizeSymbol: string;
|
|
951
|
-
};
|
|
952
|
-
|
|
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;
|