@snaha/swarm-id 0.0.1

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 (223) hide show
  1. package/README.md +431 -0
  2. package/dist/chunk/bmt.d.ts +17 -0
  3. package/dist/chunk/bmt.d.ts.map +1 -0
  4. package/dist/chunk/cac.d.ts +18 -0
  5. package/dist/chunk/cac.d.ts.map +1 -0
  6. package/dist/chunk/constants.d.ts +10 -0
  7. package/dist/chunk/constants.d.ts.map +1 -0
  8. package/dist/chunk/encrypted-cac.d.ts +48 -0
  9. package/dist/chunk/encrypted-cac.d.ts.map +1 -0
  10. package/dist/chunk/encryption.d.ts +86 -0
  11. package/dist/chunk/encryption.d.ts.map +1 -0
  12. package/dist/chunk/index.d.ts +6 -0
  13. package/dist/chunk/index.d.ts.map +1 -0
  14. package/dist/index.d.ts +46 -0
  15. package/dist/index.d.ts.map +1 -0
  16. package/dist/proxy/act/act.d.ts +78 -0
  17. package/dist/proxy/act/act.d.ts.map +1 -0
  18. package/dist/proxy/act/crypto.d.ts +44 -0
  19. package/dist/proxy/act/crypto.d.ts.map +1 -0
  20. package/dist/proxy/act/grantee-list.d.ts +82 -0
  21. package/dist/proxy/act/grantee-list.d.ts.map +1 -0
  22. package/dist/proxy/act/history.d.ts +183 -0
  23. package/dist/proxy/act/history.d.ts.map +1 -0
  24. package/dist/proxy/act/index.d.ts +104 -0
  25. package/dist/proxy/act/index.d.ts.map +1 -0
  26. package/dist/proxy/chunking-encrypted.d.ts +14 -0
  27. package/dist/proxy/chunking-encrypted.d.ts.map +1 -0
  28. package/dist/proxy/chunking.d.ts +15 -0
  29. package/dist/proxy/chunking.d.ts.map +1 -0
  30. package/dist/proxy/download-data.d.ts +16 -0
  31. package/dist/proxy/download-data.d.ts.map +1 -0
  32. package/dist/proxy/feed-manifest.d.ts +62 -0
  33. package/dist/proxy/feed-manifest.d.ts.map +1 -0
  34. package/dist/proxy/feeds/epochs/async-finder.d.ts +77 -0
  35. package/dist/proxy/feeds/epochs/async-finder.d.ts.map +1 -0
  36. package/dist/proxy/feeds/epochs/epoch.d.ts +88 -0
  37. package/dist/proxy/feeds/epochs/epoch.d.ts.map +1 -0
  38. package/dist/proxy/feeds/epochs/finder.d.ts +67 -0
  39. package/dist/proxy/feeds/epochs/finder.d.ts.map +1 -0
  40. package/dist/proxy/feeds/epochs/index.d.ts +35 -0
  41. package/dist/proxy/feeds/epochs/index.d.ts.map +1 -0
  42. package/dist/proxy/feeds/epochs/test-utils.d.ts +93 -0
  43. package/dist/proxy/feeds/epochs/test-utils.d.ts.map +1 -0
  44. package/dist/proxy/feeds/epochs/types.d.ts +109 -0
  45. package/dist/proxy/feeds/epochs/types.d.ts.map +1 -0
  46. package/dist/proxy/feeds/epochs/updater.d.ts +68 -0
  47. package/dist/proxy/feeds/epochs/updater.d.ts.map +1 -0
  48. package/dist/proxy/feeds/epochs/utils.d.ts +22 -0
  49. package/dist/proxy/feeds/epochs/utils.d.ts.map +1 -0
  50. package/dist/proxy/feeds/index.d.ts +5 -0
  51. package/dist/proxy/feeds/index.d.ts.map +1 -0
  52. package/dist/proxy/feeds/sequence/async-finder.d.ts +14 -0
  53. package/dist/proxy/feeds/sequence/async-finder.d.ts.map +1 -0
  54. package/dist/proxy/feeds/sequence/finder.d.ts +17 -0
  55. package/dist/proxy/feeds/sequence/finder.d.ts.map +1 -0
  56. package/dist/proxy/feeds/sequence/index.d.ts +23 -0
  57. package/dist/proxy/feeds/sequence/index.d.ts.map +1 -0
  58. package/dist/proxy/feeds/sequence/types.d.ts +80 -0
  59. package/dist/proxy/feeds/sequence/types.d.ts.map +1 -0
  60. package/dist/proxy/feeds/sequence/updater.d.ts +26 -0
  61. package/dist/proxy/feeds/sequence/updater.d.ts.map +1 -0
  62. package/dist/proxy/index.d.ts +6 -0
  63. package/dist/proxy/index.d.ts.map +1 -0
  64. package/dist/proxy/manifest-builder.d.ts +183 -0
  65. package/dist/proxy/manifest-builder.d.ts.map +1 -0
  66. package/dist/proxy/mantaray-encrypted.d.ts +27 -0
  67. package/dist/proxy/mantaray-encrypted.d.ts.map +1 -0
  68. package/dist/proxy/mantaray.d.ts +26 -0
  69. package/dist/proxy/mantaray.d.ts.map +1 -0
  70. package/dist/proxy/types.d.ts +29 -0
  71. package/dist/proxy/types.d.ts.map +1 -0
  72. package/dist/proxy/upload-data.d.ts +17 -0
  73. package/dist/proxy/upload-data.d.ts.map +1 -0
  74. package/dist/proxy/upload-encrypted-data.d.ts +103 -0
  75. package/dist/proxy/upload-encrypted-data.d.ts.map +1 -0
  76. package/dist/schemas.d.ts +240 -0
  77. package/dist/schemas.d.ts.map +1 -0
  78. package/dist/storage/debounced-uploader.d.ts +62 -0
  79. package/dist/storage/debounced-uploader.d.ts.map +1 -0
  80. package/dist/storage/utilization-store.d.ts +108 -0
  81. package/dist/storage/utilization-store.d.ts.map +1 -0
  82. package/dist/swarm-id-auth.d.ts +74 -0
  83. package/dist/swarm-id-auth.d.ts.map +1 -0
  84. package/dist/swarm-id-auth.js +2 -0
  85. package/dist/swarm-id-auth.js.map +1 -0
  86. package/dist/swarm-id-client.d.ts +878 -0
  87. package/dist/swarm-id-client.d.ts.map +1 -0
  88. package/dist/swarm-id-client.js +2 -0
  89. package/dist/swarm-id-client.js.map +1 -0
  90. package/dist/swarm-id-proxy.d.ts +236 -0
  91. package/dist/swarm-id-proxy.d.ts.map +1 -0
  92. package/dist/swarm-id-proxy.js +2 -0
  93. package/dist/swarm-id-proxy.js.map +1 -0
  94. package/dist/swarm-id.esm.js +2 -0
  95. package/dist/swarm-id.esm.js.map +1 -0
  96. package/dist/swarm-id.umd.js +2 -0
  97. package/dist/swarm-id.umd.js.map +1 -0
  98. package/dist/sync/index.d.ts +9 -0
  99. package/dist/sync/index.d.ts.map +1 -0
  100. package/dist/sync/key-derivation.d.ts +25 -0
  101. package/dist/sync/key-derivation.d.ts.map +1 -0
  102. package/dist/sync/restore-account.d.ts +28 -0
  103. package/dist/sync/restore-account.d.ts.map +1 -0
  104. package/dist/sync/serialization.d.ts +16 -0
  105. package/dist/sync/serialization.d.ts.map +1 -0
  106. package/dist/sync/store-interfaces.d.ts +53 -0
  107. package/dist/sync/store-interfaces.d.ts.map +1 -0
  108. package/dist/sync/sync-account.d.ts +44 -0
  109. package/dist/sync/sync-account.d.ts.map +1 -0
  110. package/dist/sync/types.d.ts +13 -0
  111. package/dist/sync/types.d.ts.map +1 -0
  112. package/dist/test-fixtures.d.ts +17 -0
  113. package/dist/test-fixtures.d.ts.map +1 -0
  114. package/dist/types-BD_VkNn0.js +2 -0
  115. package/dist/types-BD_VkNn0.js.map +1 -0
  116. package/dist/types-lJCaT-50.js +2 -0
  117. package/dist/types-lJCaT-50.js.map +1 -0
  118. package/dist/types.d.ts +2157 -0
  119. package/dist/types.d.ts.map +1 -0
  120. package/dist/utils/account-payload.d.ts +94 -0
  121. package/dist/utils/account-payload.d.ts.map +1 -0
  122. package/dist/utils/account-state-snapshot.d.ts +38 -0
  123. package/dist/utils/account-state-snapshot.d.ts.map +1 -0
  124. package/dist/utils/backup-encryption.d.ts +127 -0
  125. package/dist/utils/backup-encryption.d.ts.map +1 -0
  126. package/dist/utils/batch-utilization.d.ts +432 -0
  127. package/dist/utils/batch-utilization.d.ts.map +1 -0
  128. package/dist/utils/constants.d.ts +11 -0
  129. package/dist/utils/constants.d.ts.map +1 -0
  130. package/dist/utils/hex.d.ts +17 -0
  131. package/dist/utils/hex.d.ts.map +1 -0
  132. package/dist/utils/key-derivation.d.ts +92 -0
  133. package/dist/utils/key-derivation.d.ts.map +1 -0
  134. package/dist/utils/storage-managers.d.ts +65 -0
  135. package/dist/utils/storage-managers.d.ts.map +1 -0
  136. package/dist/utils/swarm-id-export.d.ts +24 -0
  137. package/dist/utils/swarm-id-export.d.ts.map +1 -0
  138. package/dist/utils/ttl.d.ts +49 -0
  139. package/dist/utils/ttl.d.ts.map +1 -0
  140. package/dist/utils/url.d.ts +41 -0
  141. package/dist/utils/url.d.ts.map +1 -0
  142. package/dist/utils/versioned-storage.d.ts +131 -0
  143. package/dist/utils/versioned-storage.d.ts.map +1 -0
  144. package/package.json +78 -0
  145. package/src/chunk/bmt.test.ts +217 -0
  146. package/src/chunk/bmt.ts +57 -0
  147. package/src/chunk/cac.test.ts +214 -0
  148. package/src/chunk/cac.ts +65 -0
  149. package/src/chunk/constants.ts +18 -0
  150. package/src/chunk/encrypted-cac.test.ts +385 -0
  151. package/src/chunk/encrypted-cac.ts +131 -0
  152. package/src/chunk/encryption.test.ts +352 -0
  153. package/src/chunk/encryption.ts +300 -0
  154. package/src/chunk/index.ts +47 -0
  155. package/src/index.ts +430 -0
  156. package/src/proxy/act/act.test.ts +278 -0
  157. package/src/proxy/act/act.ts +158 -0
  158. package/src/proxy/act/bee-compat.test.ts +948 -0
  159. package/src/proxy/act/crypto.test.ts +436 -0
  160. package/src/proxy/act/crypto.ts +376 -0
  161. package/src/proxy/act/grantee-list.test.ts +393 -0
  162. package/src/proxy/act/grantee-list.ts +239 -0
  163. package/src/proxy/act/history.test.ts +360 -0
  164. package/src/proxy/act/history.ts +413 -0
  165. package/src/proxy/act/index.test.ts +748 -0
  166. package/src/proxy/act/index.ts +853 -0
  167. package/src/proxy/chunking-encrypted.ts +95 -0
  168. package/src/proxy/chunking.ts +65 -0
  169. package/src/proxy/download-data.ts +448 -0
  170. package/src/proxy/feed-manifest.ts +174 -0
  171. package/src/proxy/feeds/epochs/async-finder.ts +372 -0
  172. package/src/proxy/feeds/epochs/epoch.test.ts +249 -0
  173. package/src/proxy/feeds/epochs/epoch.ts +181 -0
  174. package/src/proxy/feeds/epochs/finder.ts +282 -0
  175. package/src/proxy/feeds/epochs/index.ts +73 -0
  176. package/src/proxy/feeds/epochs/integration.test.ts +1336 -0
  177. package/src/proxy/feeds/epochs/test-utils.ts +274 -0
  178. package/src/proxy/feeds/epochs/types.ts +128 -0
  179. package/src/proxy/feeds/epochs/updater.ts +192 -0
  180. package/src/proxy/feeds/epochs/utils.ts +62 -0
  181. package/src/proxy/feeds/index.ts +5 -0
  182. package/src/proxy/feeds/sequence/async-finder.ts +31 -0
  183. package/src/proxy/feeds/sequence/finder.ts +73 -0
  184. package/src/proxy/feeds/sequence/index.ts +54 -0
  185. package/src/proxy/feeds/sequence/integration.test.ts +966 -0
  186. package/src/proxy/feeds/sequence/types.ts +103 -0
  187. package/src/proxy/feeds/sequence/updater.ts +71 -0
  188. package/src/proxy/index.ts +5 -0
  189. package/src/proxy/manifest-builder.test.ts +427 -0
  190. package/src/proxy/manifest-builder.ts +679 -0
  191. package/src/proxy/mantaray-encrypted.ts +78 -0
  192. package/src/proxy/mantaray.ts +104 -0
  193. package/src/proxy/types.ts +32 -0
  194. package/src/proxy/upload-data.ts +189 -0
  195. package/src/proxy/upload-encrypted-data.ts +658 -0
  196. package/src/schemas.ts +299 -0
  197. package/src/storage/debounced-uploader.ts +192 -0
  198. package/src/storage/utilization-store.ts +397 -0
  199. package/src/swarm-id-client.test.ts +99 -0
  200. package/src/swarm-id-client.ts +3095 -0
  201. package/src/swarm-id-proxy.ts +3891 -0
  202. package/src/sync/index.ts +28 -0
  203. package/src/sync/restore-account.ts +90 -0
  204. package/src/sync/serialization.ts +39 -0
  205. package/src/sync/store-interfaces.ts +62 -0
  206. package/src/sync/sync-account.test.ts +302 -0
  207. package/src/sync/sync-account.ts +396 -0
  208. package/src/sync/types.ts +11 -0
  209. package/src/test-fixtures.ts +109 -0
  210. package/src/types.ts +1651 -0
  211. package/src/utils/account-state-snapshot.test.ts +595 -0
  212. package/src/utils/account-state-snapshot.ts +94 -0
  213. package/src/utils/backup-encryption.test.ts +442 -0
  214. package/src/utils/backup-encryption.ts +352 -0
  215. package/src/utils/batch-utilization.ts +1309 -0
  216. package/src/utils/constants.ts +20 -0
  217. package/src/utils/hex.ts +27 -0
  218. package/src/utils/key-derivation.ts +197 -0
  219. package/src/utils/storage-managers.ts +365 -0
  220. package/src/utils/ttl.ts +129 -0
  221. package/src/utils/url.test.ts +136 -0
  222. package/src/utils/url.ts +71 -0
  223. package/src/utils/versioned-storage.ts +323 -0
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Feed utilities and implementations
3
+ */
4
+ export * from "./epochs";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/proxy/feeds/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,UAAU,CAAA"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Async Sequential Feed Finder
3
+ *
4
+ * Currently delegates to the sync finder to match Go behavior
5
+ * while keeping an async interface.
6
+ */
7
+ import type { Bee, EthAddress, Topic, BeeRequestOptions } from "@ethersphere/bee-js";
8
+ import type { SequentialFinder, SequentialLookupResult } from "./types";
9
+ export declare class AsyncSequentialFinder implements SequentialFinder {
10
+ private readonly syncFinder;
11
+ constructor(bee: Bee, topic: Topic, owner: EthAddress);
12
+ findAt(at: bigint, after?: bigint, requestOptions?: BeeRequestOptions): Promise<SequentialLookupResult>;
13
+ }
14
+ //# sourceMappingURL=async-finder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"async-finder.d.ts","sourceRoot":"","sources":["../../../../src/proxy/feeds/sequence/async-finder.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,GAAG,EACH,UAAU,EACV,KAAK,EACL,iBAAiB,EAClB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,KAAK,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAA;AAGvE,qBAAa,qBAAsB,YAAW,gBAAgB;IAC5D,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAsB;gBAErC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU;IAI/C,MAAM,CACV,EAAE,EAAE,MAAM,EACV,KAAK,GAAE,MAAW,EAClB,cAAc,CAAC,EAAE,iBAAiB,GACjC,OAAO,CAAC,sBAAsB,CAAC;CAGnC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Synchronous Sequential Feed Finder
3
+ *
4
+ * Linear scan implementation for finding the latest update index.
5
+ * Mirrors the Go sequential finder behavior.
6
+ */
7
+ import type { Bee, EthAddress, Topic, BeeRequestOptions } from "@ethersphere/bee-js";
8
+ import type { SequentialFinder, SequentialLookupResult } from "./types";
9
+ export declare class SyncSequentialFinder implements SequentialFinder {
10
+ private readonly bee;
11
+ private readonly topic;
12
+ private readonly owner;
13
+ constructor(bee: Bee, topic: Topic, owner: EthAddress);
14
+ findAt(_at: bigint, _after?: bigint, requestOptions?: BeeRequestOptions): Promise<SequentialLookupResult>;
15
+ private indexExists;
16
+ }
17
+ //# sourceMappingURL=finder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"finder.d.ts","sourceRoot":"","sources":["../../../../src/proxy/feeds/sequence/finder.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EACV,GAAG,EACH,UAAU,EACV,KAAK,EACL,iBAAiB,EAClB,MAAM,qBAAqB,CAAA;AAE5B,OAAO,KAAK,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAA;AAgBvE,qBAAa,oBAAqB,YAAW,gBAAgB;IAEzD,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,KAAK;gBAFL,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,UAAU;IAG9B,MAAM,CACV,GAAG,EAAE,MAAM,EACX,MAAM,GAAE,MAAW,EACnB,cAAc,CAAC,EAAE,iBAAiB,GACjC,OAAO,CAAC,sBAAsB,CAAC;YAYpB,WAAW;CAkB1B"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Sequential Feeds
3
+ *
4
+ * Sequential feed indexing for versioned updates.
5
+ */
6
+ export type { SequentialFeedOptions, SequentialFeedWriterOptions, SequentialLookupResult, SequentialFinder, SequentialUpdater, } from "./types";
7
+ export { SyncSequentialFinder } from "./finder";
8
+ export { AsyncSequentialFinder } from "./async-finder";
9
+ export { BasicSequentialUpdater } from "./updater";
10
+ import type { SequentialFeedOptions, SequentialFeedWriterOptions, SequentialFinder, SequentialUpdater } from "./types";
11
+ /**
12
+ * Create a synchronous sequential feed finder
13
+ */
14
+ export declare function createSyncSequentialFinder(options: SequentialFeedOptions): SequentialFinder;
15
+ /**
16
+ * Create an async sequential feed finder
17
+ */
18
+ export declare function createAsyncSequentialFinder(options: SequentialFeedOptions): SequentialFinder;
19
+ /**
20
+ * Create a sequential feed updater
21
+ */
22
+ export declare function createSequentialUpdater(options: SequentialFeedWriterOptions): SequentialUpdater;
23
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/proxy/feeds/sequence/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,YAAY,EACV,qBAAqB,EACrB,2BAA2B,EAC3B,sBAAsB,EACtB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,SAAS,CAAA;AAEhB,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAC/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAA;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAA;AAKlD,OAAO,KAAK,EACV,qBAAqB,EACrB,2BAA2B,EAC3B,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,SAAS,CAAA;AAEhB;;GAEG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,qBAAqB,GAC7B,gBAAgB,CAElB;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,qBAAqB,GAC7B,gBAAgB,CAElB;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,2BAA2B,GACnC,iBAAiB,CAEnB"}
@@ -0,0 +1,80 @@
1
+ /**
2
+ * Types for Sequential Feeds
3
+ */
4
+ import type { Bee, EthAddress, Topic, PrivateKey, Stamper, BeeRequestOptions } from "@ethersphere/bee-js";
5
+ /**
6
+ * Options for creating a sequential feed reader
7
+ */
8
+ export interface SequentialFeedOptions {
9
+ /** Bee instance for chunk operations */
10
+ bee: Bee;
11
+ /** Feed topic (32 bytes) */
12
+ topic: Topic;
13
+ /** Feed owner address */
14
+ owner: EthAddress;
15
+ }
16
+ /**
17
+ * Options for creating a sequential feed writer
18
+ */
19
+ export interface SequentialFeedWriterOptions extends SequentialFeedOptions {
20
+ /** Private key for signing chunks */
21
+ signer: PrivateKey;
22
+ }
23
+ /**
24
+ * Result from sequential feed lookup
25
+ */
26
+ export interface SequentialLookupResult {
27
+ /** Current (latest) index if found */
28
+ current?: bigint;
29
+ /** Next index to use */
30
+ next: bigint;
31
+ }
32
+ /**
33
+ * Interface for sequential feed finders (readers)
34
+ *
35
+ * Implementations: SyncSequentialFinder, AsyncSequentialFinder
36
+ */
37
+ export interface SequentialFinder {
38
+ /**
39
+ * Find the latest feed update index
40
+ *
41
+ * @param at - Ignored for sequential feeds (for compatibility with Go API)
42
+ * @param after - Hint of latest known index (0 if unknown)
43
+ * @returns Lookup result with current and next index
44
+ */
45
+ findAt(at: bigint, after?: bigint, requestOptions?: BeeRequestOptions): Promise<SequentialLookupResult>;
46
+ }
47
+ /**
48
+ * Interface for sequential feed updaters (writers)
49
+ */
50
+ export interface SequentialUpdater {
51
+ /**
52
+ * Update feed with payload data
53
+ *
54
+ * @param payload - Payload to store
55
+ * @param stamper - Stamper object for stamping
56
+ * @returns SOC chunk address for utilization tracking
57
+ */
58
+ update(payload: Uint8Array, stamper: Stamper, encryptionKey?: Uint8Array): Promise<Uint8Array>;
59
+ /**
60
+ * Get the owner address (derived from signer)
61
+ */
62
+ getOwner(): EthAddress;
63
+ /**
64
+ * Get current state (for persistence/debugging)
65
+ */
66
+ getState(): {
67
+ nextIndex: bigint;
68
+ };
69
+ /**
70
+ * Restore state (from persistence)
71
+ */
72
+ setState(state: {
73
+ nextIndex: bigint;
74
+ }): void;
75
+ /**
76
+ * Reset updater state (useful for testing or reinitialization)
77
+ */
78
+ reset(): void;
79
+ }
80
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/proxy/feeds/sequence/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EACV,GAAG,EACH,UAAU,EACV,KAAK,EACL,UAAU,EACV,OAAO,EACP,iBAAiB,EAClB,MAAM,qBAAqB,CAAA;AAE5B;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,wCAAwC;IACxC,GAAG,EAAE,GAAG,CAAA;IAER,4BAA4B;IAC5B,KAAK,EAAE,KAAK,CAAA;IAEZ,yBAAyB;IACzB,KAAK,EAAE,UAAU,CAAA;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,2BAA4B,SAAQ,qBAAqB;IACxE,qCAAqC;IACrC,MAAM,EAAE,UAAU,CAAA;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,sCAAsC;IACtC,OAAO,CAAC,EAAE,MAAM,CAAA;IAEhB,wBAAwB;IACxB,IAAI,EAAE,MAAM,CAAA;CACb;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;;;OAMG;IACH,MAAM,CACJ,EAAE,EAAE,MAAM,EACV,KAAK,CAAC,EAAE,MAAM,EACd,cAAc,CAAC,EAAE,iBAAiB,GACjC,OAAO,CAAC,sBAAsB,CAAC,CAAA;CACnC;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;;;;OAMG;IACH,MAAM,CACJ,OAAO,EAAE,UAAU,EACnB,OAAO,EAAE,OAAO,EAChB,aAAa,CAAC,EAAE,UAAU,GACzB,OAAO,CAAC,UAAU,CAAC,CAAA;IAEtB;;OAEG;IACH,QAAQ,IAAI,UAAU,CAAA;IAEtB;;OAEG;IACH,QAAQ,IAAI;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAA;IAEjC;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAA;IAE5C;;OAEG;IACH,KAAK,IAAI,IAAI,CAAA;CACd"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Basic Sequential Feed Updater
3
+ *
4
+ * Handles writing updates to sequential feeds by incrementing the index.
5
+ */
6
+ import type { Bee, Stamper } from "@ethersphere/bee-js";
7
+ import { EthAddress, Topic, PrivateKey } from "@ethersphere/bee-js";
8
+ import type { SequentialUpdater } from "./types";
9
+ export declare class BasicSequentialUpdater implements SequentialUpdater {
10
+ private readonly bee;
11
+ private readonly topic;
12
+ private readonly signer;
13
+ private nextIndex;
14
+ constructor(bee: Bee, topic: Topic, signer: PrivateKey);
15
+ update(payload: Uint8Array, stamper: Stamper, encryptionKey?: Uint8Array): Promise<Uint8Array>;
16
+ getOwner(): EthAddress;
17
+ getState(): {
18
+ nextIndex: bigint;
19
+ };
20
+ setState(state: {
21
+ nextIndex: bigint;
22
+ }): void;
23
+ reset(): void;
24
+ private makeIdentifier;
25
+ }
26
+ //# sourceMappingURL=updater.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updater.d.ts","sourceRoot":"","sources":["../../../../src/proxy/feeds/sequence/updater.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAc,MAAM,qBAAqB,CAAA;AAE/E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAEhD,qBAAa,sBAAuB,YAAW,iBAAiB;IAI5D,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,MAAM;IALzB,OAAO,CAAC,SAAS,CAAa;gBAGX,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,UAAU;IAG/B,MAAM,CACV,OAAO,EAAE,UAAU,EACnB,OAAO,EAAE,OAAO,EAChB,aAAa,CAAC,EAAE,UAAU,GACzB,OAAO,CAAC,UAAU,CAAC;IAsBtB,QAAQ,IAAI,UAAU;IAItB,QAAQ,IAAI;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE;IAIjC,QAAQ,CAAC,KAAK,EAAE;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAI5C,KAAK,IAAI,IAAI;IAIb,OAAO,CAAC,cAAc;CAOvB"}
@@ -0,0 +1,6 @@
1
+ export * from "./types";
2
+ export * from "./chunking";
3
+ export * from "./upload-data";
4
+ export * from "./feeds";
5
+ export * from "./act";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/proxy/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,YAAY,CAAA;AAC1B,cAAc,eAAe,CAAA;AAC7B,cAAc,SAAS,CAAA;AACvB,cAAc,OAAO,CAAA"}
@@ -0,0 +1,183 @@
1
+ import { MantarayNode } from "@ethersphere/bee-js";
2
+ /**
3
+ * Result of building a /bzz/-compatible manifest.
4
+ *
5
+ * This is a FLAT manifest with no child nodes - just the root manifest.
6
+ * Bee's /bzz/ endpoint can directly resolve paths from this structure.
7
+ *
8
+ * IMPORTANT: The `data` field contains RAW manifest bytes (without span prefix).
9
+ * When uploaded via `uploadData()`, span will be added and the resulting address
10
+ * will match the pre-computed `address` field.
11
+ */
12
+ export interface BzzCompatibleManifestResult {
13
+ /** The manifest chunk to upload. Raw bytes, no span. */
14
+ manifestChunk: {
15
+ data: Uint8Array;
16
+ address: string;
17
+ };
18
+ }
19
+ /**
20
+ * Build a /bzz/-compatible flat manifest with VALUE forks.
21
+ *
22
+ * Creates a flat manifest with two VALUE forks at root level:
23
+ * - "/" → VALUE fork with website-index-document metadata pointing to NULL
24
+ * - "index.bin" → VALUE fork pointing directly to content reference
25
+ *
26
+ * This is built manually because bee-js MantarayNode always creates EDGE forks
27
+ * with child nodes, which causes Bee to fail to resolve the content.
28
+ *
29
+ * When Bee accesses /bzz/manifest/:
30
+ * 1. Finds "/" fork, reads website-index-document metadata
31
+ * 2. Looks up "index.bin" fork at root level
32
+ * 3. "index.bin" is VALUE type → serves content directly
33
+ *
34
+ * Binary format (Mantaray v0.2):
35
+ * - obfuscationKey (32 bytes): All zeros for no obfuscation
36
+ * - versionHash (31 bytes): MANTARAY_VERSION_HASH
37
+ * - refBytesCount (1 byte): 32
38
+ * - entry (32 bytes): All zeros (root has no entry)
39
+ * - indexBitmap (32 bytes): Bits set for '/' (47) and 'i' (105)
40
+ * - fork1 (64+ bytes): "/" fork with metadata
41
+ * - fork2 (64+ bytes): "index.bin" fork with metadata
42
+ *
43
+ * @param contentReference - Reference to the actual content (32 bytes / 64 hex chars)
44
+ * @returns Single manifest chunk to upload
45
+ */
46
+ export declare function buildBzzCompatibleManifest(contentReference: string | Uint8Array): Promise<BzzCompatibleManifestResult>;
47
+ /**
48
+ * Result of building a /bzz/-compatible MantarayNode manifest.
49
+ */
50
+ export interface BzzManifestNodeResult {
51
+ /** The MantarayNode to be uploaded with saveMantarayTreeRecursively */
52
+ manifestNode: MantarayNode;
53
+ }
54
+ /**
55
+ * Build a /bzz/-compatible manifest as a MantarayNode.
56
+ *
57
+ * This function creates a MantarayNode with the proper structure for /bzz/ access:
58
+ * - "/" fork with website-index-document metadata pointing to "index.bin"
59
+ * - "index.bin" fork pointing to the actual content reference
60
+ *
61
+ * IMPORTANT: After calling this function, use saveMantarayTreeRecursively() to
62
+ * upload the manifest. This ensures all child nodes are uploaded bottom-up and
63
+ * their addresses are correctly set from Bee's responses.
64
+ *
65
+ * Usage:
66
+ * ```typescript
67
+ * const { manifestNode } = buildBzzManifestNode(contentReference)
68
+ * const result = await saveMantarayTreeRecursively(manifestNode, async (data, isRoot) => {
69
+ * const uploadResult = await uploadData(bee, stamper, data, uploadOptions)
70
+ * return { reference: uploadResult.reference }
71
+ * })
72
+ * // result.rootReference is the /bzz/ compatible manifest address
73
+ * ```
74
+ *
75
+ * @param contentReference - Reference to the actual content (32 bytes / 64 hex chars)
76
+ * @returns MantarayNode ready for upload with saveMantarayTreeRecursively
77
+ */
78
+ export declare function buildBzzManifestNode(contentReference: string | Uint8Array): BzzManifestNodeResult;
79
+ /**
80
+ * @deprecated Use buildBzzManifestNode() with saveMantarayTreeRecursively() instead.
81
+ * This function manually builds binary format but doesn't upload child nodes,
82
+ * which causes Bee to fail to resolve content via /bzz/.
83
+ */
84
+ /**
85
+ * @deprecated Use buildBzzCompatibleManifest() for /bzz/ compatibility.
86
+ * This function creates a manifest that won't work with Bee's /bzz/ endpoint
87
+ * because it embeds the content reference directly in the manifest instead
88
+ * of using the proper two-level structure (root → child → content).
89
+ *
90
+ * Build a minimal mantaray manifest for /bzz/ feed compatibility.
91
+ *
92
+ * This creates a manifest with a single "/" fork pointing to a content reference.
93
+ * The manifest is built manually (not using bee-js MantarayNode.marshal()) because
94
+ * bee-js doesn't embed the targetAddress correctly for value-type nodes.
95
+ *
96
+ * Binary format (Mantaray v0.2):
97
+ * - obfuscationKey (32 bytes): All zeros for no obfuscation
98
+ * - versionHash (31 bytes): MANTARAY_VERSION_HASH
99
+ * - refBytesCount (1 byte): 32 (size of entry reference)
100
+ * - entry (32 bytes): All zeros (root has no entry)
101
+ * - indexBitmap (32 bytes): Bitmap with bit 47 set (for '/')
102
+ * - fork (64+ bytes): flags + prefixLen + prefix(30) + reference(32) + metadata
103
+ *
104
+ * @param contentReference - Reference to the actual content (32 bytes / 64 hex chars)
105
+ * @returns Marshaled manifest bytes
106
+ */
107
+ export declare function buildMinimalManifest(contentReference: string | Uint8Array): Uint8Array;
108
+ /**
109
+ * Maximum CAC payload size for /bzz/ compatible feed uploads.
110
+ *
111
+ * For the /chunks endpoint to detect SOC correctly, total SOC size must be > 4104 bytes.
112
+ * SOC structure: identifier(32) + signature(65) + span(8) + payload(N)
113
+ * For N=4096: total = 32 + 65 + 8 + 4096 = 4201 bytes > 4104 ✓
114
+ */
115
+ export declare const MAX_PADDED_PAYLOAD_SIZE = 4096;
116
+ /**
117
+ * Pad payload to 4096 bytes for SOC detection by /chunks endpoint.
118
+ *
119
+ * The span field in the CAC contains the actual payload size (before padding),
120
+ * so Bee's joiner will only read the actual data and ignore padding.
121
+ *
122
+ * @param payload - Original payload (must be <= 4096 bytes)
123
+ * @returns Padded payload (exactly 4096 bytes)
124
+ */
125
+ export declare function padPayloadForSOCDetection(payload: Uint8Array): Uint8Array;
126
+ /**
127
+ * Extract content reference from a minimal mantaray manifest.
128
+ *
129
+ * This is the reverse of buildMinimalManifest() - it parses the manifest
130
+ * binary format and extracts the "/" fork's targetAddress.
131
+ *
132
+ * Binary format (Mantaray v0.2):
133
+ * - Offset 0-31: obfuscationKey
134
+ * - Offset 32-62: versionHash (31 bytes)
135
+ * - Offset 63: refBytesCount
136
+ * - Offset 64-95: entry (refBytesCount bytes, assuming 32)
137
+ * - Offset 96-127: indexBitmap
138
+ * - Offset 128+: forks (flags + prefixLen + prefix + reference + metadata)
139
+ *
140
+ * For a minimal manifest with just "/" fork:
141
+ * - Fork flags at offset 128
142
+ * - Prefix length at offset 129
143
+ * - Prefix (30 bytes) at offset 130
144
+ * - Reference (32 bytes) at offset 160
145
+ *
146
+ * @param manifestData - Raw manifest bytes (from feed payload)
147
+ * @returns Content reference as 64 hex characters
148
+ */
149
+ export declare function extractReferenceFromManifest(manifestData: Uint8Array): string;
150
+ /**
151
+ * Extract entry (targetAddress) from a leaf manifest node.
152
+ *
153
+ * In Mantaray v0.2, leaf nodes store their targetAddress in the entry field
154
+ * (bytes 64-95), not in a fork. This is used for the second level of parsing
155
+ * when using buildBzzCompatibleManifest().
156
+ *
157
+ * Binary format (Mantaray v0.2):
158
+ * - Offset 0-31: obfuscationKey
159
+ * - Offset 32-62: versionHash (31 bytes)
160
+ * - Offset 63: refBytesCount
161
+ * - Offset 64-95: entry (32 bytes) ← targetAddress for leaf nodes
162
+ * - Offset 96-127: indexBitmap
163
+ * - Offset 128+: forks
164
+ *
165
+ * @param manifestData - Raw manifest bytes (child chunk data from two-level structure)
166
+ * @returns Content reference as 64 hex characters
167
+ */
168
+ export declare function extractEntryFromManifest(manifestData: Uint8Array): string;
169
+ /**
170
+ * Extract content reference from a flat /bzz/-compatible manifest.
171
+ *
172
+ * In the flat structure, the manifest has:
173
+ * - "/" fork with NULL_ADDRESS and website-index-document metadata
174
+ * - "index.bin" fork with VALUE type pointing to content reference
175
+ *
176
+ * This function looks for the "index.bin" fork ('i' = ASCII 105) and
177
+ * extracts its reference.
178
+ *
179
+ * @param manifestData - Raw manifest bytes (flat manifest)
180
+ * @returns Content reference as 64 hex characters
181
+ */
182
+ export declare function extractContentFromFlatManifest(manifestData: Uint8Array): string;
183
+ //# sourceMappingURL=manifest-builder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest-builder.d.ts","sourceRoot":"","sources":["../../src/proxy/manifest-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,YAAY,EAAgB,MAAM,qBAAqB,CAAA;AAoB3E;;;;;;;;;GASG;AACH,MAAM,WAAW,2BAA2B;IAC1C,wDAAwD;IACxD,aAAa,EAAE;QACb,IAAI,EAAE,UAAU,CAAA;QAChB,OAAO,EAAE,MAAM,CAAA;KAChB,CAAA;CACF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAsB,0BAA0B,CAC9C,gBAAgB,EAAE,MAAM,GAAG,UAAU,GACpC,OAAO,CAAC,2BAA2B,CAAC,CAgItC;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,uEAAuE;IACvE,YAAY,EAAE,YAAY,CAAA;CAC3B;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,oBAAoB,CAClC,gBAAgB,EAAE,MAAM,GAAG,UAAU,GACpC,qBAAqB,CA2BvB;AAED;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,oBAAoB,CAClC,gBAAgB,EAAE,MAAM,GAAG,UAAU,GACpC,UAAU,CA8DZ;AAED;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,OAAO,CAAA;AAE3C;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,UAAU,GAAG,UAAU,CAgBzE;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,4BAA4B,CAAC,YAAY,EAAE,UAAU,GAAG,MAAM,CAoG7E;AAwBD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,wBAAwB,CAAC,YAAY,EAAE,UAAU,GAAG,MAAM,CAiBzE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,8BAA8B,CAC5C,YAAY,EAAE,UAAU,GACvB,MAAM,CAwFR"}
@@ -0,0 +1,27 @@
1
+ import type { MantarayNode } from "@ethersphere/bee-js";
2
+ /**
3
+ * Upload callback type for saveMantarayTreeRecursivelyEncrypted
4
+ *
5
+ * @param encryptedData - The encrypted chunk data to upload
6
+ * @param address - The 32-byte address of the encrypted chunk
7
+ * @param isRoot - Whether this is the root node
8
+ * @returns Upload result with optional tag UID
9
+ */
10
+ export type EncryptedUploadCallback = (encryptedData: Uint8Array, address: Uint8Array, isRoot: boolean) => Promise<{
11
+ tagUid?: number;
12
+ }>;
13
+ /**
14
+ * Save a Mantaray tree with encryption by uploading bottom-up
15
+ *
16
+ * This mirrors saveMantarayTreeRecursively but encrypts each manifest node
17
+ * and creates 64-byte encrypted references (address + encryption key).
18
+ *
19
+ * @param node - Root Mantaray node to save
20
+ * @param uploadFn - Callback to upload each encrypted chunk
21
+ * @returns Root reference (128 hex chars = 64 bytes) and optional tag UID
22
+ */
23
+ export declare function saveMantarayTreeRecursivelyEncrypted(node: MantarayNode, uploadFn: EncryptedUploadCallback): Promise<{
24
+ rootReference: string;
25
+ tagUid?: number;
26
+ }>;
27
+ //# sourceMappingURL=mantaray-encrypted.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mantaray-encrypted.d.ts","sourceRoot":"","sources":["../../src/proxy/mantaray-encrypted.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAOvD;;;;;;;GAOG;AACH,MAAM,MAAM,uBAAuB,GAAG,CACpC,aAAa,EAAE,UAAU,EACzB,OAAO,EAAE,UAAU,EACnB,MAAM,EAAE,OAAO,KACZ,OAAO,CAAC;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAAA;AAEjC;;;;;;;;;GASG;AACH,wBAAsB,oCAAoC,CACxD,IAAI,EAAE,YAAY,EAClB,QAAQ,EAAE,uBAAuB,GAChC,OAAO,CAAC;IAAE,aAAa,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CA2CrD"}
@@ -0,0 +1,26 @@
1
+ import { MantarayNode } from "@ethersphere/bee-js";
2
+ import type { Bee, BeeRequestOptions } from "@ethersphere/bee-js";
3
+ /**
4
+ * Upload callback type for saveMantarayTreeRecursively
5
+ */
6
+ export type UploadCallback = (data: Uint8Array, isRoot: boolean) => Promise<{
7
+ reference: string;
8
+ tagUid?: number;
9
+ }>;
10
+ /**
11
+ * Save a Mantaray tree by uploading bottom-up
12
+ *
13
+ * This mirrors MantarayNode.saveRecursively() but allows custom upload logic
14
+ * and uses Bee's returned references to avoid address mismatches.
15
+ */
16
+ export declare function saveMantarayTreeRecursively(node: MantarayNode, uploadFn: UploadCallback): Promise<{
17
+ rootReference: string;
18
+ tagUid?: number;
19
+ }>;
20
+ /**
21
+ * Load a Mantaray tree using only the chunk API.
22
+ *
23
+ * This avoids /bytes and supports encrypted references.
24
+ */
25
+ export declare function loadMantarayTreeWithChunkAPI(bee: Bee, rootReference: string, requestOptions?: BeeRequestOptions): Promise<MantarayNode>;
26
+ //# sourceMappingURL=mantaray.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mantaray.d.ts","sourceRoot":"","sources":["../../src/proxy/mantaray.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,KAAK,EAAE,GAAG,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAIjE;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,CAC3B,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,OAAO,KACZ,OAAO,CAAC;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAAA;AAEpD;;;;;GAKG;AACH,wBAAsB,2BAA2B,CAC/C,IAAI,EAAE,YAAY,EAClB,QAAQ,EAAE,cAAc,GACvB,OAAO,CAAC;IAAE,aAAa,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAsBrD;AAED;;;;GAIG;AACH,wBAAsB,4BAA4B,CAChD,GAAG,EAAE,GAAG,EACR,aAAa,EAAE,MAAM,EACrB,cAAc,CAAC,EAAE,iBAAiB,GACjC,OAAO,CAAC,YAAY,CAAC,CAgDvB"}
@@ -0,0 +1,29 @@
1
+ import type { Bee, Stamper } from "@ethersphere/bee-js";
2
+ /**
3
+ * Upload context shared across handlers
4
+ */
5
+ export interface UploadContext {
6
+ bee: Bee;
7
+ stamper: Stamper;
8
+ }
9
+ /**
10
+ * Upload progress information
11
+ */
12
+ export interface UploadProgress {
13
+ total: number;
14
+ processed: number;
15
+ }
16
+ /**
17
+ * Chunk reference (32-byte address)
18
+ */
19
+ export interface ChunkReference {
20
+ address: Uint8Array;
21
+ }
22
+ /**
23
+ * Encrypted chunk reference (64-byte reference: address + encryption key)
24
+ */
25
+ export interface EncryptedChunkReference {
26
+ address: Uint8Array;
27
+ key: Uint8Array;
28
+ }
29
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/proxy/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAEvD;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,GAAG,CAAA;IACR,OAAO,EAAE,OAAO,CAAA;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,EAAE,MAAM,CAAA;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,UAAU,CAAA;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,UAAU,CAAA;IACnB,GAAG,EAAE,UAAU,CAAA;CAChB"}
@@ -0,0 +1,17 @@
1
+ import type { Bee, BeeRequestOptions, Stamper, UploadOptions, UploadResult } from "@ethersphere/bee-js";
2
+ import { type ContentAddressedChunk } from "../chunk";
3
+ import type { UploadContext, UploadProgress } from "./types";
4
+ /**
5
+ * Upload data with client-side signing
6
+ * Handles chunking, merkle tree building, and progress reporting
7
+ */
8
+ export declare function uploadDataWithSigning(context: UploadContext, data: Uint8Array, options?: UploadOptions, onProgress?: (progress: UploadProgress) => void, requestOptions?: BeeRequestOptions): Promise<{
9
+ reference: string;
10
+ tagUid?: number;
11
+ }>;
12
+ /**
13
+ * Upload a single chunk with optional signing
14
+ * Returns UploadResult with Bee's actual stored reference for verification
15
+ */
16
+ export declare function uploadSingleChunk(bee: Bee, stamper: Stamper | undefined, chunk: ContentAddressedChunk, options?: UploadOptions, requestOptions?: BeeRequestOptions): Promise<UploadResult>;
17
+ //# sourceMappingURL=upload-data.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upload-data.d.ts","sourceRoot":"","sources":["../../src/proxy/upload-data.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,GAAG,EACH,iBAAiB,EACjB,OAAO,EACP,aAAa,EACb,YAAY,EACb,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAA6B,KAAK,qBAAqB,EAAE,MAAM,UAAU,CAAA;AAEhF,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAkB,MAAM,SAAS,CAAA;AA4C5E;;;GAGG;AACH,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,aAAa,EACtB,IAAI,EAAE,UAAU,EAChB,OAAO,CAAC,EAAE,aAAa,EACvB,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,cAAc,KAAK,IAAI,EAC/C,cAAc,CAAC,EAAE,iBAAiB,GACjC,OAAO,CAAC;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAmFjD;AAED;;;GAGG;AACH,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,GAAG,EACR,OAAO,EAAE,OAAO,GAAG,SAAS,EAC5B,KAAK,EAAE,qBAAqB,EAC5B,OAAO,CAAC,EAAE,aAAa,EACvB,cAAc,CAAC,EAAE,iBAAiB,GACjC,OAAO,CAAC,YAAY,CAAC,CA6BvB"}
@@ -0,0 +1,103 @@
1
+ import { PrivateKey, Identifier } from "@ethersphere/bee-js";
2
+ import type { Bee, BeeRequestOptions, Stamper, UploadOptions } from "@ethersphere/bee-js";
3
+ import { type EncryptedChunk } from "../chunk";
4
+ import type { UploadContext, UploadProgress } from "./types";
5
+ /**
6
+ * Result of uploading encrypted data
7
+ */
8
+ export interface UploadEncryptedDataResult {
9
+ reference: string;
10
+ tagUid?: number;
11
+ chunkAddresses: Uint8Array[];
12
+ }
13
+ /**
14
+ * Upload encrypted data with client-side signing
15
+ * Handles chunking, encryption, merkle tree building, and progress reporting
16
+ *
17
+ * @param context - Upload context with bee instance and authentication
18
+ * @param data - Data to encrypt and upload
19
+ * @param encryptionKey - Optional 32-byte encryption key (generates random if not provided)
20
+ * @param options - Upload options
21
+ * @param onProgress - Progress callback
22
+ */
23
+ export declare function uploadEncryptedDataWithSigning(context: UploadContext, data: Uint8Array, encryptionKey?: Uint8Array, options?: UploadOptions, onProgress?: (progress: UploadProgress) => void, requestOptions?: BeeRequestOptions): Promise<UploadEncryptedDataResult>;
24
+ /**
25
+ * Upload a single encrypted chunk with optional signing
26
+ */
27
+ export declare function uploadSingleEncryptedChunk(bee: Bee, stamper: Stamper, encryptedChunk: EncryptedChunk, options?: UploadOptions, requestOptions?: BeeRequestOptions): Promise<void>;
28
+ /**
29
+ * Upload a single encrypted chunk with optional signing
30
+ *
31
+ * This is the unified interface for uploading encrypted chunks.
32
+ * Use this instead of direct Bee API calls with fetch.
33
+ *
34
+ * @param bee - Bee client instance
35
+ * @param stamper - Stamper for client-side signing
36
+ * @param payload - Raw chunk data to encrypt and upload (1-4096 bytes)
37
+ * @param encryptionKey - Encryption key (32 bytes)
38
+ * @param options - Upload options (deferred, tag, etc.)
39
+ */
40
+ export declare function uploadSingleChunkWithEncryption(bee: Bee, stamper: Stamper, payload: Uint8Array, encryptionKey: Uint8Array, options?: UploadOptions): Promise<void>;
41
+ /**
42
+ * Result of uploading an encrypted SOC
43
+ */
44
+ export interface UploadEncryptedSOCResult {
45
+ socAddress: Uint8Array;
46
+ encryptionKey: Uint8Array;
47
+ tagUid?: number;
48
+ }
49
+ /**
50
+ * Result of uploading a SOC
51
+ */
52
+ export interface UploadSOCResult {
53
+ socAddress: Uint8Array;
54
+ tagUid?: number;
55
+ }
56
+ /**
57
+ * Upload an encrypted Single Owner Chunk (SOC) using the fast chunk upload path
58
+ *
59
+ * This function constructs an encrypted SOC manually and uploads it via the regular
60
+ * /chunks endpoint for better performance compared to the /soc endpoint.
61
+ *
62
+ * SOC Structure (Book of Swarm 2.2.3, 2.2.4):
63
+ * - 32 bytes: identifier
64
+ * - 65 bytes: signature (r, s, v)
65
+ * - 8 bytes: span (from encrypted CAC)
66
+ * - up to 4096 bytes: encrypted payload (from encrypted CAC)
67
+ *
68
+ * The signature signs: hash(identifier + encrypted_CAC.address)
69
+ * SOC address: Keccak256(identifier + owner_address)
70
+ *
71
+ * @param bee - Bee client instance
72
+ * @param stamper - Stamper for client-side signing
73
+ * @param signer - SOC owner's private key
74
+ * @param identifier - 32-byte SOC identifier
75
+ * @param data - Payload data (1-4096 bytes)
76
+ * @param encryptionKey - Optional 32-byte encryption key (random if not provided)
77
+ * @param options - Upload options (tag, deferred, etc.)
78
+ * @returns SOC address, encryption key, and optional tag UID
79
+ */
80
+ export declare function uploadEncryptedSOC(bee: Bee, stamper: Stamper, signer: PrivateKey, identifier: Identifier, data: Uint8Array, encryptionKey?: Uint8Array, options?: UploadOptions): Promise<UploadEncryptedSOCResult>;
81
+ /**
82
+ * Upload a plain Single Owner Chunk (SOC) using the fast chunk upload path
83
+ *
84
+ * This constructs an unencrypted SOC and uploads it via /chunks to avoid /soc size limits.
85
+ */
86
+ export declare function uploadSOC(bee: Bee, stamper: Stamper, signer: PrivateKey, identifier: Identifier, data: Uint8Array, options?: UploadOptions): Promise<UploadSOCResult>;
87
+ /**
88
+ * Upload SOC via the /soc/{owner}/{id} endpoint.
89
+ *
90
+ * Use this for small SOCs (< 4104 bytes) that need to preserve exact CAC size,
91
+ * such as v1 format feeds for /bzz/ compatibility.
92
+ *
93
+ * The /soc endpoint explicitly handles SOC uploads without size-based detection,
94
+ * avoiding "stamp signature is invalid" errors for small SOCs that would be
95
+ * misidentified as CAC by the /chunks endpoint.
96
+ *
97
+ * Key differences from uploadSOC:
98
+ * - Uses /soc/{owner}/{id}?sig=... endpoint (explicit SOC handling)
99
+ * - Does NOT pad CAC data (preserves exact payload size for v1 format)
100
+ * - Stamps using CAC address (what /soc endpoint expects)
101
+ */
102
+ export declare function uploadSOCViaSocEndpoint(bee: Bee, stamper: Stamper, signer: PrivateKey, identifier: Identifier, data: Uint8Array, options?: UploadOptions): Promise<UploadSOCResult>;
103
+ //# sourceMappingURL=upload-encrypted-data.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upload-encrypted-data.d.ts","sourceRoot":"","sources":["../../src/proxy/upload-encrypted-data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AACvE,OAAO,KAAK,EACV,GAAG,EACH,iBAAiB,EACjB,OAAO,EACP,aAAa,EAEd,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAIL,KAAK,cAAc,EACpB,MAAM,UAAU,CAAA;AAIjB,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAE5D;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,cAAc,EAAE,UAAU,EAAE,CAAA;CAC7B;AA4CD;;;;;;;;;GASG;AACH,wBAAsB,8BAA8B,CAClD,OAAO,EAAE,aAAa,EACtB,IAAI,EAAE,UAAU,EAChB,aAAa,CAAC,EAAE,UAAU,EAC1B,OAAO,CAAC,EAAE,aAAa,EACvB,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,cAAc,KAAK,IAAI,EAC/C,cAAc,CAAC,EAAE,iBAAiB,GACjC,OAAO,CAAC,yBAAyB,CAAC,CAqIpC;AAED;;GAEG;AACH,wBAAsB,0BAA0B,CAC9C,GAAG,EAAE,GAAG,EACR,OAAO,EAAE,OAAO,EAChB,cAAc,EAAE,cAAc,EAC9B,OAAO,CAAC,EAAE,aAAa,EACvB,cAAc,CAAC,EAAE,iBAAiB,GACjC,OAAO,CAAC,IAAI,CAAC,CAWf;AAmBD;;;;;;;;;;;GAWG;AACH,wBAAsB,+BAA+B,CACnD,GAAG,EAAE,GAAG,EACR,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,UAAU,EACnB,aAAa,EAAE,UAAU,EACzB,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CAAC,IAAI,CAAC,CAuBf;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,UAAU,EAAE,UAAU,CAAA;IACtB,aAAa,EAAE,UAAU,CAAA;IACzB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,UAAU,CAAA;IACtB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAgFD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,kBAAkB,CACtC,GAAG,EAAE,GAAG,EACR,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,UAAU,EAClB,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,UAAU,EAChB,aAAa,CAAC,EAAE,UAAU,EAC1B,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CAAC,wBAAwB,CAAC,CAwDnC;AAED;;;;GAIG;AACH,wBAAsB,SAAS,CAC7B,GAAG,EAAE,GAAG,EACR,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,UAAU,EAClB,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,UAAU,EAChB,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CAAC,eAAe,CAAC,CA+C1B;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,uBAAuB,CAC3C,GAAG,EAAE,GAAG,EACR,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,UAAU,EAClB,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,UAAU,EAChB,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CAAC,eAAe,CAAC,CAqF1B"}