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,234 +0,0 @@
1
- /**
2
- * SHIP-05: Decentralized File Storage Interface
3
- *
4
- * @title ISHIP_05 - IPFS Storage with Relay Network
5
- * @notice Interface for decentralized file storage with encryption
6
- *
7
- * ## Abstract
8
- *
9
- * This standard extends SHIP-00 to enable:
10
- * - Encrypted file storage on IPFS
11
- * - Relay network management for storage providers
12
- * - On-chain subscription system for storage
13
- * - Deterministic encryption from wallet signatures
14
- * - File sharing with access control
15
- *
16
- * ## Specification
17
- *
18
- * Based on:
19
- * - SHIP-00 for identity foundation
20
- * - IPFS for decentralized storage
21
- * - Smart contracts for relay payment system
22
- * - Deterministic encryption from wallet signatures
23
- *
24
- * ## Dependencies
25
- *
26
- * - SHIP-00: Identity and authentication foundation
27
- * - IPFS: Decentralized file storage
28
- * - Ethereum: For relay subscription payments
29
- * - shogun-ipfs: IPFS wrapper library
30
- *
31
- * ## Usage
32
- *
33
- * ```typescript
34
- * const identity = new SHIP_00({ gunOptions: { peers: ['...'] } });
35
- * await identity.login('alice', 'password123');
36
- *
37
- * const storage = new SHIP_05(identity);
38
- * await storage.initialize();
39
- *
40
- * // Upload encrypted file
41
- * const result = await storage.uploadFile(file, { encrypt: true });
42
- *
43
- * // Download and decrypt
44
- * const data = await storage.downloadFile(result.hash, { decrypt: true });
45
- * ```
46
- */
47
- import type { ISHIP_00 } from "./ISHIP_00";
48
- /**
49
- * @notice File upload result
50
- */
51
- export interface UploadResult {
52
- success: boolean;
53
- hash?: string;
54
- size?: number;
55
- encrypted?: boolean;
56
- error?: string;
57
- }
58
- /**
59
- * @notice File metadata
60
- */
61
- export interface FileMetadata {
62
- id: string;
63
- name: string;
64
- hash: string;
65
- sizeMB: number;
66
- uploadedAt: number;
67
- encrypted: boolean;
68
- type?: string;
69
- owner?: string;
70
- }
71
- /**
72
- * @notice Upload options
73
- */
74
- export interface UploadOptions {
75
- encrypt?: boolean;
76
- pin?: boolean;
77
- metadata?: Record<string, any>;
78
- }
79
- /**
80
- * @notice Download options
81
- */
82
- export interface DownloadOptions {
83
- decrypt?: boolean;
84
- returnBlob?: boolean;
85
- }
86
- /**
87
- * @notice Encryption options for SEA
88
- */
89
- export interface EncryptionOptions {
90
- useUserPair?: boolean;
91
- }
92
- /**
93
- * @title ISHIP_05 - Decentralized File Storage
94
- * @notice Main interface for IPFS file storage with encryption
95
- */
96
- export interface ISHIP_05 {
97
- /**
98
- * @notice Initialize the storage system
99
- * @dev Must be called after SHIP-00 authentication
100
- * @param options Configuration options
101
- * @returns Promise that resolves when initialization is complete
102
- */
103
- initialize(options?: SHIP_05_Config): Promise<void>;
104
- /**
105
- * @notice Check if system is initialized
106
- * @returns True if initialized
107
- */
108
- isInitialized(): boolean;
109
- /**
110
- * @notice Get the underlying SHIP-00 identity provider
111
- * @returns SHIP-00 instance
112
- */
113
- getIdentity(): ISHIP_00;
114
- /**
115
- * @notice Upload file to IPFS
116
- * @dev Optionally encrypts file with deterministic key from wallet signature
117
- * @param file File to upload (File or Buffer)
118
- * @param options Upload options
119
- * @returns Promise resolving to upload result with IPFS hash
120
- *
121
- * Process:
122
- * 1. If encrypt=true, get wallet signature and generate key
123
- * 2. Upload to IPFS
124
- * 3. Record file metadata on GunDB
125
- */
126
- uploadFile(file: File | Buffer, options?: UploadOptions): Promise<UploadResult>;
127
- /**
128
- * @notice Upload JSON data to IPFS
129
- * @param data JSON object to upload
130
- * @param options Upload options
131
- * @returns Promise resolving to upload result
132
- */
133
- uploadJson(data: any, options?: UploadOptions): Promise<UploadResult>;
134
- /**
135
- * @notice Download file from IPFS
136
- * @dev Automatically decrypts if file was encrypted by user
137
- * @param hash IPFS hash to download
138
- * @param options Download options
139
- * @returns Promise resolving to file data
140
- */
141
- downloadFile(hash: string, options?: DownloadOptions): Promise<string | Blob>;
142
- /**
143
- * @notice Get file metadata
144
- * @param hash IPFS hash
145
- * @returns Promise resolving to file metadata or null
146
- */
147
- getFileMetadata(hash: string): Promise<FileMetadata | null>;
148
- /**
149
- * @notice Delete file from IPFS
150
- * @dev Removes file and updates MB usage
151
- * @param hash IPFS hash to delete
152
- * @returns Promise resolving to deletion result
153
- */
154
- deleteFile(hash: string): Promise<{
155
- success: boolean;
156
- error?: string;
157
- }>;
158
- /**
159
- * @notice Get all files uploaded by user
160
- * @returns Promise resolving to array of file metadata
161
- */
162
- getUserFiles(): Promise<FileMetadata[]>;
163
- /**
164
- * @notice Encrypt data using SEA (from SHIP-00)
165
- * @dev Uses user's SEA keypair for encryption
166
- * @param data Data to encrypt (string or Buffer)
167
- * @param options Encryption options
168
- * @returns Promise resolving to encrypted data
169
- *
170
- * Process:
171
- * 1. Get SEA pair from SHIP-00 identity
172
- * 2. Use SEA.encrypt(data, pair) for symmetric encryption
173
- * 3. Return encrypted string
174
- */
175
- encryptData(data: string | Buffer, options?: EncryptionOptions): Promise<string>;
176
- /**
177
- * @notice Decrypt data using SEA (from SHIP-00)
178
- * @dev Uses user's SEA keypair for decryption
179
- * @param encryptedData Encrypted data
180
- * @param options Encryption options
181
- * @returns Promise resolving to decrypted data
182
- */
183
- decryptData(encryptedData: string, options?: EncryptionOptions): Promise<string>;
184
- /**
185
- * @notice Check if file is accessible
186
- * @param hash IPFS hash
187
- * @returns Promise resolving to boolean
188
- */
189
- isFileAccessible(hash: string): Promise<boolean>;
190
- /**
191
- * @notice Get storage usage statistics
192
- * @returns Promise resolving to usage stats
193
- */
194
- getStorageStats(): Promise<{
195
- totalFiles: number;
196
- totalMB: number;
197
- encryptedFiles: number;
198
- plainFiles: number;
199
- }>;
200
- }
201
- /**
202
- * @notice SHIP-05 Configuration
203
- */
204
- export interface SHIP_05_Config {
205
- /** IPFS service configuration */
206
- ipfsService?: "PINATA" | "IPFS-CLIENT" | "CUSTOM";
207
- /** IPFS service config */
208
- ipfsConfig?: {
209
- pinataJwt?: string;
210
- pinataGateway?: string;
211
- url?: string;
212
- customApiUrl?: string;
213
- customToken?: string;
214
- };
215
- /** Max file size in MB */
216
- maxFileSizeMB?: number;
217
- }
218
- export declare enum SHIP_05_EventType {
219
- FILE_UPLOADED = "fileUploaded",
220
- FILE_DOWNLOADED = "fileDownloaded",
221
- FILE_DELETED = "fileDeleted",
222
- ERROR = "error"
223
- }
224
- export interface SHIP_05_Event {
225
- type: SHIP_05_EventType;
226
- data?: any;
227
- timestamp: number;
228
- }
229
- export type SHIP_05_Events = {
230
- fileUploaded: (result: UploadResult) => void;
231
- fileDownloaded: (hash: string) => void;
232
- fileDeleted: (hash: string) => void;
233
- error: (error: Error) => void;
234
- };