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,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
|
-
};
|