gun-eth 2.0.0 → 3.0.0

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 (64) hide show
  1. package/README.md +386 -18
  2. package/dist/gun-eth.bundle.js +6806 -0
  3. package/dist/gun-eth.cjs +2465 -0
  4. package/dist/types/browser.d.ts +6 -0
  5. package/dist/types/config/local.d.ts +7 -0
  6. package/dist/types/constants/abis.d.ts +37 -0
  7. package/dist/types/constants/index.d.ts +1 -0
  8. package/dist/types/core/gun-eth.d.ts +419 -0
  9. package/dist/types/features/bubbles/client/bubble-client.d.ts +184 -0
  10. package/dist/types/features/bubbles/providers/base-bubble-provider.d.ts +303 -0
  11. package/dist/types/features/bubbles/providers/gun-bubble-provider.d.ts +173 -0
  12. package/dist/types/features/bubbles/providers/hybrid-bubble-provider.d.ts +124 -0
  13. package/dist/types/features/proof/ProofChain.d.ts +225 -0
  14. package/dist/types/features/stealth/StealthChain.d.ts +200 -0
  15. package/dist/types/index.d.ts +61 -0
  16. package/dist/types/utils/common.d.ts +11 -0
  17. package/dist/types/utils/encryption.d.ts +32 -0
  18. package/package.json +110 -26
  19. package/dist/gun-eth-protocol.cjs.js +0 -11528
  20. package/dist/gun-eth-protocol.esm.js +0 -11503
  21. package/dist/gun-eth-protocol.js +0 -18
  22. package/dist/gun-eth-protocol.react.js +0 -11503
  23. package/dist/gun-eth-protocol.umd.js +0 -18
  24. package/jsdoc.json +0 -7
  25. package/rollup.config.js +0 -80
  26. package/src/index.js +0 -181
  27. package/src/lib/authentication/index.js +0 -13
  28. package/src/lib/authentication/isAuthenticated.js +0 -20
  29. package/src/lib/authentication/login.js +0 -25
  30. package/src/lib/authentication/register.js +0 -58
  31. package/src/lib/blockchain/abis/SHINE.json +0 -262
  32. package/src/lib/blockchain/contracts/SHINE.sol +0 -52
  33. package/src/lib/blockchain/ethereum.js +0 -74
  34. package/src/lib/blockchain/shine.js +0 -204
  35. package/src/lib/certificates/friendsCertificates.js +0 -92
  36. package/src/lib/certificates/index.js +0 -44
  37. package/src/lib/certificates/messagingCertificates.js +0 -94
  38. package/src/lib/friends/acceptFriendRequest.js +0 -69
  39. package/src/lib/friends/addFriendRequest.js +0 -49
  40. package/src/lib/friends/friendRequests.js +0 -51
  41. package/src/lib/friends/friendsList.js +0 -57
  42. package/src/lib/friends/index.js +0 -36
  43. package/src/lib/friends/rejectFriendRequest.js +0 -31
  44. package/src/lib/messaging/chatsList.js +0 -42
  45. package/src/lib/messaging/createChat.js +0 -132
  46. package/src/lib/messaging/index.js +0 -36
  47. package/src/lib/messaging/messageList.js +0 -106
  48. package/src/lib/messaging/sendMessage.js +0 -132
  49. package/src/lib/messaging/sendVoiceMessage.js +0 -119
  50. package/src/lib/notes/createNote.js +0 -41
  51. package/src/lib/notes/deleteNote.js +0 -12
  52. package/src/lib/notes/getNote.js +0 -25
  53. package/src/lib/notes/getUserNote.js +0 -59
  54. package/src/lib/notes/index.js +0 -8
  55. package/src/lib/notes/updateNotes.js +0 -35
  56. package/src/lib/post/createPost.js +0 -17
  57. package/src/lib/post/decryptPost.js +0 -14
  58. package/src/lib/post/deletePost.js +0 -13
  59. package/src/lib/post/encryptPost,js +0 -16
  60. package/src/lib/post/getPost.js +0 -36
  61. package/src/lib/post/index.js +0 -9
  62. package/src/lib/post/updatePost.js +0 -16
  63. package/src/state/gun.js +0 -33
  64. package/types/types.d.ts +0 -244
