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.
Files changed (149) hide show
  1. package/dist/browser/shogun-core.js +79919 -190726
  2. package/dist/browser/shogun-core.js.map +1 -1
  3. package/dist/{src/index.js → index.js} +0 -1
  4. package/dist/{src/managers → managers}/CoreInitializer.js +0 -6
  5. package/dist/{src/storage → storage}/storage.js +0 -16
  6. package/dist/types/{src/index.d.ts → index.d.ts} +0 -1
  7. package/package.json +10 -26
  8. package/dist/browser/defaultVendors-node_modules_shogun-ipfs_node_modules_axios_index_js.shogun-core.js +0 -4078
  9. package/dist/browser/defaultVendors-node_modules_shogun-ipfs_node_modules_axios_index_js.shogun-core.js.map +0 -1
  10. package/dist/browser/defaultVendors-node_modules_shogun-ipfs_node_modules_is-ipfs_dist_src_index_js.shogun-core.js +0 -4908
  11. package/dist/browser/defaultVendors-node_modules_shogun-ipfs_node_modules_is-ipfs_dist_src_index_js.shogun-core.js.map +0 -1
  12. package/dist/browser/defaultVendors-node_modules_shogun-ipfs_node_modules_uint8-varint_dist_src_index_js-node_modu-0db5ba.shogun-core.js +0 -2109
  13. 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
  14. package/dist/ship/examples/identity-cli.js +0 -511
  15. package/dist/ship/examples/messenger-cli.js +0 -745
  16. package/dist/ship/examples/stealth-cli.js +0 -433
  17. package/dist/ship/examples/storage-cli.js +0 -615
  18. package/dist/ship/examples/vault-cli.js +0 -444
  19. package/dist/ship/examples/wallet-cli.js +0 -767
  20. package/dist/ship/implementation/SHIP_00.js +0 -478
  21. package/dist/ship/implementation/SHIP_01.js +0 -433
  22. package/dist/ship/implementation/SHIP_02.js +0 -1366
  23. package/dist/ship/implementation/SHIP_03.js +0 -855
  24. package/dist/ship/implementation/SHIP_04.js +0 -589
  25. package/dist/ship/implementation/SHIP_05.js +0 -1064
  26. package/dist/ship/implementation/SHIP_06.js +0 -635
  27. package/dist/ship/index.js +0 -17
  28. package/dist/ship/interfaces/ISHIP_00.js +0 -135
  29. package/dist/ship/interfaces/ISHIP_01.js +0 -128
  30. package/dist/ship/interfaces/ISHIP_02.js +0 -57
  31. package/dist/ship/interfaces/ISHIP_03.js +0 -61
  32. package/dist/ship/interfaces/ISHIP_04.js +0 -62
  33. package/dist/ship/interfaces/ISHIP_05.js +0 -59
  34. package/dist/ship/interfaces/ISHIP_06.js +0 -194
  35. package/dist/types/ship/examples/identity-cli.d.ts +0 -40
  36. package/dist/types/ship/examples/messenger-cli.d.ts +0 -37
  37. package/dist/types/ship/examples/stealth-cli.d.ts +0 -31
  38. package/dist/types/ship/examples/storage-cli.d.ts +0 -48
  39. package/dist/types/ship/examples/vault-cli.d.ts +0 -13
  40. package/dist/types/ship/examples/wallet-cli.d.ts +0 -131
  41. package/dist/types/ship/implementation/SHIP_00.d.ts +0 -113
  42. package/dist/types/ship/implementation/SHIP_01.d.ts +0 -80
  43. package/dist/types/ship/implementation/SHIP_02.d.ts +0 -297
  44. package/dist/types/ship/implementation/SHIP_03.d.ts +0 -127
  45. package/dist/types/ship/implementation/SHIP_04.d.ts +0 -76
  46. package/dist/types/ship/implementation/SHIP_05.d.ts +0 -70
  47. package/dist/types/ship/implementation/SHIP_06.d.ts +0 -101
  48. package/dist/types/ship/index.d.ts +0 -14
  49. package/dist/types/ship/interfaces/ISHIP_00.d.ts +0 -410
  50. package/dist/types/ship/interfaces/ISHIP_01.d.ts +0 -343
  51. package/dist/types/ship/interfaces/ISHIP_02.d.ts +0 -470
  52. package/dist/types/ship/interfaces/ISHIP_03.d.ts +0 -295
  53. package/dist/types/ship/interfaces/ISHIP_04.d.ts +0 -245
  54. package/dist/types/ship/interfaces/ISHIP_05.d.ts +0 -234
  55. package/dist/types/ship/interfaces/ISHIP_06.d.ts +0 -522
  56. /package/dist/{src/config → config}/simplified-config.js +0 -0
  57. /package/dist/{src/core.js → core.js} +0 -0
  58. /package/dist/{src/examples → examples}/api-test.js +0 -0
  59. /package/dist/{src/examples → examples}/simple-api-test.js +0 -0
  60. /package/dist/{src/gundb → gundb}/api.js +0 -0
  61. /package/dist/{src/gundb → gundb}/crypto.js +0 -0
  62. /package/dist/{src/gundb → gundb}/db.js +0 -0
  63. /package/dist/{src/gundb → gundb}/derive.js +0 -0
  64. /package/dist/{src/gundb → gundb}/errors.js +0 -0
  65. /package/dist/{src/gundb → gundb}/index.js +0 -0
  66. /package/dist/{src/gundb → gundb}/rxjs.js +0 -0
  67. /package/dist/{src/gundb → gundb}/types.js +0 -0
  68. /package/dist/{src/interfaces → interfaces}/common.js +0 -0
  69. /package/dist/{src/interfaces → interfaces}/events.js +0 -0
  70. /package/dist/{src/interfaces → interfaces}/plugin.js +0 -0
  71. /package/dist/{src/interfaces → interfaces}/shogun.js +0 -0
  72. /package/dist/{src/managers → managers}/AuthManager.js +0 -0
  73. /package/dist/{src/managers → managers}/EventManager.js +0 -0
  74. /package/dist/{src/managers → managers}/PluginManager.js +0 -0
  75. /package/dist/{src/migration-test.js → migration-test.js} +0 -0
  76. /package/dist/{src/plugins → plugins}/base.js +0 -0
  77. /package/dist/{src/plugins → plugins}/index.js +0 -0
  78. /package/dist/{src/plugins → plugins}/nostr/index.js +0 -0
  79. /package/dist/{src/plugins → plugins}/nostr/nostrConnector.js +0 -0
  80. /package/dist/{src/plugins → plugins}/nostr/nostrConnectorPlugin.js +0 -0
  81. /package/dist/{src/plugins → plugins}/nostr/nostrSigner.js +0 -0
  82. /package/dist/{src/plugins → plugins}/nostr/types.js +0 -0
  83. /package/dist/{src/plugins → plugins}/oauth/index.js +0 -0
  84. /package/dist/{src/plugins → plugins}/oauth/oauthConnector.js +0 -0
  85. /package/dist/{src/plugins → plugins}/oauth/oauthPlugin.js +0 -0
  86. /package/dist/{src/plugins → plugins}/oauth/types.js +0 -0
  87. /package/dist/{src/plugins → plugins}/web3/index.js +0 -0
  88. /package/dist/{src/plugins → plugins}/web3/types.js +0 -0
  89. /package/dist/{src/plugins → plugins}/web3/web3Connector.js +0 -0
  90. /package/dist/{src/plugins → plugins}/web3/web3ConnectorPlugin.js +0 -0
  91. /package/dist/{src/plugins → plugins}/web3/web3Signer.js +0 -0
  92. /package/dist/{src/plugins → plugins}/webauthn/index.js +0 -0
  93. /package/dist/{src/plugins → plugins}/webauthn/types.js +0 -0
  94. /package/dist/{src/plugins → plugins}/webauthn/webauthn.js +0 -0
  95. /package/dist/{src/plugins → plugins}/webauthn/webauthnPlugin.js +0 -0
  96. /package/dist/{src/plugins → plugins}/webauthn/webauthnSigner.js +0 -0
  97. /package/dist/types/{src/config → config}/simplified-config.d.ts +0 -0
  98. /package/dist/types/{src/core.d.ts → core.d.ts} +0 -0
  99. /package/dist/{src/types → types}/events.js +0 -0
  100. /package/dist/types/{src/examples → examples}/api-test.d.ts +0 -0
  101. /package/dist/types/{src/examples → examples}/simple-api-test.d.ts +0 -0
  102. /package/dist/types/{src/gundb → gundb}/api.d.ts +0 -0
  103. /package/dist/types/{src/gundb → gundb}/crypto.d.ts +0 -0
  104. /package/dist/types/{src/gundb → gundb}/db.d.ts +0 -0
  105. /package/dist/types/{src/gundb → gundb}/derive.d.ts +0 -0
  106. /package/dist/types/{src/gundb → gundb}/errors.d.ts +0 -0
  107. /package/dist/types/{src/gundb → gundb}/index.d.ts +0 -0
  108. /package/dist/types/{src/gundb → gundb}/rxjs.d.ts +0 -0
  109. /package/dist/types/{src/gundb → gundb}/types.d.ts +0 -0
  110. /package/dist/types/{src/interfaces → interfaces}/common.d.ts +0 -0
  111. /package/dist/types/{src/interfaces → interfaces}/events.d.ts +0 -0
  112. /package/dist/types/{src/interfaces → interfaces}/plugin.d.ts +0 -0
  113. /package/dist/types/{src/interfaces → interfaces}/shogun.d.ts +0 -0
  114. /package/dist/types/{src/managers → managers}/AuthManager.d.ts +0 -0
  115. /package/dist/types/{src/managers → managers}/CoreInitializer.d.ts +0 -0
  116. /package/dist/types/{src/managers → managers}/EventManager.d.ts +0 -0
  117. /package/dist/types/{src/managers → managers}/PluginManager.d.ts +0 -0
  118. /package/dist/types/{src/migration-test.d.ts → migration-test.d.ts} +0 -0
  119. /package/dist/types/{src/plugins → plugins}/base.d.ts +0 -0
  120. /package/dist/types/{src/plugins → plugins}/index.d.ts +0 -0
  121. /package/dist/types/{src/plugins → plugins}/nostr/index.d.ts +0 -0
  122. /package/dist/types/{src/plugins → plugins}/nostr/nostrConnector.d.ts +0 -0
  123. /package/dist/types/{src/plugins → plugins}/nostr/nostrConnectorPlugin.d.ts +0 -0
  124. /package/dist/types/{src/plugins → plugins}/nostr/nostrSigner.d.ts +0 -0
  125. /package/dist/types/{src/plugins → plugins}/nostr/types.d.ts +0 -0
  126. /package/dist/types/{src/plugins → plugins}/oauth/index.d.ts +0 -0
  127. /package/dist/types/{src/plugins → plugins}/oauth/oauthConnector.d.ts +0 -0
  128. /package/dist/types/{src/plugins → plugins}/oauth/oauthPlugin.d.ts +0 -0
  129. /package/dist/types/{src/plugins → plugins}/oauth/types.d.ts +0 -0
  130. /package/dist/types/{src/plugins → plugins}/web3/index.d.ts +0 -0
  131. /package/dist/types/{src/plugins → plugins}/web3/types.d.ts +0 -0
  132. /package/dist/types/{src/plugins → plugins}/web3/web3Connector.d.ts +0 -0
  133. /package/dist/types/{src/plugins → plugins}/web3/web3ConnectorPlugin.d.ts +0 -0
  134. /package/dist/types/{src/plugins → plugins}/web3/web3Signer.d.ts +0 -0
  135. /package/dist/types/{src/plugins → plugins}/webauthn/index.d.ts +0 -0
  136. /package/dist/types/{src/plugins → plugins}/webauthn/types.d.ts +0 -0
  137. /package/dist/types/{src/plugins → plugins}/webauthn/webauthn.d.ts +0 -0
  138. /package/dist/types/{src/plugins → plugins}/webauthn/webauthnPlugin.d.ts +0 -0
  139. /package/dist/types/{src/plugins → plugins}/webauthn/webauthnSigner.d.ts +0 -0
  140. /package/dist/{src/types → types}/shogun.js +0 -0
  141. /package/dist/types/{src/storage → storage}/storage.d.ts +0 -0
  142. /package/dist/types/{src/types → types}/events.d.ts +0 -0
  143. /package/dist/types/{src/types → types}/shogun.d.ts +0 -0
  144. /package/dist/types/{src/utils → utils}/errorHandler.d.ts +0 -0
  145. /package/dist/types/{src/utils → utils}/eventEmitter.d.ts +0 -0
  146. /package/dist/types/{src/utils → utils}/validation.d.ts +0 -0
  147. /package/dist/{src/utils → utils}/errorHandler.js +0 -0
  148. /package/dist/{src/utils → utils}/eventEmitter.js +0 -0
  149. /package/dist/{src/utils → utils}/validation.js +0 -0
