shogun-core 3.3.5 → 3.3.6
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/dist/browser/shogun-core.js +79919 -190726
- package/dist/browser/shogun-core.js.map +1 -1
- package/dist/{src/index.js → index.js} +0 -1
- package/dist/{src/managers → managers}/CoreInitializer.js +0 -6
- package/dist/{src/storage → storage}/storage.js +0 -16
- package/dist/types/{src/index.d.ts → index.d.ts} +0 -1
- package/package.json +10 -26
- package/dist/browser/defaultVendors-node_modules_shogun-ipfs_node_modules_axios_index_js.shogun-core.js +0 -4078
- package/dist/browser/defaultVendors-node_modules_shogun-ipfs_node_modules_axios_index_js.shogun-core.js.map +0 -1
- package/dist/browser/defaultVendors-node_modules_shogun-ipfs_node_modules_is-ipfs_dist_src_index_js.shogun-core.js +0 -4908
- package/dist/browser/defaultVendors-node_modules_shogun-ipfs_node_modules_is-ipfs_dist_src_index_js.shogun-core.js.map +0 -1
- package/dist/browser/defaultVendors-node_modules_shogun-ipfs_node_modules_uint8-varint_dist_src_index_js-node_modu-0db5ba.shogun-core.js +0 -2109
- package/dist/browser/defaultVendors-node_modules_shogun-ipfs_node_modules_uint8-varint_dist_src_index_js-node_modu-0db5ba.shogun-core.js.map +0 -1
- package/dist/ship/examples/identity-cli.js +0 -511
- package/dist/ship/examples/messenger-cli.js +0 -745
- package/dist/ship/examples/stealth-cli.js +0 -433
- package/dist/ship/examples/storage-cli.js +0 -615
- package/dist/ship/examples/vault-cli.js +0 -444
- package/dist/ship/examples/wallet-cli.js +0 -767
- package/dist/ship/implementation/SHIP_00.js +0 -478
- package/dist/ship/implementation/SHIP_01.js +0 -433
- package/dist/ship/implementation/SHIP_02.js +0 -1366
- package/dist/ship/implementation/SHIP_03.js +0 -855
- package/dist/ship/implementation/SHIP_04.js +0 -589
- package/dist/ship/implementation/SHIP_05.js +0 -1064
- package/dist/ship/implementation/SHIP_06.js +0 -635
- package/dist/ship/index.js +0 -17
- package/dist/ship/interfaces/ISHIP_00.js +0 -135
- package/dist/ship/interfaces/ISHIP_01.js +0 -128
- package/dist/ship/interfaces/ISHIP_02.js +0 -57
- package/dist/ship/interfaces/ISHIP_03.js +0 -61
- package/dist/ship/interfaces/ISHIP_04.js +0 -62
- package/dist/ship/interfaces/ISHIP_05.js +0 -59
- package/dist/ship/interfaces/ISHIP_06.js +0 -194
- package/dist/types/ship/examples/identity-cli.d.ts +0 -40
- package/dist/types/ship/examples/messenger-cli.d.ts +0 -37
- package/dist/types/ship/examples/stealth-cli.d.ts +0 -31
- package/dist/types/ship/examples/storage-cli.d.ts +0 -48
- package/dist/types/ship/examples/vault-cli.d.ts +0 -13
- package/dist/types/ship/examples/wallet-cli.d.ts +0 -131
- package/dist/types/ship/implementation/SHIP_00.d.ts +0 -113
- package/dist/types/ship/implementation/SHIP_01.d.ts +0 -80
- package/dist/types/ship/implementation/SHIP_02.d.ts +0 -297
- package/dist/types/ship/implementation/SHIP_03.d.ts +0 -127
- package/dist/types/ship/implementation/SHIP_04.d.ts +0 -76
- package/dist/types/ship/implementation/SHIP_05.d.ts +0 -70
- package/dist/types/ship/implementation/SHIP_06.d.ts +0 -101
- package/dist/types/ship/index.d.ts +0 -14
- package/dist/types/ship/interfaces/ISHIP_00.d.ts +0 -410
- package/dist/types/ship/interfaces/ISHIP_01.d.ts +0 -343
- package/dist/types/ship/interfaces/ISHIP_02.d.ts +0 -470
- package/dist/types/ship/interfaces/ISHIP_03.d.ts +0 -295
- package/dist/types/ship/interfaces/ISHIP_04.d.ts +0 -245
- package/dist/types/ship/interfaces/ISHIP_05.d.ts +0 -234
- package/dist/types/ship/interfaces/ISHIP_06.d.ts +0 -522
- /package/dist/{src/config → config}/simplified-config.js +0 -0
- /package/dist/{src/core.js → core.js} +0 -0
- /package/dist/{src/examples → examples}/api-test.js +0 -0
- /package/dist/{src/examples → examples}/simple-api-test.js +0 -0
- /package/dist/{src/gundb → gundb}/api.js +0 -0
- /package/dist/{src/gundb → gundb}/crypto.js +0 -0
- /package/dist/{src/gundb → gundb}/db.js +0 -0
- /package/dist/{src/gundb → gundb}/derive.js +0 -0
- /package/dist/{src/gundb → gundb}/errors.js +0 -0
- /package/dist/{src/gundb → gundb}/index.js +0 -0
- /package/dist/{src/gundb → gundb}/rxjs.js +0 -0
- /package/dist/{src/gundb → gundb}/types.js +0 -0
- /package/dist/{src/interfaces → interfaces}/common.js +0 -0
- /package/dist/{src/interfaces → interfaces}/events.js +0 -0
- /package/dist/{src/interfaces → interfaces}/plugin.js +0 -0
- /package/dist/{src/interfaces → interfaces}/shogun.js +0 -0
- /package/dist/{src/managers → managers}/AuthManager.js +0 -0
- /package/dist/{src/managers → managers}/EventManager.js +0 -0
- /package/dist/{src/managers → managers}/PluginManager.js +0 -0
- /package/dist/{src/migration-test.js → migration-test.js} +0 -0
- /package/dist/{src/plugins → plugins}/base.js +0 -0
- /package/dist/{src/plugins → plugins}/index.js +0 -0
- /package/dist/{src/plugins → plugins}/nostr/index.js +0 -0
- /package/dist/{src/plugins → plugins}/nostr/nostrConnector.js +0 -0
- /package/dist/{src/plugins → plugins}/nostr/nostrConnectorPlugin.js +0 -0
- /package/dist/{src/plugins → plugins}/nostr/nostrSigner.js +0 -0
- /package/dist/{src/plugins → plugins}/nostr/types.js +0 -0
- /package/dist/{src/plugins → plugins}/oauth/index.js +0 -0
- /package/dist/{src/plugins → plugins}/oauth/oauthConnector.js +0 -0
- /package/dist/{src/plugins → plugins}/oauth/oauthPlugin.js +0 -0
- /package/dist/{src/plugins → plugins}/oauth/types.js +0 -0
- /package/dist/{src/plugins → plugins}/web3/index.js +0 -0
- /package/dist/{src/plugins → plugins}/web3/types.js +0 -0
- /package/dist/{src/plugins → plugins}/web3/web3Connector.js +0 -0
- /package/dist/{src/plugins → plugins}/web3/web3ConnectorPlugin.js +0 -0
- /package/dist/{src/plugins → plugins}/web3/web3Signer.js +0 -0
- /package/dist/{src/plugins → plugins}/webauthn/index.js +0 -0
- /package/dist/{src/plugins → plugins}/webauthn/types.js +0 -0
- /package/dist/{src/plugins → plugins}/webauthn/webauthn.js +0 -0
- /package/dist/{src/plugins → plugins}/webauthn/webauthnPlugin.js +0 -0
- /package/dist/{src/plugins → plugins}/webauthn/webauthnSigner.js +0 -0
- /package/dist/types/{src/config → config}/simplified-config.d.ts +0 -0
- /package/dist/types/{src/core.d.ts → core.d.ts} +0 -0
- /package/dist/{src/types → types}/events.js +0 -0
- /package/dist/types/{src/examples → examples}/api-test.d.ts +0 -0
- /package/dist/types/{src/examples → examples}/simple-api-test.d.ts +0 -0
- /package/dist/types/{src/gundb → gundb}/api.d.ts +0 -0
- /package/dist/types/{src/gundb → gundb}/crypto.d.ts +0 -0
- /package/dist/types/{src/gundb → gundb}/db.d.ts +0 -0
- /package/dist/types/{src/gundb → gundb}/derive.d.ts +0 -0
- /package/dist/types/{src/gundb → gundb}/errors.d.ts +0 -0
- /package/dist/types/{src/gundb → gundb}/index.d.ts +0 -0
- /package/dist/types/{src/gundb → gundb}/rxjs.d.ts +0 -0
- /package/dist/types/{src/gundb → gundb}/types.d.ts +0 -0
- /package/dist/types/{src/interfaces → interfaces}/common.d.ts +0 -0
- /package/dist/types/{src/interfaces → interfaces}/events.d.ts +0 -0
- /package/dist/types/{src/interfaces → interfaces}/plugin.d.ts +0 -0
- /package/dist/types/{src/interfaces → interfaces}/shogun.d.ts +0 -0
- /package/dist/types/{src/managers → managers}/AuthManager.d.ts +0 -0
- /package/dist/types/{src/managers → managers}/CoreInitializer.d.ts +0 -0
- /package/dist/types/{src/managers → managers}/EventManager.d.ts +0 -0
- /package/dist/types/{src/managers → managers}/PluginManager.d.ts +0 -0
- /package/dist/types/{src/migration-test.d.ts → migration-test.d.ts} +0 -0
- /package/dist/types/{src/plugins → plugins}/base.d.ts +0 -0
- /package/dist/types/{src/plugins → plugins}/index.d.ts +0 -0
- /package/dist/types/{src/plugins → plugins}/nostr/index.d.ts +0 -0
- /package/dist/types/{src/plugins → plugins}/nostr/nostrConnector.d.ts +0 -0
- /package/dist/types/{src/plugins → plugins}/nostr/nostrConnectorPlugin.d.ts +0 -0
- /package/dist/types/{src/plugins → plugins}/nostr/nostrSigner.d.ts +0 -0
- /package/dist/types/{src/plugins → plugins}/nostr/types.d.ts +0 -0
- /package/dist/types/{src/plugins → plugins}/oauth/index.d.ts +0 -0
- /package/dist/types/{src/plugins → plugins}/oauth/oauthConnector.d.ts +0 -0
- /package/dist/types/{src/plugins → plugins}/oauth/oauthPlugin.d.ts +0 -0
- /package/dist/types/{src/plugins → plugins}/oauth/types.d.ts +0 -0
- /package/dist/types/{src/plugins → plugins}/web3/index.d.ts +0 -0
- /package/dist/types/{src/plugins → plugins}/web3/types.d.ts +0 -0
- /package/dist/types/{src/plugins → plugins}/web3/web3Connector.d.ts +0 -0
- /package/dist/types/{src/plugins → plugins}/web3/web3ConnectorPlugin.d.ts +0 -0
- /package/dist/types/{src/plugins → plugins}/web3/web3Signer.d.ts +0 -0
- /package/dist/types/{src/plugins → plugins}/webauthn/index.d.ts +0 -0
- /package/dist/types/{src/plugins → plugins}/webauthn/types.d.ts +0 -0
- /package/dist/types/{src/plugins → plugins}/webauthn/webauthn.d.ts +0 -0
- /package/dist/types/{src/plugins → plugins}/webauthn/webauthnPlugin.d.ts +0 -0
- /package/dist/types/{src/plugins → plugins}/webauthn/webauthnSigner.d.ts +0 -0
- /package/dist/{src/types → types}/shogun.js +0 -0
- /package/dist/types/{src/storage → storage}/storage.d.ts +0 -0
- /package/dist/types/{src/types → types}/events.d.ts +0 -0
- /package/dist/types/{src/types → types}/shogun.d.ts +0 -0
- /package/dist/types/{src/utils → utils}/errorHandler.d.ts +0 -0
- /package/dist/types/{src/utils → utils}/eventEmitter.d.ts +0 -0
- /package/dist/types/{src/utils → utils}/validation.d.ts +0 -0
- /package/dist/{src/utils → utils}/errorHandler.js +0 -0
- /package/dist/{src/utils → utils}/eventEmitter.js +0 -0
- /package/dist/{src/utils → utils}/validation.js +0 -0
|
@@ -1,470 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SHIP-02: Ethereum Address Derivation Interface
|
|
3
|
-
*
|
|
4
|
-
* @title ISHIP_02 - Deterministic Address Derivation
|
|
5
|
-
* @notice Interface for deriving Ethereum addresses from SHIP-00 identity
|
|
6
|
-
*
|
|
7
|
-
* ## Abstract
|
|
8
|
-
*
|
|
9
|
-
* This standard extends SHIP-00 to enable:
|
|
10
|
-
* - Deterministic Ethereum address derivation from identity keys
|
|
11
|
-
* - BIP-32/BIP-44 hierarchical deterministic (HD) wallet support
|
|
12
|
-
* - Stealth address generation for enhanced privacy
|
|
13
|
-
* - Multiple address management from single identity
|
|
14
|
-
* - Transaction signing with derived keys
|
|
15
|
-
*
|
|
16
|
-
* ## Specification
|
|
17
|
-
*
|
|
18
|
-
* Based on:
|
|
19
|
-
* - SHIP-00 for identity foundation
|
|
20
|
-
* - BIP-32 for hierarchical deterministic wallets
|
|
21
|
-
* - BIP-44 for multi-account hierarchy
|
|
22
|
-
* - Ethers.js for Ethereum operations
|
|
23
|
-
* - ECDH for stealth address generation
|
|
24
|
-
*
|
|
25
|
-
* ## Dependencies
|
|
26
|
-
*
|
|
27
|
-
* - SHIP-00: Identity and authentication foundation
|
|
28
|
-
* - ethers: Ethereum wallet and signing operations
|
|
29
|
-
*
|
|
30
|
-
* ## Usage
|
|
31
|
-
*
|
|
32
|
-
* SHIP-02 enables wallet functionality on top of SHIP-00 identity:
|
|
33
|
-
* ```typescript
|
|
34
|
-
* const identity = new SHIP_00({ gunOptions: { peers: ['...'] } });
|
|
35
|
-
* await identity.login('alice', 'password123');
|
|
36
|
-
*
|
|
37
|
-
* const addressDerivation = new SHIP_02(identity);
|
|
38
|
-
* await addressDerivation.initialize();
|
|
39
|
-
*
|
|
40
|
-
* const ethAddress = await addressDerivation.deriveEthereumAddress();
|
|
41
|
-
* ```
|
|
42
|
-
*/
|
|
43
|
-
/**
|
|
44
|
-
* @notice Result of address derivation operation
|
|
45
|
-
*/
|
|
46
|
-
export interface DerivationResult {
|
|
47
|
-
success: boolean;
|
|
48
|
-
address?: string;
|
|
49
|
-
path?: string;
|
|
50
|
-
publicKey?: string;
|
|
51
|
-
error?: string;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* @notice Stealth address generation result
|
|
55
|
-
*/
|
|
56
|
-
export interface StealthAddressResult {
|
|
57
|
-
success: boolean;
|
|
58
|
-
address?: string;
|
|
59
|
-
ephemeralPublicKey?: string;
|
|
60
|
-
viewTag?: string;
|
|
61
|
-
sharedSecret?: string;
|
|
62
|
-
error?: string;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* @notice Transaction signing result
|
|
66
|
-
*/
|
|
67
|
-
export interface SignatureResult {
|
|
68
|
-
success: boolean;
|
|
69
|
-
signature?: string;
|
|
70
|
-
signedTransaction?: string;
|
|
71
|
-
txHash?: string;
|
|
72
|
-
error?: string;
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* @notice Address book entry
|
|
76
|
-
*/
|
|
77
|
-
export interface AddressEntry {
|
|
78
|
-
address: string;
|
|
79
|
-
path: string;
|
|
80
|
-
publicKey: string;
|
|
81
|
-
index: number;
|
|
82
|
-
label?: string;
|
|
83
|
-
createdAt: number;
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* @notice Exported address book
|
|
87
|
-
*/
|
|
88
|
-
export interface AddressBook {
|
|
89
|
-
addresses: AddressEntry[];
|
|
90
|
-
masterPublicKey: string;
|
|
91
|
-
derivationMethod: 'bip44' | 'simple' | 'stealth';
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* @notice Wallet info with ready-to-use wallet object (frontend-friendly)
|
|
95
|
-
*/
|
|
96
|
-
export interface WalletInfo {
|
|
97
|
-
wallet: any;
|
|
98
|
-
path: string;
|
|
99
|
-
address: string;
|
|
100
|
-
publicKey?: string;
|
|
101
|
-
index?: number;
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* @notice Wallet path metadata
|
|
105
|
-
*/
|
|
106
|
-
export interface WalletPath {
|
|
107
|
-
path: string;
|
|
108
|
-
created: number;
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* @notice Event types for SHIP-02 wallet operations
|
|
112
|
-
*/
|
|
113
|
-
export declare enum SHIP_02_EventType {
|
|
114
|
-
WALLET_CREATED = "walletCreated",
|
|
115
|
-
ADDRESS_DERIVED = "addressDerived",
|
|
116
|
-
TRANSACTION_SIGNED = "transactionSigned",
|
|
117
|
-
MNEMONIC_GENERATED = "mnemonicGenerated",
|
|
118
|
-
SYNC_COMPLETED = "syncCompleted",
|
|
119
|
-
ERROR = "error"
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* @notice Event data for SHIP-02 operations
|
|
123
|
-
*/
|
|
124
|
-
export interface SHIP_02_Event {
|
|
125
|
-
type: SHIP_02_EventType;
|
|
126
|
-
data?: any;
|
|
127
|
-
timestamp: number;
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* @notice Transaction object for signing
|
|
131
|
-
*/
|
|
132
|
-
export interface Transaction {
|
|
133
|
-
to: string;
|
|
134
|
-
value?: string | bigint;
|
|
135
|
-
data?: string;
|
|
136
|
-
gasLimit?: string | bigint;
|
|
137
|
-
gasPrice?: string | bigint;
|
|
138
|
-
maxFeePerGas?: string | bigint;
|
|
139
|
-
maxPriorityFeePerGas?: string | bigint;
|
|
140
|
-
nonce?: number;
|
|
141
|
-
chainId?: number;
|
|
142
|
-
type?: number;
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* @notice Signed transaction
|
|
146
|
-
*/
|
|
147
|
-
export interface SignedTransaction {
|
|
148
|
-
raw: string;
|
|
149
|
-
hash: string;
|
|
150
|
-
from: string;
|
|
151
|
-
to: string;
|
|
152
|
-
value: string;
|
|
153
|
-
data: string;
|
|
154
|
-
chainId: number;
|
|
155
|
-
nonce: number;
|
|
156
|
-
gasLimit: string;
|
|
157
|
-
signature: {
|
|
158
|
-
r: string;
|
|
159
|
-
s: string;
|
|
160
|
-
v: number;
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* @notice Configuration options for SHIP-02
|
|
165
|
-
*/
|
|
166
|
-
export interface SHIP_02_Config {
|
|
167
|
-
/** Default coin type (60 for Ethereum) */
|
|
168
|
-
defaultCoinType?: number;
|
|
169
|
-
/** Default account index */
|
|
170
|
-
defaultAccount?: number;
|
|
171
|
-
/** Enable stealth address support */
|
|
172
|
-
enableStealth?: boolean;
|
|
173
|
-
/** Custom derivation path prefix */
|
|
174
|
-
customPathPrefix?: string;
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* @title ISHIP_02 - Ethereum Address Derivation
|
|
178
|
-
* @notice Main interface for deterministic address derivation from SHIP-00 identity
|
|
179
|
-
*/
|
|
180
|
-
export interface ISHIP_02 {
|
|
181
|
-
/**
|
|
182
|
-
* @notice Initialize the address derivation system
|
|
183
|
-
* @dev Must be called before using any derivation methods
|
|
184
|
-
* @returns Promise that resolves when initialization is complete
|
|
185
|
-
*/
|
|
186
|
-
initialize(): Promise<void>;
|
|
187
|
-
/**
|
|
188
|
-
* @notice Check if system is initialized
|
|
189
|
-
* @returns True if initialized, false otherwise
|
|
190
|
-
*/
|
|
191
|
-
isInitialized(): boolean;
|
|
192
|
-
/**
|
|
193
|
-
* @notice Derive a single Ethereum address from identity
|
|
194
|
-
* @param path Optional BIP-32 derivation path (default: m/44'/60'/0'/0/0)
|
|
195
|
-
* @returns Promise resolving to DerivationResult
|
|
196
|
-
*/
|
|
197
|
-
deriveEthereumAddress(path?: string): Promise<DerivationResult>;
|
|
198
|
-
/**
|
|
199
|
-
* @notice Derive multiple Ethereum addresses sequentially
|
|
200
|
-
* @param count Number of addresses to derive
|
|
201
|
-
* @param startIndex Starting index (default: 0)
|
|
202
|
-
* @returns Promise resolving to array of DerivationResults
|
|
203
|
-
*/
|
|
204
|
-
deriveMultipleAddresses(count: number, startIndex?: number): Promise<DerivationResult[]>;
|
|
205
|
-
/**
|
|
206
|
-
* @notice Get the primary (default) Ethereum address
|
|
207
|
-
* @returns Promise resolving to primary address string
|
|
208
|
-
*/
|
|
209
|
-
getPrimaryAddress(): Promise<string>;
|
|
210
|
-
/**
|
|
211
|
-
* @notice Derive address using BIP-44 standard path
|
|
212
|
-
* @param coinType Coin type (default: 60 for Ethereum)
|
|
213
|
-
* @param account Account index (default: 0)
|
|
214
|
-
* @param change Change chain (0 = external, 1 = internal)
|
|
215
|
-
* @param index Address index
|
|
216
|
-
* @returns Promise resolving to DerivationResult
|
|
217
|
-
*/
|
|
218
|
-
deriveBIP44Address(coinType?: number, account?: number, change?: number, index?: number): Promise<DerivationResult>;
|
|
219
|
-
/**
|
|
220
|
-
* @notice Derive multiple accounts following BIP-44
|
|
221
|
-
* @param accountCount Number of accounts to derive
|
|
222
|
-
* @returns Promise resolving to array of DerivationResults
|
|
223
|
-
*/
|
|
224
|
-
deriveMultipleAccounts(accountCount: number): Promise<DerivationResult[]>;
|
|
225
|
-
/**
|
|
226
|
-
* @notice Generate a stealth address for private transactions
|
|
227
|
-
* @param recipientPublicKey Optional recipient public key for dual-key stealth
|
|
228
|
-
* @returns Promise resolving to StealthAddressResult
|
|
229
|
-
*/
|
|
230
|
-
generateStealthAddress(recipientPublicKey?: string): Promise<StealthAddressResult>;
|
|
231
|
-
/**
|
|
232
|
-
* @notice Derive shared secret for stealth address
|
|
233
|
-
* @param publicKey Public key to derive shared secret with
|
|
234
|
-
* @returns Promise resolving to shared secret hex string
|
|
235
|
-
*/
|
|
236
|
-
deriveSharedSecret(publicKey: string): Promise<string>;
|
|
237
|
-
/**
|
|
238
|
-
* @notice Check if an address is a stealth address
|
|
239
|
-
* @param address Address to check
|
|
240
|
-
* @returns Promise resolving to boolean
|
|
241
|
-
*/
|
|
242
|
-
isStealthAddress(address: string): Promise<boolean>;
|
|
243
|
-
/**
|
|
244
|
-
* @notice Get private key for a specific derived address
|
|
245
|
-
* @param address The Ethereum address
|
|
246
|
-
* @returns Promise resolving to private key hex string
|
|
247
|
-
* @dev SECURITY: Handle with extreme care!
|
|
248
|
-
*/
|
|
249
|
-
getPrivateKeyForAddress(address: string): Promise<string>;
|
|
250
|
-
/**
|
|
251
|
-
* @notice Get public key for a specific derived address
|
|
252
|
-
* @param address The Ethereum address
|
|
253
|
-
* @returns Promise resolving to public key hex string
|
|
254
|
-
*/
|
|
255
|
-
getPublicKeyForAddress(address: string): Promise<string>;
|
|
256
|
-
/**
|
|
257
|
-
* @notice Get derivation path for a specific address
|
|
258
|
-
* @param address The Ethereum address
|
|
259
|
-
* @returns Promise resolving to derivation path string or undefined
|
|
260
|
-
*/
|
|
261
|
-
getPathForAddress(address: string): Promise<string | undefined>;
|
|
262
|
-
/**
|
|
263
|
-
* @notice Sign a transaction with a derived address
|
|
264
|
-
* @param tx Transaction object to sign
|
|
265
|
-
* @param address Address to sign with
|
|
266
|
-
* @returns Promise resolving to SignatureResult
|
|
267
|
-
*/
|
|
268
|
-
signTransaction(tx: Transaction, address: string): Promise<SignatureResult>;
|
|
269
|
-
/**
|
|
270
|
-
* @notice Send transaction to Ethereum network
|
|
271
|
-
* @param tx Transaction object to send
|
|
272
|
-
* @param address Address to send from
|
|
273
|
-
* @param waitForConfirmation Wait for transaction to be mined (default: false)
|
|
274
|
-
* @returns Promise resolving to transaction hash and optional receipt
|
|
275
|
-
*
|
|
276
|
-
* Prerequisites:
|
|
277
|
-
* - RPC provider must be configured via setRpcUrl()
|
|
278
|
-
* - Address must be in the wallet (derived or cached)
|
|
279
|
-
* - Sufficient ETH balance for gas
|
|
280
|
-
*/
|
|
281
|
-
sendTransaction(tx: Transaction, address: string, waitForConfirmation?: boolean): Promise<{
|
|
282
|
-
success: boolean;
|
|
283
|
-
txHash?: string;
|
|
284
|
-
receipt?: any;
|
|
285
|
-
error?: string;
|
|
286
|
-
}>;
|
|
287
|
-
/**
|
|
288
|
-
* @notice Sign arbitrary message with a derived address
|
|
289
|
-
* @param message Message to sign (string or bytes)
|
|
290
|
-
* @param address Address to sign with
|
|
291
|
-
* @returns Promise resolving to signature hex string
|
|
292
|
-
*/
|
|
293
|
-
signMessage(message: string | Uint8Array, address: string): Promise<string>;
|
|
294
|
-
/**
|
|
295
|
-
* @notice Verify signature for a message
|
|
296
|
-
* @param message Original message
|
|
297
|
-
* @param signature Signature to verify
|
|
298
|
-
* @param address Expected signer address
|
|
299
|
-
* @returns Promise resolving to boolean (true if valid)
|
|
300
|
-
*/
|
|
301
|
-
verifySignature(message: string | Uint8Array, signature: string, address: string): Promise<boolean>;
|
|
302
|
-
/**
|
|
303
|
-
* @notice Get all derived addresses
|
|
304
|
-
* @returns Promise resolving to array of AddressEntry
|
|
305
|
-
*/
|
|
306
|
-
getAllAddresses(): Promise<AddressEntry[]>;
|
|
307
|
-
/**
|
|
308
|
-
* @notice Get address by index
|
|
309
|
-
* @param index Address index
|
|
310
|
-
* @returns Promise resolving to AddressEntry or undefined
|
|
311
|
-
*/
|
|
312
|
-
getAddressByIndex(index: number): Promise<AddressEntry | undefined>;
|
|
313
|
-
/**
|
|
314
|
-
* @notice Set label for an address
|
|
315
|
-
* @param address Address to label
|
|
316
|
-
* @param label Human-readable label
|
|
317
|
-
* @returns Promise that resolves when label is set
|
|
318
|
-
*/
|
|
319
|
-
setAddressLabel(address: string, label: string): Promise<void>;
|
|
320
|
-
/**
|
|
321
|
-
* @notice Export address book
|
|
322
|
-
* @returns Promise resolving to AddressBook
|
|
323
|
-
*/
|
|
324
|
-
exportAddressBook(): Promise<AddressBook>;
|
|
325
|
-
/**
|
|
326
|
-
* @notice Import address book (for recovery)
|
|
327
|
-
* @param addressBook AddressBook to import
|
|
328
|
-
* @returns Promise that resolves when import is complete
|
|
329
|
-
*/
|
|
330
|
-
importAddressBook(addressBook: AddressBook): Promise<void>;
|
|
331
|
-
/**
|
|
332
|
-
* @notice Verify ownership of an address
|
|
333
|
-
* @param address Address to verify
|
|
334
|
-
* @returns Promise resolving to boolean (true if owned)
|
|
335
|
-
*/
|
|
336
|
-
ownsAddress(address: string): Promise<boolean>;
|
|
337
|
-
/**
|
|
338
|
-
* @notice Get the master public key (xpub)
|
|
339
|
-
* @returns Promise resolving to extended public key string
|
|
340
|
-
*/
|
|
341
|
-
getMasterPublicKey(): Promise<string>;
|
|
342
|
-
/**
|
|
343
|
-
* @notice Clear all cached keys and addresses
|
|
344
|
-
* @dev Use with caution - requires re-initialization
|
|
345
|
-
* @returns Promise that resolves when cache is cleared
|
|
346
|
-
*/
|
|
347
|
-
clearCache(): Promise<void>;
|
|
348
|
-
/**
|
|
349
|
-
* @notice Set RPC provider URL for network operations
|
|
350
|
-
* @param rpcUrl The RPC endpoint URL
|
|
351
|
-
* @returns Promise that resolves when provider is configured
|
|
352
|
-
*/
|
|
353
|
-
setRpcUrl(rpcUrl: string): Promise<void>;
|
|
354
|
-
/**
|
|
355
|
-
* @notice Get current RPC provider
|
|
356
|
-
* @returns RPC provider instance or null
|
|
357
|
-
*/
|
|
358
|
-
getProvider(): any;
|
|
359
|
-
/**
|
|
360
|
-
* @notice Get signer connected to provider
|
|
361
|
-
* @returns Signer instance for transactions
|
|
362
|
-
*/
|
|
363
|
-
getSigner(): any;
|
|
364
|
-
/**
|
|
365
|
-
* @notice Set custom signer
|
|
366
|
-
* @param signer Custom wallet to use as signer
|
|
367
|
-
* @returns Promise that resolves when signer is set
|
|
368
|
-
*/
|
|
369
|
-
setSigner(signer: any): Promise<void>;
|
|
370
|
-
/**
|
|
371
|
-
* @notice Create a new wallet with auto-incremented index
|
|
372
|
-
* @returns Promise resolving to WalletInfo with ready-to-use wallet object
|
|
373
|
-
*/
|
|
374
|
-
createWallet(): Promise<WalletInfo>;
|
|
375
|
-
/**
|
|
376
|
-
* @notice Load all wallets from stored paths
|
|
377
|
-
* @returns Promise resolving to array of WalletInfo objects
|
|
378
|
-
*/
|
|
379
|
-
loadWallets(): Promise<WalletInfo[]>;
|
|
380
|
-
/**
|
|
381
|
-
* @notice Get main wallet derived from Gun user keys
|
|
382
|
-
* @dev This is different from BIP-44 derivation - uses Gun SEA keys directly
|
|
383
|
-
* @returns Main wallet instance
|
|
384
|
-
*/
|
|
385
|
-
getMainWallet(): any;
|
|
386
|
-
/**
|
|
387
|
-
* @notice Get main wallet credentials (address + private key)
|
|
388
|
-
* @returns Object with address and private key
|
|
389
|
-
*/
|
|
390
|
-
getMainWalletCredentials(): {
|
|
391
|
-
address: string;
|
|
392
|
-
priv: string;
|
|
393
|
-
};
|
|
394
|
-
/**
|
|
395
|
-
* @notice Export wallet keys for all derived addresses
|
|
396
|
-
* @returns Promise resolving to JSON string with all wallet keys
|
|
397
|
-
*/
|
|
398
|
-
exportWalletKeys(): Promise<string>;
|
|
399
|
-
/**
|
|
400
|
-
* @notice Export Gun SEA keypair
|
|
401
|
-
* @returns Promise resolving to JSON string with Gun pair
|
|
402
|
-
*/
|
|
403
|
-
exportGunPair(): Promise<string>;
|
|
404
|
-
/**
|
|
405
|
-
* @notice Export all user data (mnemonic, wallets, Gun pair)
|
|
406
|
-
* @returns Promise resolving to encrypted backup string
|
|
407
|
-
*/
|
|
408
|
-
exportAllUserData(): Promise<string>;
|
|
409
|
-
/**
|
|
410
|
-
* @notice Import wallet keys and restore multiple wallets
|
|
411
|
-
* @param walletsData JSON string with wallet keys
|
|
412
|
-
* @returns Promise resolving to number of wallets imported
|
|
413
|
-
*/
|
|
414
|
-
importWalletKeys(walletsData: string): Promise<number>;
|
|
415
|
-
/**
|
|
416
|
-
* @notice Import Gun SEA keypair
|
|
417
|
-
* @param pairData JSON string with Gun pair
|
|
418
|
-
* @returns Promise resolving to boolean success status
|
|
419
|
-
*/
|
|
420
|
-
importGunPair(pairData: string): Promise<boolean>;
|
|
421
|
-
/**
|
|
422
|
-
* @notice Import all user data from backup
|
|
423
|
-
* @param backupData Encrypted backup string
|
|
424
|
-
* @param options Import options (which data to import)
|
|
425
|
-
* @returns Promise resolving to import results
|
|
426
|
-
*/
|
|
427
|
-
importAllUserData(backupData: string, options?: {
|
|
428
|
-
importMnemonic?: boolean;
|
|
429
|
-
importWallets?: boolean;
|
|
430
|
-
importGunPair?: boolean;
|
|
431
|
-
}): Promise<{
|
|
432
|
-
success: boolean;
|
|
433
|
-
mnemonicImported?: boolean;
|
|
434
|
-
walletsImported?: number;
|
|
435
|
-
gunPairImported?: boolean;
|
|
436
|
-
}>;
|
|
437
|
-
/**
|
|
438
|
-
* @notice Initialize wallet paths from Gun storage
|
|
439
|
-
* @returns Promise that resolves when paths are loaded
|
|
440
|
-
*/
|
|
441
|
-
initializeWalletPaths(): Promise<void>;
|
|
442
|
-
/**
|
|
443
|
-
* @notice Save wallet paths to localStorage backup
|
|
444
|
-
* @returns Promise that resolves when saved
|
|
445
|
-
*/
|
|
446
|
-
saveWalletPathsToLocalStorage(): Promise<void>;
|
|
447
|
-
/**
|
|
448
|
-
* @notice Load wallet paths from localStorage
|
|
449
|
-
* @returns Promise that resolves when loaded
|
|
450
|
-
*/
|
|
451
|
-
loadWalletPathsFromLocalStorage(): Promise<void>;
|
|
452
|
-
/**
|
|
453
|
-
* @notice Initialize wallet paths and test encryption system
|
|
454
|
-
* @dev Convenience method that combines initialization and testing
|
|
455
|
-
* @returns Promise that resolves when initialization and testing complete
|
|
456
|
-
*/
|
|
457
|
-
initializeWalletPathsAndTestEncryption(): Promise<void>;
|
|
458
|
-
/**
|
|
459
|
-
* @notice Cleanup resources and timers
|
|
460
|
-
* @dev Call before destroying instance
|
|
461
|
-
* @returns Promise that resolves when cleanup is complete
|
|
462
|
-
*/
|
|
463
|
-
cleanup(): Promise<void>;
|
|
464
|
-
}
|
|
465
|
-
export type SHIP_02_Events = {
|
|
466
|
-
addressDerived: (result: DerivationResult) => void;
|
|
467
|
-
stealthGenerated: (result: StealthAddressResult) => void;
|
|
468
|
-
transactionSigned: (result: SignatureResult) => void;
|
|
469
|
-
error: (error: Error) => void;
|
|
470
|
-
};
|