@@ -0,0 +1,6 @@
1
+ export default browserGunEth;
2
+ export type BrowserGunEth = {
3
+ GunEth: typeof import("./core/gun-eth.js").GunEth;
4
+ };
5
+ /** @type {BrowserGunEth} */
6
+ declare const browserGunEth: BrowserGunEth;
@@ -0,0 +1,7 @@
1
+ export namespace LOCAL_CONFIG {
2
+ let STEALTH_ANNOUNCER_ADDRESS: any;
3
+ let PROOF_OF_INTEGRITY_ADDRESS: any;
4
+ let BUBBLE_REGISTRY_ADDRESS: any;
5
+ let RPC_URL: string;
6
+ let CHAIN_ID: number;
7
+ }
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Ottiene le configurazioni degli indirizzi per una specifica chain
3
+ * @param {string} [chain='localhost'] - Nome della chain
4
+ * @returns {ChainConfig} Configurazione degli indirizzi per la chain specificata
5
+ * @throws {Error} Se la configurazione della chain non viene trovata
6
+ */
7
+ export function getAddressesForChain(chain?: string): ChainConfig;
8
+ export const STEALTH_ANNOUNCER_ABI: any;
9
+ export const BUBBLE_REGISTRY_ABI: any;
10
+ export const PROOF_OF_INTEGRITY_ABI: any;
11
+ /** @type {boolean} */
12
+ export const isLocalEnvironment: boolean;
13
+ export const PROOF_OF_INTEGRITY_ADDRESS: string;
14
+ export const STEALTH_ANNOUNCER_ADDRESS: string;
15
+ export const BUBBLE_REGISTRY_ADDRESS: string;
16
+ export type ChainConfig = {
17
+ /**
18
+ * - ID della chain
19
+ */
20
+ CHAIN_ID: number;
21
+ /**
22
+ * - URL del nodo RPC
23
+ */
24
+ RPC_URL: string;
25
+ /**
26
+ * - Indirizzo del contratto ProofOfIntegrity
27
+ */
28
+ PROOF_OF_INTEGRITY_ADDRESS: string;
29
+ /**
30
+ * - Indirizzo del contratto StealthAnnouncer
31
+ */
32
+ STEALTH_ANNOUNCER_ADDRESS: string;
33
+ /**
34
+ * - Indirizzo del contratto BubbleRegistry
35
+ */
36
+ BUBBLE_REGISTRY_ADDRESS: string;
37
+ };
@@ -0,0 +1 @@
1
+ export * from "./abis.js";
@@ -0,0 +1,419 @@
1
+ /**
2
+ * Classe principale per l'integrazione di Gun con Ethereum
3
+ */
4
+ export class GunEth {
5
+ static keypair: any;
6
+ static v_keypair: any;
7
+ static s_keypair: any;
8
+ static init(chain?: string): Promise<typeof GunEth>;
9
+ static generateRandomId: typeof generateRandomId;
10
+ static generatePassword: typeof generatePassword;
11
+ static getSigner: typeof getSigner;
12
+ static verifySignature: typeof verifySignature;
13
+ static MESSAGE_TO_SIGN: string;
14
+ static getContractAddresses: typeof getContractAddresses;
15
+ static extendGun: typeof extendGun;
16
+ static initializeGun: typeof initializeGun;
17
+ static setSigner: typeof setSigner;
18
+ static gunToEthAccount: typeof gunToEthAccount;
19
+ static decryptPair: typeof decryptPair;
20
+ static decryptPairFromPassword: typeof decryptPairFromPassword;
21
+ static ethToGunAccount: typeof ethToGunAccount;
22
+ static createAndStoreEncryptedPair: typeof createAndStoreEncryptedPair;
23
+ static getAndDecryptPair: typeof getAndDecryptPair;
24
+ static createSignature: typeof createSignature;
25
+ static LOCAL_CONFIG: {
26
+ STEALTH_ANNOUNCER_ADDRESS: any;
27
+ PROOF_OF_INTEGRITY_ADDRESS: any;
28
+ BUBBLE_REGISTRY_ADDRESS: any;
29
+ RPC_URL: string;
30
+ CHAIN_ID: number;
31
+ };
32
+ static contractAddresses: {
33
+ PROOF_OF_INTEGRITY_ADDRESS: string;
34
+ STEALTH_ANNOUNCER_ADDRESS: string;
35
+ };
36
+ }
37
+ export type IGunChain = import("gun").IGunChain<any, any, any, any>;
38
+ export type IGunInstance = import("gun").IGunInstance;
39
+ export type IGun = import("gun").IGun;
40
+ export type GunOptions = import("gun").GunOptions;
41
+ export type GunSchema = import("gun").GunSchema;
42
+ export type GunHookCallbackCreate = import("gun").GunHookCallbackCreate;
43
+ export type GunHookCallbackOpt = import("gun").GunHookCallbackOpt;
44
+ export type GunMethods = {
45
+ /**
46
+ * - Get method
47
+ */
48
+ get: (path: string) => IGunInstance;
49
+ /**
50
+ * - Put method
51
+ */
52
+ put: (data: any) => IGunInstance;
53
+ /**
54
+ * - Set method
55
+ */
56
+ set: (data: any) => IGunInstance;
57
+ /**
58
+ * - Map method
59
+ */
60
+ map: () => IGunInstance;
61
+ /**
62
+ * - Back method
63
+ */
64
+ back: () => IGunInstance;
65
+ /**
66
+ * - Off method
67
+ */
68
+ off: () => IGunInstance;
69
+ /**
70
+ * - On method
71
+ */
72
+ on: {
73
+ (event: "create", callback: GunHookCallbackCreate): void;
74
+ (event: "opt", callback: GunHookCallbackOpt): void;
75
+ (event: string, callback: Function): IGunInstance;
76
+ };
77
+ /**
78
+ * - Once method
79
+ */
80
+ once: (callback: (data: any, key: string) => void) => IGunInstance;
81
+ };
82
+ export type GunBase = {
83
+ /**
84
+ * - Gun state
85
+ */
86
+ state: any;
87
+ /**
88
+ * - Gun chain
89
+ */
90
+ chain: IGunChain & IGunInstance;
91
+ /**
92
+ * - Gun SEA
93
+ */
94
+ SEA: any;
95
+ /**
96
+ * - Verify signature method
97
+ */
98
+ verifySignature: (message: string, signature: string) => Promise<string>;
99
+ /**
100
+ * - Gun internal properties
101
+ */
102
+ _: any;
103
+ /**
104
+ * - Gun user instance
105
+ */
106
+ user: any;
107
+ /**
108
+ * - Gun options
109
+ */
110
+ opt: any;
111
+ };
112
+ export type GunExtended = GunBase & GunMethods & {
113
+ (options?: GunOptions): IGunInstance;
114
+ new (options?: GunOptions): IGunInstance;
115
+ };
116
+ export type StealthMethodsBase = {
117
+ generateStealthAddress: (this: IGunInstance, arg1: string, arg2: string, arg3: any) => Promise<any>;
118
+ announceStealthPayment: (this: IGunInstance, arg1: string, arg2: string, arg3: string, arg4: string, arg5: any) => Promise<{
119
+ stealthAddress: string;
120
+ senderPublicKey: string;
121
+ spendingPublicKey: string;
122
+ timestamp: number;
123
+ source: string;
124
+ }>;
125
+ getStealthPayments: (this: IGunInstance, arg1: string, arg2: any) => Promise<Array<any>>;
126
+ recoverStealthFunds: (this: IGunInstance, arg1: string, arg2: string, arg3: string, arg4: string) => Promise<any>;
127
+ publishStealthKeys: (this: IGunInstance, arg1: string) => Promise<any>;
128
+ stealth: (this: IGunInstance, arg1: string, ...args: any[][]) => Promise<any>;
129
+ monitorStealthEvents: (this: IGunInstance, arg1: (arg0: any) => void) => any;
130
+ };
131
+ export type ExtendedSigner = {
132
+ /**
133
+ * - Ethereum address
134
+ */
135
+ address: string;
136
+ /**
137
+ * - Private key
138
+ */
139
+ privateKey: string;
140
+ /**
141
+ * - Signs a message
142
+ */
143
+ signMessage: (arg0: string) => Promise<string>;
144
+ /**
145
+ * - Gets the signer address
146
+ */
147
+ getAddress: () => Promise<string>;
148
+ /**
149
+ * - Provider instance
150
+ */
151
+ provider: any;
152
+ };
153
+ export type BaseMethods = {
154
+ MESSAGE_TO_SIGN: string;
155
+ setSigner: Function;
156
+ getSigner: Function;
157
+ verifySignature: Function;
158
+ generatePassword: Function;
159
+ createSignature: Function;
160
+ createAndStoreEncryptedPair: Function;
161
+ getAndDecryptPair: Function;
162
+ ethToGunAccount: Function;
163
+ gunToEthAccount: Function;
164
+ getAddressesForChain: Function;
165
+ };
166
+ export type StealthMethods = StealthMethodsBase & IGunInstance;
167
+ export type ExtendedGunBase = {
168
+ /**
169
+ * - Gun state
170
+ */
171
+ state: any;
172
+ /**
173
+ * - Gun chain
174
+ */
175
+ chain: IGunChain & IGunInstance;
176
+ /**
177
+ * - Gun SEA
178
+ */
179
+ SEA: any;
180
+ /**
181
+ * - Get method
182
+ */
183
+ get: (path: string) => any;
184
+ /**
185
+ * - Put method
186
+ */
187
+ put: (data: any) => void;
188
+ /**
189
+ * - Set method
190
+ */
191
+ set: (data: any) => void;
192
+ /**
193
+ * - Map method
194
+ */
195
+ map: () => any;
196
+ /**
197
+ * - On method
198
+ */
199
+ on: (event: string, callback: Function) => any;
200
+ /**
201
+ * - Once method
202
+ */
203
+ once: (callback: (data: any, key: string) => void) => void;
204
+ /**
205
+ * - Verify signature method
206
+ */
207
+ verifySignature: (message: string, signature: string) => Promise<string>;
208
+ /**
209
+ * - Gun internal properties
210
+ */
211
+ _: any;
212
+ /**
213
+ * - Gun user instance
214
+ */
215
+ user: any;
216
+ /**
217
+ * - Gun options
218
+ */
219
+ opt: any;
220
+ };
221
+ export type ExtendedGun = ExtendedGunBase & IGun;
222
+ export type FullGunInstance = ExtendedGun & IGunInstance;
223
+ export type GunHookCallbacks = {
224
+ /**
225
+ * - Create callback
226
+ */
227
+ create: Function;
228
+ /**
229
+ * - Put callback
230
+ */
231
+ put: Function;
232
+ /**
233
+ * - Get callback
234
+ */
235
+ get: Function;
236
+ /**
237
+ * - Opt callback
238
+ */
239
+ opt: Function;
240
+ };
241
+ import { generateRandomId } from '../utils/common.js';
242
+ /**
243
+ * @param {ethers.BytesLike} signature
244
+ */
245
+ export function generatePassword(signature: ethers.BytesLike): string;
246
+ export function getSigner(chain?: string): Promise<any>;
247
+ /**
248
+ * @param {string | Uint8Array} message
249
+ * @param {ethers.SignatureLike} signature
250
+ */
251
+ export function verifySignature(message: string | Uint8Array, signature: ethers.SignatureLike): Promise<string>;
252
+ import { getContractAddresses } from '../utils/common.js';
253
+ /**
254
+ * @param {import("gun").IGun} Gun
255
+ */
256
+ export function extendGun(Gun: import("gun").IGun): void;
257
+ /**
258
+ * Inizializza Gun con le estensioni e le opzioni specificate
259
+ * @param {string} chain - Chain da utilizzare
260
+ * @param {Object} [options] - Opzioni di configurazione per Gun
261
+ * @returns {Promise<IGunInstance>} Istanza di Gun configurata
262
+ */
263
+ export function initializeGun(chain?: string, options?: any): Promise<IGunInstance>;
264
+ /**
265
+ * @param {string} newRpcUrl
266
+ * @param {string} newPrivateKey
267
+ */
268
+ export function setSigner(newRpcUrl: string, newPrivateKey: string): any;
269
+ /**
270
+ * @param {string} gunPrivateKey
271
+ */
272
+ export function gunToEthAccount(gunPrivateKey: string): any;
273
+ /**
274
+ * @param {string} encryptedPair
275
+ * @param {any} password
276
+ */
277
+ export function decryptPair(encryptedPair: string, password: any): Promise<any>;
278
+ /**
279
+ * @param {string} encryptedPair
280
+ * @param {any} password
281
+ */
282
+ export function decryptPairFromPassword(encryptedPair: string, password: any): Promise<any>;
283
+ export function ethToGunAccount(): Promise<{
284
+ pair: import("gun").ISEAPair;
285
+ v_pair: import("gun").ISEAPair;
286
+ s_pair: import("gun").ISEAPair;
287
+ ethAddress: string;
288
+ ethPrivateKey: string;
289
+ env_pair: string;
290
+ env_v_pair: string;
291
+ env_s_pair: string;
292
+ publicKeys: {
293
+ viewingPublicKey: string;
294
+ spendingPublicKey: any;
295
+ ethViewingAddress: any;
296
+ };
297
+ }>;
298
+ /**
299
+ * @param {any} address
300
+ */
301
+ export function createAndStoreEncryptedPair(address: any): Promise<void>;
302
+ /**
303
+ * @param {any} address
304
+ * @param {any} signature
305
+ */
306
+ export function getAndDecryptPair(address: any, signature: any): Promise<any>;
307
+ /**
308
+ * Crea una firma utilizzando il signer corrente
309
+ * @param {string} message - Messaggio da firmare
310
+ * @returns {Promise<string>} Firma generata
311
+ */
312
+ export function createSignature(message: string): Promise<string>;
313
+ /**
314
+ * @typedef {import('gun').IGunChain<any, any, any, any>} IGunChain
315
+ * @typedef {import('gun').IGunInstance} IGunInstance
316
+ * @typedef {import('gun').IGun} IGun
317
+ * @typedef {import('gun').GunOptions} GunOptions
318
+ * @typedef {import('gun').GunSchema} GunSchema
319
+ * @typedef {import('gun').GunHookCallbackCreate} GunHookCallbackCreate
320
+ * @typedef {import('gun').GunHookCallbackOpt} GunHookCallbackOpt
321
+ */
322
+ /**
323
+ * @typedef {Object} GunMethods
324
+ * @property {(path: string) => IGunInstance} get - Get method
325
+ * @property {(data: any) => IGunInstance} put - Put method
326
+ * @property {(data: any) => IGunInstance} set - Set method
327
+ * @property {() => IGunInstance} map - Map method
328
+ * @property {() => IGunInstance} back - Back method
329
+ * @property {() => IGunInstance} off - Off method
330
+ * @property {{
331
+ * (event: "create", callback: GunHookCallbackCreate): void;
332
+ * (event: "opt", callback: GunHookCallbackOpt): void;
333
+ * (event: string, callback: Function): IGunInstance;
334
+ * }} on - On method
335
+ * @property {(callback: (data: any, key: string) => void) => IGunInstance} once - Once method
336
+ */
337
+ /**
338
+ * @typedef {Object} GunBase
339
+ * @property {Object} state - Gun state
340
+ * @property {IGunChain & IGunInstance} chain - Gun chain
341
+ * @property {Object} SEA - Gun SEA
342
+ * @property {(message: string, signature: string) => Promise<string>} verifySignature - Verify signature method
343
+ * @property {Object} _ - Gun internal properties
344
+ * @property {Object} user - Gun user instance
345
+ * @property {Object} opt - Gun options
346
+ */
347
+ /**
348
+ * @typedef {GunBase & GunMethods & {
349
+ * (options?: GunOptions): IGunInstance;
350
+ * new (options?: GunOptions): IGunInstance;
351
+ * }} GunExtended
352
+ */
353
+ /**
354
+ * @typedef {Object} StealthMethodsBase
355
+ * @property {function(this: IGunInstance, string, string, Object): Promise<any>} generateStealthAddress
356
+ * @property {function(this: IGunInstance, string, string, string, string, Object): Promise<{stealthAddress: string, senderPublicKey: string, spendingPublicKey: string, timestamp: number, source: string}>} announceStealthPayment
357
+ * @property {function(this: IGunInstance, string, Object): Promise<Array<any>>} getStealthPayments
358
+ * @property {function(this: IGunInstance, string, string, string, string): Promise<any>} recoverStealthFunds
359
+ * @property {function(this: IGunInstance, string): Promise<any>} publishStealthKeys
360
+ * @property {function(this: IGunInstance, string, ...any[]): Promise<any>} stealth
361
+ * @property {function(this: IGunInstance, function(any): void): any} monitorStealthEvents
362
+ */
363
+ /**
364
+ * @typedef {Object} ExtendedSigner
365
+ * @property {string} address - Ethereum address
366
+ * @property {string} privateKey - Private key
367
+ * @property {function(string): Promise<string>} signMessage - Signs a message
368
+ * @property {function(): Promise<string>} getAddress - Gets the signer address
369
+ * @property {Object} provider - Provider instance
370
+ */
371
+ /**
372
+ * @typedef {Object} BaseMethods
373
+ * @property {string} MESSAGE_TO_SIGN
374
+ * @property {function} setSigner
375
+ * @property {function} getSigner
376
+ * @property {function} verifySignature
377
+ * @property {function} generatePassword
378
+ * @property {function} createSignature
379
+ * @property {function} createAndStoreEncryptedPair
380
+ * @property {function} getAndDecryptPair
381
+ * @property {function} ethToGunAccount
382
+ * @property {function} gunToEthAccount
383
+ * @property {function} getAddressesForChain
384
+ */
385
+ /**
386
+ * @typedef {StealthMethodsBase & IGunInstance} StealthMethods
387
+ */
388
+ /**
389
+ * @typedef {Object} ExtendedGunBase
390
+ * @property {Object} state - Gun state
391
+ * @property {IGunChain & IGunInstance} chain - Gun chain
392
+ * @property {Object} SEA - Gun SEA
393
+ * @property {(path: string) => any} get - Get method
394
+ * @property {(data: any) => void} put - Put method
395
+ * @property {(data: any) => void} set - Set method
396
+ * @property {() => any} map - Map method
397
+ * @property {(event: string, callback: Function) => any} on - On method
398
+ * @property {(callback: (data: any, key: string) => void) => void} once - Once method
399
+ * @property {(message: string, signature: string) => Promise<string>} verifySignature - Verify signature method
400
+ * @property {Object} _ - Gun internal properties
401
+ * @property {Object} user - Gun user instance
402
+ * @property {Object} opt - Gun options
403
+ */
404
+ /**
405
+ * @typedef {ExtendedGunBase & IGun} ExtendedGun
406
+ */
407
+ /**
408
+ * @typedef {ExtendedGun & IGunInstance} FullGunInstance
409
+ */
410
+ /**
411
+ * @typedef {Object} GunHookCallbacks
412
+ * @property {function} create - Create callback
413
+ * @property {function} put - Put callback
414
+ * @property {function} get - Get callback
415
+ * @property {function} opt - Opt callback
416
+ */
417
+ export const MESSAGE_TO_SIGN: "Access GunDB with Ethereum";
418
+ import { ethers } from "ethers";
419
+ export { generateRandomId, getContractAddresses };
@@ -0,0 +1,184 @@
1
+ /**
2
+ * Client per interagire con il servizio Bubble
3
+ */
4
+ export class BubbleClient {
5
+ /**
6
+ * @param {BubbleClientOptions} options
7
+ */
8
+ constructor(options: BubbleClientOptions);
9
+ baseUrl: string;
10
+ signer: {
11
+ /**
12
+ * - Indirizzo Ethereum del signer
13
+ */
14
+ address: string;
15
+ };
16
+ keypair: {
17
+ /**
18
+ * - Chiave pubblica di crittografia
19
+ */
20
+ epub: string;
21
+ /**
22
+ * - Chiave privata di crittografia
23
+ */
24
+ epriv: string;
25
+ };
26
+ contractAddress: string;
27
+ contractAbi: any;
28
+ /**
29
+ * Inizializza la sessione bubble
30
+ * @returns {Promise<boolean>}
31
+ */
32
+ initBubbleSession(): Promise<boolean>;
33
+ /**
34
+ * Crea una nuova bubble
35
+ * @param {string} name - Nome della bubble
36
+ * @param {BubbleCreateOptions} [options] - Opzioni di creazione
37
+ * @returns {Promise<BubbleMetadata>}
38
+ */
39
+ createBubble(name: string, options?: BubbleCreateOptions): Promise<BubbleMetadata>;
40
+ /**
41
+ * Scrive un file nella bubble
42
+ * @param {string} bubbleId - ID della bubble
43
+ * @param {string} fileName - Nome del file
44
+ * @param {string} content - Contenuto del file
45
+ * @returns {Promise<BubbleWriteResult>}
46
+ */
47
+ writeBubble(bubbleId: string, fileName: string, content: string): Promise<BubbleWriteResult>;
48
+ /**
49
+ * Legge un file dalla bubble
50
+ * @param {string} bubbleId - ID della bubble
51
+ * @param {string} fileName - Nome del file
52
+ * @returns {Promise<BubbleReadResult>}
53
+ */
54
+ readBubble(bubbleId: string, fileName: string): Promise<BubbleReadResult>;
55
+ /**
56
+ * Condivide una bubble con un altro utente
57
+ * @param {string} bubbleId - ID della bubble
58
+ * @param {string} granteeAddress - Indirizzo del destinatario
59
+ * @param {BubbleShareOptions} [options] - Opzioni di condivisione
60
+ * @returns {Promise<BubbleShareResult>}
61
+ */
62
+ shareBubble(bubbleId: string, granteeAddress: string, options?: BubbleShareOptions): Promise<BubbleShareResult>;
63
+ /**
64
+ * Elimina una bubble
65
+ * @param {string} bubbleId - ID della bubble
66
+ * @param {Object} [options] - Opzioni aggiuntive
67
+ * @param {string} [options.userAddress] - Indirizzo dell'utente (opzionale, default: this.signer.address)
68
+ * @returns {Promise<{success: boolean}>}
69
+ */
70
+ deleteBubble(bubbleId: string, options?: {
71
+ userAddress?: string;
72
+ }): Promise<{
73
+ success: boolean;
74
+ }>;
75
+ }
76
+ export type BubbleClientOptions = {
77
+ /**
78
+ * - URL del provider del servizio bubble
79
+ */
80
+ providerUrl: string;
81
+ /**
82
+ * - Signer Ethereum per autenticare le richieste
83
+ */
84
+ signer: {
85
+ address: string;
86
+ };
87
+ /**
88
+ * - Coppia di chiavi per crittografia
89
+ */
90
+ keypair: {
91
+ epub: string;
92
+ epriv: string;
93
+ };
94
+ /**
95
+ * - Optional custom contract address
96
+ */
97
+ contractAddress?: string;
98
+ /**
99
+ * - Optional custom contract ABI
100
+ */
101
+ contractAbi?: any;
102
+ };
103
+ export type BubbleCreateOptions = {
104
+ /**
105
+ * - Se la bubble deve essere privata
106
+ */
107
+ isPrivate?: boolean;
108
+ };
109
+ export type BubbleShareOptions = {
110
+ /**
111
+ * - Public key of recipient
112
+ */
113
+ granteeEpub: string;
114
+ };
115
+ export type BubbleMetadata = {
116
+ /**
117
+ * - ID della bubble
118
+ */
119
+ id: string;
120
+ /**
121
+ * - Nome della bubble
122
+ */
123
+ name: string;
124
+ /**
125
+ * - Indirizzo del proprietario
126
+ */
127
+ owner: string;
128
+ /**
129
+ * - Se la bubble è privata
130
+ */
131
+ isPrivate: boolean;
132
+ /**
133
+ * - Timestamp di creazione
134
+ */
135
+ createdAt: number;
136
+ };
137
+ export type FileMetadata = {
138
+ /**
139
+ * - Nome del file
140
+ */
141
+ name: string;
142
+ /**
143
+ * - Dimensione in bytes
144
+ */
145
+ size: number;
146
+ /**
147
+ * - Indirizzo del proprietario
148
+ */
149
+ owner: string;
150
+ /**
151
+ * - Timestamp di creazione
152
+ */
153
+ created: number;
154
+ /**
155
+ * - Timestamp ultimo aggiornamento
156
+ */
157
+ updated: number;
158
+ };
159
+ export type BubbleWriteResult = {
160
+ /**
161
+ * - Contenuto criptato
162
+ */
163
+ content: string;
164
+ /**
165
+ * - Metadati del file
166
+ */
167
+ metadata: FileMetadata;
168
+ };
169
+ export type BubbleReadResult = {
170
+ /**
171
+ * - Contenuto criptato
172
+ */
173
+ content: string;
174
+ /**
175
+ * - Metadati del file
176
+ */
177
+ metadata: FileMetadata;
178
+ };
179
+ export type BubbleShareResult = {
180
+ /**
181
+ * - Se la condivisione è avvenuta con successo
182
+ */
183
+ success: boolean;
184
+ };