@@ -1,297 +0,0 @@
1
- /**
2
- * SHIP-02: Ethereum HD Wallet Implementation
3
- *
4
- * Full port of shogun-BIP44 with SHIP-00 derivation.
5
- * Extends SHIP-00 to provide deterministic Ethereum address derivation.
6
- *
7
- * Based on:
8
- * - SHIP-00 for identity foundation (replaces mnemonic dependency)
9
- * - BIP-32 for hierarchical deterministic wallets
10
- * - BIP-44 for multi-account hierarchy
11
- * - Ethers.js for Ethereum operations
12
- * - Gun/SEA for encrypted storage
13
- *
14
- * Features:
15
- * ✅ Deterministic address derivation from SHIP-00 identity (no mnemonics needed)
16
- * ✅ BIP-44 compliant HD wallet support
17
- * ✅ Multiple address management
18
- * ✅ Transaction signing
19
- * ✅ Message signing and verification
20
- * ✅ Gun persistence with encryption
21
- * ✅ Export/import functionality
22
- * ✅ Address book management
23
- *
24
- * Note: Stealth addresses moved to SHIP-03
25
- */
26
- import type { ISHIP_00 } from "../interfaces/ISHIP_00";
27
- import type { ISHIP_02, DerivationResult, StealthAddressResult, SignatureResult, Transaction, AddressEntry, AddressBook, SHIP_02_Config, WalletInfo } from "../interfaces/ISHIP_02";
28
- import { ethers } from "ethers";
29
- /**
30
- * SHIP-02 Reference Implementation
31
- *
32
- * Provides Ethereum address derivation on top of SHIP-00 identity.
33
- * All addresses are deterministically derived from the user's SHIP-00 keypair.
34
- */
35
- declare class SHIP_02 implements ISHIP_02 {
36
- private identity;
37
- private config;
38
- private initialized;
39
- static readonly NODES: {
40
- readonly ADDRESS_BOOK: "addressbook";
41
- readonly MNEMONIC: "mnemonic";
42
- readonly WALLET_PATHS: "wallet_paths";
43
- };
44
- private masterSeed;
45
- private mnemonic;
46
- private hdWallet;
47
- private addressCache;
48
- private walletCache;
49
- private nextIndex;
50
- private persistToGun;
51
- private provider;
52
- private mainWallet;
53
- private walletPaths;
54
- constructor(identity: ISHIP_00, config?: SHIP_02_Config);
55
- initialize(useMnemonic?: boolean): Promise<void>;
56
- isInitialized(): boolean;
57
- deriveEthereumAddress(path?: string): Promise<DerivationResult>;
58
- deriveMultipleAddresses(count: number, startIndex?: number): Promise<DerivationResult[]>;
59
- getPrimaryAddress(): Promise<string>;
60
- deriveBIP44Address(coinType?: number, account?: number, change?: number, index?: number): Promise<DerivationResult>;
61
- deriveMultipleAccounts(accountCount: number): Promise<DerivationResult[]>;
62
- /**
63
- * @deprecated Use SHIP-03 for dual-key stealth addresses
64
- */
65
- generateStealthAddress(recipientPublicKey?: string): Promise<StealthAddressResult>;
66
- /**
67
- * @deprecated Use SHIP-03 for stealth operations
68
- */
69
- deriveSharedSecret(publicKey: string): Promise<string>;
70
- /**
71
- * @deprecated Use SHIP-03 for stealth operations
72
- */
73
- isStealthAddress(address: string): Promise<boolean>;
74
- getPrivateKeyForAddress(address: string): Promise<string>;
75
- getPublicKeyForAddress(address: string): Promise<string>;
76
- getPathForAddress(address: string): Promise<string | undefined>;
77
- signTransaction(tx: Transaction, address: string): Promise<SignatureResult>;
78
- /**
79
- * Send transaction to Ethereum network
80
- * Combines signing + broadcasting in one step
81
- */
82
- sendTransaction(tx: Transaction, address: string, waitForConfirmation?: boolean): Promise<{
83
- success: boolean;
84
- txHash?: string;
85
- receipt?: ethers.TransactionReceipt;
86
- error?: string;
87
- }>;
88
- signMessage(message: string | Uint8Array, address: string): Promise<string>;
89
- verifySignature(message: string | Uint8Array, signature: string, address: string): Promise<boolean>;
90
- getAllAddresses(): Promise<AddressEntry[]>;
91
- getAddressByIndex(index: number): Promise<AddressEntry | undefined>;
92
- setAddressLabel(address: string, label: string): Promise<void>;
93
- exportAddressBook(): Promise<AddressBook>;
94
- importAddressBook(addressBook: AddressBook): Promise<void>;
95
- /**
96
- * Enable persistence to Gun database
97
- */
98
- enableGunPersistence(): void;
99
- /**
100
- * Disable persistence to Gun database
101
- */
102
- disableGunPersistence(): void;
103
- /**
104
- * Save address book to Gun (private storage)
105
- */
106
- private saveAddressBookToGun;
107
- /**
108
- * Load address book from Gun
109
- */
110
- loadAddressBookFromGun(): Promise<AddressBook | null>;
111
- /**
112
- * Sync local cache with Gun storage
113
- */
114
- syncWithGun(): Promise<void>;
115
- ownsAddress(address: string): Promise<boolean>;
116
- getMasterPublicKey(): Promise<string>;
117
- clearCache(): Promise<void>;
118
- /**
119
- * Generate new BIP-39 mnemonic (12 words)
120
- * Compatible with MetaMask and other wallets
121
- */
122
- generateNewMnemonic(): string;
123
- /**
124
- * Get addresses that would be derived from a mnemonic (standard BIP-44)
125
- * Useful to verify compatibility with MetaMask
126
- */
127
- getStandardBIP44Addresses(mnemonic: string, count?: number): string[];
128
- /**
129
- * Get current mnemonic (if using mnemonic mode)
130
- */
131
- getMnemonic(): Promise<string | null>;
132
- /**
133
- * Get user's master mnemonic from Gun or localStorage
134
- * Used by createWallet/loadWallets for frontend compatibility
135
- */
136
- getUserMasterMnemonic(): Promise<string | null>;
137
- /**
138
- * Export mnemonic (encrypted)
139
- */
140
- exportMnemonic(): Promise<string | null>;
141
- /**
142
- * Import mnemonic and re-initialize wallet
143
- */
144
- importMnemonic(encryptedMnemonic: string): Promise<void>;
145
- /**
146
- * Save mnemonic to Gun (encrypted)
147
- */
148
- private saveMnemonicToGun;
149
- /**
150
- * Load mnemonic from Gun (encrypted)
151
- */
152
- private loadMnemonicFromGun;
153
- /**
154
- * Get storage identifier for current user
155
- */
156
- getStorageUserIdentifier(): string;
157
- /**
158
- * Encrypt sensitive data using SEA
159
- */
160
- encryptSensitiveData(text: string): Promise<string>;
161
- /**
162
- * Decrypt sensitive data using SEA
163
- */
164
- decryptSensitiveData(encryptedText: string): Promise<string | null>;
165
- /**
166
- * Export master seed (encrypted)
167
- * SECURITY: Handle with extreme care!
168
- */
169
- exportMasterSeed(): Promise<string>;
170
- /**
171
- * Export all wallet data (encrypted)
172
- */
173
- exportWalletData(): Promise<string>;
174
- /**
175
- * Import wallet data (encrypted)
176
- */
177
- importWalletData(encryptedData: string): Promise<void>;
178
- /**
179
- * Ensure system is initialized
180
- */
181
- private ensureInitialized;
182
- /**
183
- * Derive master seed from SHIP-00 keypair
184
- */
185
- private deriveMasterSeed;
186
- /**
187
- * Build BIP-44 derivation path
188
- */
189
- private buildBIP44Path;
190
- /**
191
- * Set RPC provider URL
192
- */
193
- setRpcUrl(rpcUrl: string): Promise<void>;
194
- /**
195
- * Get current RPC provider
196
- */
197
- getProvider(): ethers.JsonRpcProvider | null;
198
- /**
199
- * Get signer (main wallet connected to provider)
200
- */
201
- getSigner(): ethers.Wallet;
202
- /**
203
- * Set custom signer
204
- */
205
- setSigner(signer: ethers.Wallet): Promise<void>;
206
- /**
207
- * Get main wallet (derived from Gun user keys, not BIP-44)
208
- * This provides a consistent "main" wallet independent of HD derivation
209
- */
210
- getMainWallet(): ethers.Wallet;
211
- /**
212
- * Get main wallet credentials
213
- */
214
- getMainWalletCredentials(): {
215
- address: string;
216
- priv: string;
217
- };
218
- /**
219
- * Create new wallet with auto-incremented index
220
- * Frontend-friendly API that returns ready-to-use wallet object
221
- */
222
- createWallet(): Promise<WalletInfo>;
223
- /**
224
- * Load all wallets from stored paths
225
- * Reconstructs wallet objects from mnemonic/seed and paths
226
- */
227
- loadWallets(): Promise<WalletInfo[]>;
228
- /**
229
- * Export wallet keys for all derived addresses
230
- */
231
- exportWalletKeys(): Promise<string>;
232
- /**
233
- * Export Gun SEA keypair
234
- */
235
- exportGunPair(): Promise<string>;
236
- /**
237
- * Export all user data (mnemonic, wallets, Gun pair)
238
- */
239
- exportAllUserData(): Promise<string>;
240
- /**
241
- * Import wallet keys and restore wallets
242
- */
243
- importWalletKeys(walletsData: string): Promise<number>;
244
- /**
245
- * Import Gun SEA keypair
246
- * Note: This is a placeholder for compatibility
247
- * SHIP-02 doesn't manage Gun keys directly (use SHIP-00 for that)
248
- */
249
- importGunPair(pairData: string): Promise<boolean>;
250
- /**
251
- * Import all user data from backup
252
- */
253
- importAllUserData(backupData: string, options?: {
254
- importMnemonic?: boolean;
255
- importWallets?: boolean;
256
- importGunPair?: boolean;
257
- }): Promise<{
258
- success: boolean;
259
- mnemonicImported?: boolean;
260
- walletsImported?: number;
261
- gunPairImported?: boolean;
262
- }>;
263
- /**
264
- * Initialize wallet paths from Gun storage
265
- */
266
- initializeWalletPaths(): Promise<void>;
267
- /**
268
- * Save wallet paths to localStorage
269
- */
270
- saveWalletPathsToLocalStorage(): Promise<void>;
271
- /**
272
- * Load wallet paths from localStorage
273
- */
274
- loadWalletPathsFromLocalStorage(): Promise<void>;
275
- /**
276
- * Save wallet paths to Gun
277
- */
278
- private saveWalletPathsToGun;
279
- /**
280
- * Load wallet paths from Gun
281
- */
282
- private loadWalletPathsFromGun;
283
- /**
284
- * Generate deterministic private key from string seed
285
- * Uses same algorithm as shogun-BIP44 for compatibility
286
- */
287
- private generatePrivateKeyFromString;
288
- /**
289
- * Initialize wallet paths and test encryption system
290
- */
291
- initializeWalletPathsAndTestEncryption(): Promise<void>;
292
- /**
293
- * Cleanup resources
294
- */
295
- cleanup(): Promise<void>;
296
- }
297
- export { SHIP_02 };
@@ -1,127 +0,0 @@
1
- /**
2
- * SHIP-03: Dual-Key Stealth Address Implementation
3
- *
4
- * Full port of shogun-stealth-address with Fluidkey integration.
5
- * Extends SHIP-00 and SHIP-02 to provide ERC-5564 compatible stealth addresses.
6
- *
7
- * Based on:
8
- * - SHIP-00 for identity foundation
9
- * - SHIP-02 for Ethereum operations
10
- * - ERC-5564 for stealth address standard
11
- * - Fluidkey Stealth Account Kit
12
- * - @scure/bip32 for HD key derivation
13
- *
14
- * Features:
15
- * ✅ Dual-key stealth (viewing + spending keys)
16
- * ✅ ERC-5564 / Fluidkey compatible
17
- * ✅ Deterministic derivation from SHIP-00
18
- * ✅ View tag optimization for scanning
19
- * ✅ Announcement metadata
20
- * ✅ Batch generation
21
- * ✅ Fluidkey generateStealthAddresses
22
- * ✅ Fluidkey generateStealthPrivateKey
23
- */
24
- import type { ISHIP_00 } from "../interfaces/ISHIP_00";
25
- import type { ISHIP_02 } from "../interfaces/ISHIP_02";
26
- import type { ISHIP_03, StealthKeys, EphemeralKeyPair, StealthAddressResult, StealthMetadata, AnnouncedStealth, OwnedStealthAddress, SHIP_03_Config } from "../interfaces/ISHIP_03";
27
- /**
28
- * SHIP-03 Reference Implementation
29
- *
30
- * Full Fluidkey-compatible stealth address system derived from SHIP-00.
31
- * All keys are deterministically derived from the user's SHIP-00 identity.
32
- */
33
- declare class SHIP_03 implements ISHIP_03 {
34
- private identity;
35
- private eth;
36
- private config;
37
- private initialized;
38
- static readonly NODES: {
39
- readonly STEALTH_KEYS_PUBLIC: "stealth_keys_public";
40
- readonly STEALTH_ANNOUNCEMENTS: "stealth_announcements";
41
- };
42
- private viewingKey;
43
- private spendingKey;
44
- private ownedStealthAddresses;
45
- private announcementCache;
46
- constructor(identity: ISHIP_00, eth: ISHIP_02, config?: SHIP_03_Config);
47
- initialize(): Promise<void>;
48
- isInitialized(): boolean;
49
- getStealthKeys(): Promise<StealthKeys>;
50
- /**
51
- * Get public stealth keys by username (alias)
52
- * Resolves username → Gun pub → stealth keys
53
- */
54
- getPublicStealthKeysByUsername(username: string): Promise<{
55
- viewingPublicKey: string;
56
- spendingPublicKey: string;
57
- } | null>;
58
- /**
59
- * Get public stealth keys by Gun public key
60
- */
61
- getPublicStealthKeys(userPub: string): Promise<{
62
- viewingPublicKey: string;
63
- spendingPublicKey: string;
64
- } | null>;
65
- /**
66
- * Search stealth keys in directory (all published keys)
67
- * Returns list of users who have published stealth keys
68
- */
69
- searchStealthDirectory(): Promise<Array<{
70
- username?: string;
71
- gunPub: string;
72
- viewingPublicKey: string;
73
- spendingPublicKey: string;
74
- timestamp?: number;
75
- }>>;
76
- exportStealthKeys(): Promise<string>;
77
- importStealthKeys(encryptedKeys: string): Promise<void>;
78
- generateEphemeralKeyPair(): Promise<EphemeralKeyPair>;
79
- generateStealthAddress(recipientViewingKey: string, recipientSpendingKey: string, ephemeralPrivateKey?: string): Promise<StealthAddressResult>;
80
- generateMultipleStealthAddresses(recipients: Array<{
81
- viewingKey: string;
82
- spendingKey: string;
83
- }>, ephemeralPrivateKey?: string): Promise<StealthAddressResult[]>;
84
- openStealthAddress(stealthAddress: string, ephemeralPublicKey: string): Promise<any>;
85
- isStealthAddressMine(stealthAddress: string, ephemeralPublicKey: string): Promise<boolean>;
86
- getStealthPrivateKey(stealthAddress: string, ephemeralPublicKey: string): Promise<string>;
87
- scanStealthAddresses(announcements: AnnouncedStealth[]): Promise<OwnedStealthAddress[]>;
88
- quickScanWithViewTags(announcements: AnnouncedStealth[]): Promise<AnnouncedStealth[]>;
89
- createAnnouncementMetadata(stealthAddress: string, ephemeralPublicKey: string): StealthMetadata;
90
- parseAnnouncement(txData: any): Promise<AnnouncedStealth | null>;
91
- getAllOwnedStealthAddresses(): Promise<OwnedStealthAddress[]>;
92
- clearCache(): Promise<void>;
93
- verifyStealthAddress(stealthAddress: string, ephemeralPublicKey: string, spendingPublicKey: string): Promise<boolean>;
94
- /**
95
- * Ensure system is initialized
96
- */
97
- private ensureInitialized;
98
- /**
99
- * Derive stealth keys deterministically from SHIP-00 identity
100
- *
101
- * Uses simple deterministic derivation instead of Fluidkey's generateKeysFromSignature
102
- * because it requires specific EIP-712 signature format.
103
- *
104
- * We use Fluidkey only for:
105
- * - generateStealthAddresses (address generation)
106
- * - generateStealthPrivateKey (opening addresses)
107
- */
108
- private deriveStealthKeysFromIdentity;
109
- /**
110
- * Publish public stealth keys to Gun for others to use (PUBLIC METHOD)
111
- */
112
- publishStealthKeys(): Promise<void>;
113
- /**
114
- * Compute view tag for quick scanning
115
- */
116
- private computeViewTag;
117
- /**
118
- * Fallback method to open stealth address (manual ECDH computation)
119
- * Used when Fluidkey is not available or fails
120
- */
121
- private openStealthAddressFallback;
122
- /**
123
- * Add two private keys using modular arithmetic (secp256k1)
124
- */
125
- private addPrivateKeys;
126
- }
127
- export { SHIP_03 };
@@ -1,76 +0,0 @@
1
- /**
2
- * SHIP-04: Multi-Modal Authentication Implementation
3
- *
4
- * Extends SHIP-00 to provide alternative authentication methods.
5
- * Integrates existing Shogun Core plugins for OAuth, WebAuthn, Nostr, and Web3.
6
- *
7
- * Based on:
8
- * - SHIP-00 for identity foundation
9
- * - Shogun Core Plugins (OAuth, WebAuthn, Nostr, Web3)
10
- * - External OAuth providers (Google, GitHub, etc.)
11
- * - WebAuthn API for biometric auth
12
- * - Nostr protocol for decentralized social
13
- * - Web3 providers (MetaMask, WalletConnect)
14
- *
15
- * Features:
16
- * ✅ OAuth authentication (Google, GitHub, Discord, etc.)
17
- * ✅ WebAuthn/Passkeys (biometric, hardware keys)
18
- * ✅ Nostr protocol integration
19
- * ✅ Web3 wallet connection (MetaMask, etc.)
20
- * ✅ SHIP-00 compatible (all methods return SEA keypair)
21
- * ✅ Plugin-based architecture (modular)
22
- *
23
- * Inclusive Hierarchy:
24
- * SHIP-04 → depends on → SHIP-00 ✅
25
- */
26
- import type { ISHIP_00 } from "../interfaces/ISHIP_00";
27
- import type { ISHIP_04, OAuthProvider, OAuthAuthResult, WebAuthnAuthResult, NostrAuthResult, Web3AuthResult, AuthMethodInfo, SHIP_04_Config } from "../interfaces/ISHIP_04";
28
- import { AuthMethod } from "../interfaces/ISHIP_04";
29
- /**
30
- * SHIP-04 Reference Implementation
31
- *
32
- * Provides multiple authentication methods on top of SHIP-00.
33
- * All authentication methods are converted to SHIP-00 compatible format.
34
- */
35
- declare class SHIP_04 implements ISHIP_04 {
36
- private identity;
37
- private config;
38
- private initialized;
39
- static readonly NODES: {
40
- readonly AUTH_METHOD: "current_auth_method";
41
- };
42
- private oauthPlugin;
43
- private webauthnPlugin;
44
- private nostrPlugin;
45
- private web3Plugin;
46
- private currentAuthMethod;
47
- constructor(identity: ISHIP_00, config?: SHIP_04_Config);
48
- initialize(): Promise<void>;
49
- isInitialized(): boolean;
50
- getIdentity(): ISHIP_00;
51
- loginWithOAuth(provider: OAuthProvider, redirectUri?: string): Promise<OAuthAuthResult>;
52
- handleOAuthCallback(code: string, provider: OAuthProvider): Promise<OAuthAuthResult>;
53
- isOAuthAvailable(provider?: OAuthProvider): boolean;
54
- registerWithWebAuthn(username: string): Promise<WebAuthnAuthResult>;
55
- loginWithWebAuthn(username: string): Promise<WebAuthnAuthResult>;
56
- isWebAuthnAvailable(): boolean;
57
- connectNostr(): Promise<NostrAuthResult>;
58
- loginWithNostr(): Promise<NostrAuthResult>;
59
- isNostrAvailable(): boolean;
60
- connectWeb3(): Promise<Web3AuthResult>;
61
- loginWithWeb3(message?: string): Promise<Web3AuthResult>;
62
- isWeb3Available(): boolean;
63
- getAvailableAuthMethods(): AuthMethodInfo[];
64
- getCurrentAuthMethod(): AuthMethod | null;
65
- clearAuth(): Promise<void>;
66
- /**
67
- * Save current auth method to Gun (optional persistence)
68
- */
69
- private saveAuthMethod;
70
- /**
71
- * Load last used auth method from Gun
72
- */
73
- loadAuthMethod(): Promise<AuthMethod | null>;
74
- private ensureInitialized;
75
- }
76
- export { SHIP_04 };
@@ -1,70 +0,0 @@
1
- /**
2
- * SHIP-05: Decentralized File Storage Implementation
3
- *
4
- * Simple encrypted file storage on IPFS.
5
- * Extends SHIP-00 to provide encrypted file storage capabilities.
6
- *
7
- * Based on:
8
- * - SHIP-00 for identity foundation
9
- * - IPFS for decentralized file storage
10
- * - shogun-ipfs for IPFS operations
11
- * - Deterministic encryption from wallet signatures
12
- *
13
- * Features:
14
- * ✅ Encrypted file upload with wallet signature
15
- * ✅ Deterministic encryption keys from wallet
16
- * ✅ IPFS storage (Pinata, IPFS node, or custom)
17
- * ✅ File metadata on GunDB
18
- * ✅ File download and decryption
19
- */
20
- import type { ISHIP_00 } from "../interfaces/ISHIP_00";
21
- import type { ISHIP_05, UploadResult, FileMetadata, UploadOptions, DownloadOptions, EncryptionOptions, SHIP_05_Config } from "../interfaces/ISHIP_05";
22
- /**
23
- * SHIP-05 Reference Implementation
24
- *
25
- * Provides encrypted file storage on IPFS.
26
- * All encryption is deterministic based on wallet signatures.
27
- */
28
- declare class SHIP_05 implements ISHIP_05 {
29
- private identity;
30
- private config;
31
- private initialized;
32
- static readonly NODES: {
33
- readonly USER_FILES: "user_files";
34
- };
35
- private ipfsStorage;
36
- private fileCache;
37
- constructor(identity: ISHIP_00, config?: SHIP_05_Config);
38
- initialize(options?: SHIP_05_Config): Promise<void>;
39
- isInitialized(): boolean;
40
- getIdentity(): ISHIP_00;
41
- uploadFile(file: File | Buffer, options?: UploadOptions): Promise<UploadResult>;
42
- uploadJson(data: any, options?: UploadOptions): Promise<UploadResult>;
43
- downloadFile(hash: string, options?: DownloadOptions): Promise<string | Blob>;
44
- getFileMetadata(hash: string): Promise<FileMetadata | null>;
45
- deleteFile(hash: string): Promise<{
46
- success: boolean;
47
- error?: string;
48
- }>;
49
- getUserFiles(): Promise<FileMetadata[]>;
50
- encryptData(data: string | Buffer, options?: EncryptionOptions): Promise<string>;
51
- decryptData(encryptedData: string, options?: EncryptionOptions): Promise<string>;
52
- isFileAccessible(hash: string): Promise<boolean>;
53
- getStorageStats(): Promise<{
54
- totalFiles: number;
55
- totalMB: number;
56
- encryptedFiles: number;
57
- plainFiles: number;
58
- }>;
59
- private ensureInitialized;
60
- private initializeIPFS;
61
- private uploadToIPFS;
62
- private uploadToIPFSFallback;
63
- private unpinFromIPFS;
64
- private downloadFromIPFS;
65
- private saveFileMetadata;
66
- private removeFileMetadata;
67
- private getUserFilesFromGun;
68
- private fileToBase64;
69
- }
70
- export { SHIP_05 };
@@ -1,101 +0,0 @@
1
- /**
2
- * SHIP-06: Secure Vault Implementation
3
- *
4
- * Vault crittografato decentralizzato che dipende da SHIP-00 per l'identità.
5
- *
6
- * Dipendenze:
7
- * - SHIP-00 (Identity & Authentication) - per gestione utenti e chiavi
8
- * - GunDB - per storage decentralizzato P2P
9
- * - SEA - per crittografia AES-256-GCM
10
- *
11
- * Ispirato a: https://github.com/draeder/gunsafe
12
- */
13
- import type { ISHIP_00 } from "../interfaces/ISHIP_00";
14
- import type { ISHIP_06, VaultRecord, VaultResult, VaultStats, RecordMetadata, GetOptions, ListOptions, ImportOptions, ExportOptions } from "../interfaces/ISHIP_06";
15
- /**
16
- * SHIP-06 Reference Implementation
17
- *
18
- * Questa implementazione dipende da ISHIP_00 per tutte le operazioni di identità.
19
- * Si concentra esclusivamente sulla logica del vault crittografato.
20
- */
21
- declare class SHIP_06 implements ISHIP_06 {
22
- private identity;
23
- private initialized;
24
- private vaultNodeName;
25
- private vaultNode;
26
- private recordsNode;
27
- private metadataNode;
28
- private static readonly VAULT_VERSION;
29
- private static readonly DEFAULT_NODE_NAME;
30
- /**
31
- * Constructor
32
- * @param identity ISHIP_00 instance for identity operations
33
- * @param vaultNodeName Optional custom vault node name
34
- */
35
- constructor(identity: ISHIP_00, vaultNodeName?: string);
36
- /**
37
- * Get identity provider
38
- */
39
- getIdentity(): ISHIP_00;
40
- /**
41
- * Initialize vault
42
- */
43
- initialize(): Promise<void>;
44
- /**
45
- * Check if vault is initialized
46
- */
47
- isInitialized(): boolean;
48
- /**
49
- * Store encrypted record in vault
50
- */
51
- put(name: string, data: any, metadata?: RecordMetadata): Promise<VaultResult>;
52
- /**
53
- * Retrieve and decrypt record from vault
54
- */
55
- get(name: string, options?: GetOptions): Promise<VaultRecord | null>;
56
- /**
57
- * Delete record from vault (soft delete)
58
- */
59
- delete(name?: string): Promise<VaultResult>;
60
- /**
61
- * List all record names in vault
62
- */
63
- list(options?: ListOptions): Promise<string[]>;
64
- /**
65
- * Check if record exists
66
- */
67
- exists(name: string): Promise<boolean>;
68
- /**
69
- * Update existing record
70
- */
71
- update(name: string, data: any): Promise<VaultResult>;
72
- /**
73
- * Export entire vault (encrypted)
74
- */
75
- export(password?: string, options?: ExportOptions): Promise<string>;
76
- /**
77
- * Import vault from backup
78
- */
79
- import(backupData: string, password?: string, options?: ImportOptions): Promise<VaultResult>;
80
- /**
81
- * Get vault statistics
82
- */
83
- getStats(): Promise<VaultStats>;
84
- /**
85
- * Clear all records (soft delete all)
86
- */
87
- clear(): Promise<VaultResult>;
88
- /**
89
- * Compact vault (remove deleted records permanently)
90
- */
91
- compact(): Promise<VaultResult>;
92
- /**
93
- * Search records by content
94
- */
95
- search(query: string): Promise<string[]>;
96
- /**
97
- * Update record count in metadata
98
- */
99
- private updateRecordCount;
100
- }
101
- export { SHIP_06 };
@@ -1,14 +0,0 @@
1
- export { SHIP_00 } from "../ship/implementation/SHIP_00";
2
- export type { ISHIP_00 } from "../ship/interfaces/ISHIP_00";
3
- export { SHIP_01 } from "../ship/implementation/SHIP_01";
4
- export type { ISHIP_01 } from "../ship/interfaces/ISHIP_01";
5
- export { SHIP_02 } from "../ship/implementation/SHIP_02";
6
- export type { ISHIP_02 } from "../ship/interfaces/ISHIP_02";
7
- export { SHIP_03 } from "../ship/implementation/SHIP_03";
8
- export type { ISHIP_03 } from "../ship/interfaces/ISHIP_03";
9
- export { SHIP_04 } from "../ship/implementation/SHIP_04";
10
- export type { ISHIP_04 } from "../ship/interfaces/ISHIP_04";
11
- export { SHIP_05 } from "../ship/implementation/SHIP_05";
12
- export type { ISHIP_05 } from "../ship/interfaces/ISHIP_05";
13
- export { SHIP_06 } from "../ship/implementation/SHIP_06";
14
- export type { ISHIP_06 } from "../ship/interfaces/ISHIP_06";