@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,46 @@
1
+ /**
2
+ * Swarm ID Library
3
+ *
4
+ * A TypeScript library for integrating Swarm ID authentication
5
+ * and Bee API operations into dApps.
6
+ */
7
+ export { SwarmIdClient } from "./swarm-id-client";
8
+ export { SwarmIdProxy, initProxy } from "./swarm-id-proxy";
9
+ export { deriveSecret, deriveIdentityKey, generateMasterKey, hexToUint8Array, uint8ArrayToHex, verifySecret, utils, } from "./utils/key-derivation";
10
+ export { hexAddress } from "./utils/hex";
11
+ export { initializeBatchUtilization, calculateUtilizationUpdate, updateAfterWrite, saveUtilizationState, loadUtilizationState, calculateUtilization, toBucket, assignChunksToBuckets, serializeUint32Array, deserializeUint32Array, splitIntoChunks, reconstructFromChunks, calculateMaxSlotsPerBucket, hasBucketCapacity, createStamper, prepareBucketState, UtilizationAwareStamper, NUM_BUCKETS, BUCKET_DEPTH, UTILIZATION_SLOTS_PER_BUCKET, DATA_COUNTER_START, CHUNK_SIZE, DEFAULT_BATCH_DEPTH, } from "./utils/batch-utilization";
12
+ export { UtilizationStoreDB, evictOldEntries, calculateContentHash, } from "./storage/utilization-store";
13
+ export type { ChunkCacheEntry, BatchMetadata, CacheEvictionPolicy, } from "./storage/utilization-store";
14
+ export { DebouncedUtilizationUploader } from "./storage/debounced-uploader";
15
+ export { VersionedStorageManager, LocalStorageAdapter, MemoryStorageAdapter, createLocalStorageManager, createMemoryStorageManager, createZodParser, VersionedStorageSchema, } from "./utils/versioned-storage";
16
+ export { createAccountsStorageManager, createIdentitiesStorageManager, createConnectedAppsStorageManager, createPostageStampsStorageManager, createNetworkSettingsStorageManager, serializeAccount, serializeIdentity, serializeConnectedApp, serializePostageStamp, serializeNetworkSettings, disconnectApp, } from "./utils/storage-managers";
17
+ export type { NetworkSettingsStorageManager } from "./utils/storage-managers";
18
+ export { serializeAccountStateSnapshot, deserializeAccountStateSnapshot, AccountStateSnapshotSchemaV1, } from "./utils/account-state-snapshot";
19
+ export type { AccountStateSnapshot, AccountStateSnapshotResult, } from "./utils/account-state-snapshot";
20
+ export { deriveBackupEncryptionKey, encryptBackupPayload, decryptBackupPayload, buildBackupHeader, createEncryptedExport, decryptEncryptedExport, parseEncryptedExportHeader, PasskeyBackupHeaderSchemaV1, EthereumBackupHeaderSchemaV1, AgentBackupHeaderSchemaV1, EncryptedSwarmIdExportSchemaV1, } from "./utils/backup-encryption";
21
+ export type { PasskeyBackupHeader, EthereumBackupHeader, AgentBackupHeader, EncryptedSwarmIdExport, BackupHeaderWithoutCiphertext, ParseHeaderResult, } from "./utils/backup-encryption";
22
+ export { EpochIndex, SyncEpochFinder, AsyncEpochFinder, BasicEpochUpdater, lca, next, createSyncEpochFinder, createAsyncEpochFinder, createEpochUpdater, createEpochFinder, // deprecated alias for createSyncEpochFinder
23
+ MAX_LEVEL, } from "./proxy/feeds/epochs";
24
+ export { deriveAccountBackupKey, deriveAccountSwarmEncryptionKey, backupKeyToPrivateKey, serializeAccountState, deserializeAccountState, createSyncAccount, ACCOUNT_SYNC_TOPIC_PREFIX, restoreAccountFromSwarm, } from "./sync";
25
+ export type { SyncResult, SyncAccountOptions, SyncAccountFunction, AccountsStoreInterface, IdentitiesStoreInterface, ConnectedAppsStoreInterface, PostageStampsStoreInterface, StamperOptions, FlushableStamper, RestoreAccountResult, } from "./sync";
26
+ export type { ClientOptions, AuthStatus, ButtonStyles, UploadResult, FileData, PostageBatch, UploadOptions, ActUploadOptions, SOCReader, SOCWriter, SingleOwnerChunk, SocUploadResult, SocRawUploadResult, FeedReaderOptions, FeedWriterOptions, FeedReader, FeedWriter, SequentialFeedReaderOptions, SequentialFeedWriterOptions, SequentialFeedUpdateOptions, SequentialFeedUploadOptions, SequentialFeedPayloadResult, SequentialFeedReferenceResult, SequentialFeedUploadResult, SequentialFeedReader, SequentialFeedWriter, UploadProgress, RequestOptions, DownloadOptions, ParentToIframeMessage, IframeToParentMessage, PopupToIframeMessage, SetSecretMessage, AuthData, AppMetadata, ButtonConfig, ConnectionInfo, ActUploadDataMessage, ActDownloadDataMessage, ActAddGranteesMessage, ActRevokeGranteesMessage, ActGetGranteesMessage, ActUploadDataResponseMessage, ActDownloadDataResponseMessage, ActAddGranteesResponseMessage, ActRevokeGranteesResponseMessage, ActGetGranteesResponseMessage, SocUploadMessage, SocRawUploadMessage, SocDownloadMessage, SocRawDownloadMessage, SocGetOwnerMessage, EpochFeedDownloadReferenceMessage, EpochFeedUploadReferenceMessage, FeedGetOwnerMessage, SequentialFeedGetOwnerMessage, SequentialFeedDownloadPayloadMessage, SequentialFeedDownloadRawPayloadMessage, SequentialFeedDownloadReferenceMessage, SequentialFeedUploadPayloadMessage, SequentialFeedUploadRawPayloadMessage, SequentialFeedUploadReferenceMessage, SocUploadResponseMessage, SocRawUploadResponseMessage, SocDownloadResponseMessage, SocRawDownloadResponseMessage, SocGetOwnerResponseMessage, EpochFeedDownloadReferenceResponseMessage, EpochFeedUploadReferenceResponseMessage, FeedGetOwnerResponseMessage, SequentialFeedGetOwnerResponseMessage, SequentialFeedDownloadPayloadResponseMessage, SequentialFeedDownloadRawPayloadResponseMessage, SequentialFeedDownloadReferenceResponseMessage, SequentialFeedUploadPayloadResponseMessage, SequentialFeedUploadRawPayloadResponseMessage, SequentialFeedUploadReferenceResponseMessage, } from "./types";
27
+ export type { Account, PasskeyAccount, EthereumAccount, AgentAccount, Identity, ConnectedApp, PostageStamp, AccountMetadata, NetworkSettings, } from "./schemas";
28
+ export { DEFAULT_BEE_NODE_URL, DEFAULT_GNOSIS_RPC_URL, NetworkSettingsSchemaV1, } from "./schemas";
29
+ export { ReferenceSchema, BatchIdSchema, AddressSchema, PrivateKeySchema, EncryptionKeySchema, IdentifierSchema, SignatureSchema, TimestampSchema, FeedIndexSchema, } from "./schemas";
30
+ export type { Reference, BatchId, Address, PrivateKey, Identifier, Signature, Timestamp, FeedIndex, } from "./schemas";
31
+ export type { BatchUtilizationState, ChunkWithBucket, UtilizationUpdate, } from "./utils/batch-utilization";
32
+ export type { VersionedStorage, StorageAdapter, VersionParser, Serializer, VersionedStorageOptions, } from "./utils/versioned-storage";
33
+ export type { Epoch, EpochFinder, EpochUpdater, EpochFeedOptions, EpochFeedWriterOptions, EpochLookupResult, } from "./proxy/feeds/epochs";
34
+ export { UploadOptionsSchema, ActUploadOptionsSchema, RequestOptionsSchema, DownloadOptionsSchema, UploadResultSchema, FileDataSchema, PostageBatchSchema, AuthStatusSchema, ButtonStylesSchema, ParentToIframeMessageSchema, IframeToParentMessageSchema, PopupToIframeMessageSchema, SetSecretMessageSchema, AuthDataSchema, ActUploadDataMessageSchema, ActDownloadDataMessageSchema, ActAddGranteesMessageSchema, ActRevokeGranteesMessageSchema, ActGetGranteesMessageSchema, ActUploadDataResponseMessageSchema, ActDownloadDataResponseMessageSchema, ActAddGranteesResponseMessageSchema, ActRevokeGranteesResponseMessageSchema, ActGetGranteesResponseMessageSchema, } from "./types";
35
+ export { downloadDataWithChunkAPI } from "./proxy/download-data";
36
+ export { createActForContent, decryptActReference, addGranteesToAct, revokeGranteesFromAct, getGranteesFromAct, parseCompressedPublicKey, publicKeyFromPrivate, compressPublicKey, publicKeyFromCompressed, } from "./proxy/act";
37
+ export type { ActEntry } from "./proxy/act";
38
+ export { SWARM_SECRET_PREFIX, STORAGE_CHALLENGE_KEY } from "./types";
39
+ export { buildAuthUrl } from "./utils/url";
40
+ export { buildBzzCompatibleManifest, buildBzzManifestNode, buildMinimalManifest, extractReferenceFromManifest, extractEntryFromManifest, extractContentFromFlatManifest, padPayloadForSOCDetection, MAX_PADDED_PAYLOAD_SIZE, } from "./proxy/manifest-builder";
41
+ export type { BzzCompatibleManifestResult, BzzManifestNodeResult, } from "./proxy/manifest-builder";
42
+ export { saveMantarayTreeRecursively, loadMantarayTreeWithChunkAPI, } from "./proxy/mantaray";
43
+ export type { UploadCallback } from "./proxy/mantaray";
44
+ export { SECOND, MINUTE, HOUR, DAY, DEFAULT_SESSION_DURATION, } from "./utils/constants";
45
+ export { calculateTTLSeconds, formatTTL, getBlockTimestamp, calculateExpiryTimestamp, fetchSwarmPrice, SWARMSCAN_STATS_URL, GNOSIS_BLOCK_TIME, } from "./utils/ttl";
46
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAGjD,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAG1D,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,YAAY,EACZ,KAAK,GACN,MAAM,wBAAwB,CAAA;AAG/B,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAGxC,OAAO,EACL,0BAA0B,EAC1B,0BAA0B,EAC1B,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,QAAQ,EACR,qBAAqB,EACrB,oBAAoB,EACpB,sBAAsB,EACtB,eAAe,EACf,qBAAqB,EACrB,0BAA0B,EAC1B,iBAAiB,EACjB,aAAa,EACb,kBAAkB,EAClB,uBAAuB,EACvB,WAAW,EACX,YAAY,EACZ,4BAA4B,EAC5B,kBAAkB,EAClB,UAAU,EACV,mBAAmB,GACpB,MAAM,2BAA2B,CAAA;AAGlC,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,oBAAoB,GACrB,MAAM,6BAA6B,CAAA;AAEpC,YAAY,EACV,eAAe,EACf,aAAa,EACb,mBAAmB,GACpB,MAAM,6BAA6B,CAAA;AAGpC,OAAO,EAAE,4BAA4B,EAAE,MAAM,8BAA8B,CAAA;AAG3E,OAAO,EACL,uBAAuB,EACvB,mBAAmB,EACnB,oBAAoB,EACpB,yBAAyB,EACzB,0BAA0B,EAC1B,eAAe,EACf,sBAAsB,GACvB,MAAM,2BAA2B,CAAA;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,EACxB,oBAAoB,EACpB,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,aAAa,CAAA;AAEpB,YAAY,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAG3C,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAGpE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAG1C,OAAO,EACL,0BAA0B,EAC1B,oBAAoB,EACpB,oBAAoB,EACpB,4BAA4B,EAC5B,wBAAwB,EACxB,8BAA8B,EAC9B,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,0BAA0B,CAAA;AAEjC,YAAY,EACV,2BAA2B,EAC3B,qBAAqB,GACtB,MAAM,0BAA0B,CAAA;AAGjC,OAAO,EACL,2BAA2B,EAC3B,4BAA4B,GAC7B,MAAM,kBAAkB,CAAA;AAEzB,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAGtD,OAAO,EACL,MAAM,EACN,MAAM,EACN,IAAI,EACJ,GAAG,EACH,wBAAwB,GACzB,MAAM,mBAAmB,CAAA;AAG1B,OAAO,EACL,mBAAmB,EACnB,SAAS,EACT,iBAAiB,EACjB,wBAAwB,EACxB,eAAe,EACf,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,aAAa,CAAA"}
@@ -0,0 +1,78 @@
1
+ /**
2
+ * ACT (Access Control Tries) Data Structure
3
+ *
4
+ * Bee-compatible Simple Manifest (JSON) format for storing ACT entries.
5
+ * The ACT stores lookup key -> encrypted access key mappings.
6
+ *
7
+ * Bee's ACT format is a Simple Manifest with structure:
8
+ * {
9
+ * "entries": {
10
+ * "<lookupKeyHex>": {
11
+ * "reference": "<encryptedAccessKeyHex>",
12
+ * "metadata": {}
13
+ * }
14
+ * }
15
+ * }
16
+ *
17
+ * All other data (publisher public key, encrypted reference, grantee list)
18
+ * is stored separately and passed out-of-band.
19
+ */
20
+ /**
21
+ * Single ACT entry: lookup key + encrypted access key
22
+ */
23
+ export interface ActEntry {
24
+ lookupKey: Uint8Array;
25
+ encryptedAccessKey: Uint8Array;
26
+ }
27
+ /**
28
+ * Serialize ACT entries to JSON bytes (Bee-compatible Simple Manifest format)
29
+ *
30
+ * @param entries - Array of ACT entries
31
+ * @returns JSON-encoded bytes
32
+ */
33
+ export declare function serializeAct(entries: ActEntry[]): Uint8Array;
34
+ /**
35
+ * Deserialize ACT entries from JSON bytes (Bee-compatible Simple Manifest format)
36
+ *
37
+ * @param data - JSON-encoded bytes
38
+ * @returns Array of ACT entries
39
+ */
40
+ export declare function deserializeAct(data: Uint8Array): ActEntry[];
41
+ /**
42
+ * Find an ACT entry by lookup key
43
+ *
44
+ * @param entries - Array of ACT entries
45
+ * @param lookupKey - 32-byte lookup key
46
+ * @returns The entry if found, undefined otherwise
47
+ */
48
+ export declare function findEntryByLookupKey(entries: ActEntry[], lookupKey: Uint8Array): ActEntry | undefined;
49
+ /**
50
+ * Check if two public keys are equal
51
+ */
52
+ export declare function publicKeysEqual(a: {
53
+ x: Uint8Array;
54
+ y: Uint8Array;
55
+ }, b: {
56
+ x: Uint8Array;
57
+ y: Uint8Array;
58
+ }): boolean;
59
+ /**
60
+ * Helper to collect all ACT entries from JSON-encoded ACT data
61
+ *
62
+ * This is a convenience function for working with JSON ACT data directly from storage.
63
+ *
64
+ * @param actData - JSON-encoded ACT data from storage
65
+ * @returns Array of ACT entries
66
+ */
67
+ export declare function collectActEntriesFromJson(actData: Uint8Array): ActEntry[];
68
+ /**
69
+ * Helper to find an ACT entry by lookup key from JSON-encoded ACT data
70
+ *
71
+ * This is a convenience function for working with JSON ACT data directly from storage.
72
+ *
73
+ * @param actData - JSON-encoded ACT data from storage
74
+ * @param lookupKey - 32-byte lookup key to search for
75
+ * @returns The encrypted access key if found, undefined otherwise
76
+ */
77
+ export declare function findActEntryByKey(actData: Uint8Array, lookupKey: Uint8Array): Uint8Array | undefined;
78
+ //# sourceMappingURL=act.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"act.d.ts","sourceRoot":"","sources":["../../../src/proxy/act/act.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,SAAS,EAAE,UAAU,CAAA;IACrB,kBAAkB,EAAE,UAAU,CAAA;CAC/B;AAiBD;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,QAAQ,EAAE,GAAG,UAAU,CAiB5D;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,UAAU,GAAG,QAAQ,EAAE,CAc3D;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,QAAQ,EAAE,EACnB,SAAS,EAAE,UAAU,GACpB,QAAQ,GAAG,SAAS,CAQtB;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,CAAC,EAAE;IAAE,CAAC,EAAE,UAAU,CAAC;IAAC,CAAC,EAAE,UAAU,CAAA;CAAE,EACnC,CAAC,EAAE;IAAE,CAAC,EAAE,UAAU,CAAC;IAAC,CAAC,EAAE,UAAU,CAAA;CAAE,GAClC,OAAO,CAST;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,UAAU,GAAG,QAAQ,EAAE,CAEzE;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,UAAU,EACnB,SAAS,EAAE,UAAU,GACpB,UAAU,GAAG,SAAS,CAIxB"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Derive public key from private key
3
+ */
4
+ export declare function publicKeyFromPrivate(privKey: Uint8Array): {
5
+ x: Uint8Array;
6
+ y: Uint8Array;
7
+ };
8
+ /**
9
+ * Compute ECDH shared secret (x-coordinate of shared point)
10
+ */
11
+ export declare function ecdhSharedSecret(privKey: Uint8Array, pubX: Uint8Array, pubY: Uint8Array): Uint8Array;
12
+ /**
13
+ * Derive lookup key and access key decryption key from ECDH shared secret
14
+ */
15
+ export declare function deriveKeys(privKey: Uint8Array, pubX: Uint8Array, pubY: Uint8Array): {
16
+ lookupKey: Uint8Array;
17
+ accessKeyDecryptionKey: Uint8Array;
18
+ };
19
+ /**
20
+ * Counter-mode encryption/decryption
21
+ * Matches Bee's Go implementation (bee/pkg/encryption/encryption.go:134-168)
22
+ * For each 32-byte block i: data[i] XOR keccak256(keccak256(key || uint32LE(i)))
23
+ */
24
+ export declare function counterModeEncrypt(data: Uint8Array, key: Uint8Array): Uint8Array;
25
+ /**
26
+ * Counter-mode decryption (symmetric with encryption)
27
+ */
28
+ export declare const counterModeDecrypt: typeof counterModeEncrypt;
29
+ /**
30
+ * Parse compressed public key (33 bytes) to uncompressed coordinates
31
+ */
32
+ export declare function publicKeyFromCompressed(compressed: Uint8Array): {
33
+ x: Uint8Array;
34
+ y: Uint8Array;
35
+ };
36
+ /**
37
+ * Compress public key to 33 bytes
38
+ */
39
+ export declare function compressPublicKey(x: Uint8Array, y: Uint8Array): Uint8Array;
40
+ /**
41
+ * Generate a random 32-byte key using crypto.getRandomValues
42
+ */
43
+ export declare function generateRandomKey(): Uint8Array;
44
+ //# sourceMappingURL=crypto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../../../src/proxy/act/crypto.ts"],"names":[],"mappings":"AA2JA;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,UAAU,GAAG;IACzD,CAAC,EAAE,UAAU,CAAA;IACb,CAAC,EAAE,UAAU,CAAA;CACd,CAgBA;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,UAAU,EACnB,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,UAAU,GACf,UAAU,CAuBZ;AAED;;GAEG;AACH,wBAAgB,UAAU,CACxB,OAAO,EAAE,UAAU,EACnB,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,UAAU,GACf;IAAE,SAAS,EAAE,UAAU,CAAC;IAAC,sBAAsB,EAAE,UAAU,CAAA;CAAE,CAgB/D;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,UAAU,EAChB,GAAG,EAAE,UAAU,GACd,UAAU,CAmCZ;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,2BAAqB,CAAA;AAEpD;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,UAAU,GAAG;IAC/D,CAAC,EAAE,UAAU,CAAA;IACb,CAAC,EAAE,UAAU,CAAA;CACd,CAiCA;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU,GAAG,UAAU,CAkB1E;AAoBD;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,UAAU,CAI9C"}
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Public key in uncompressed format
3
+ */
4
+ export interface UncompressedPublicKey {
5
+ x: Uint8Array;
6
+ y: Uint8Array;
7
+ }
8
+ /**
9
+ * Derive the encryption key for the grantee list
10
+ *
11
+ * This is different from the legacy format key derivation.
12
+ * The grantee list is encrypted with a key derived from the publisher's private key.
13
+ */
14
+ export declare function deriveGranteeListEncryptionKey(publisherPrivKey: Uint8Array): Uint8Array;
15
+ /**
16
+ * Serialize grantee list to Bee-compatible format
17
+ *
18
+ * Bee stores grantees as concatenated 65-byte uncompressed secp256k1 public keys.
19
+ * Format: [0x04 || X (32 bytes) || Y (32 bytes)] for each key
20
+ *
21
+ * @param grantees - Array of public keys with x and y coordinates
22
+ * @returns Serialized grantee list
23
+ */
24
+ export declare function serializeGranteeList(grantees: UncompressedPublicKey[]): Uint8Array;
25
+ /**
26
+ * Deserialize grantee list from Bee-compatible format
27
+ *
28
+ * @param data - Serialized grantee list (concatenated 65-byte uncompressed keys)
29
+ * @returns Array of public keys with x and y coordinates
30
+ */
31
+ export declare function deserializeGranteeList(data: Uint8Array): UncompressedPublicKey[];
32
+ /**
33
+ * Encrypt a serialized grantee list for storage
34
+ *
35
+ * @param granteeList - Serialized grantee list
36
+ * @param publisherPrivKey - Publisher's private key for key derivation
37
+ * @returns Encrypted grantee list
38
+ */
39
+ export declare function encryptGranteeList(granteeList: Uint8Array, publisherPrivKey: Uint8Array): Uint8Array;
40
+ /**
41
+ * Decrypt an encrypted grantee list
42
+ *
43
+ * @param encryptedList - Encrypted grantee list
44
+ * @param publisherPrivKey - Publisher's private key for key derivation
45
+ * @returns Decrypted serialized grantee list
46
+ */
47
+ export declare function decryptGranteeList(encryptedList: Uint8Array, publisherPrivKey: Uint8Array): Uint8Array;
48
+ /**
49
+ * Serialize and encrypt grantee list in one step
50
+ *
51
+ * @param grantees - Array of public keys
52
+ * @param publisherPrivKey - Publisher's private key
53
+ * @returns Encrypted serialized grantee list ready for upload
54
+ */
55
+ export declare function serializeAndEncryptGranteeList(grantees: UncompressedPublicKey[], publisherPrivKey: Uint8Array): Uint8Array;
56
+ /**
57
+ * Decrypt and deserialize grantee list in one step
58
+ *
59
+ * @param encryptedList - Encrypted serialized grantee list
60
+ * @param publisherPrivKey - Publisher's private key
61
+ * @returns Array of public keys
62
+ */
63
+ export declare function decryptAndDeserializeGranteeList(encryptedList: Uint8Array, publisherPrivKey: Uint8Array): UncompressedPublicKey[];
64
+ /**
65
+ * Add grantees to an existing encrypted grantee list
66
+ *
67
+ * @param encryptedList - Existing encrypted grantee list
68
+ * @param newGrantees - New grantees to add
69
+ * @param publisherPrivKey - Publisher's private key
70
+ * @returns New encrypted grantee list with added grantees
71
+ */
72
+ export declare function addToGranteeList(encryptedList: Uint8Array, newGrantees: UncompressedPublicKey[], publisherPrivKey: Uint8Array): Uint8Array;
73
+ /**
74
+ * Remove grantees from an existing encrypted grantee list
75
+ *
76
+ * @param encryptedList - Existing encrypted grantee list
77
+ * @param revokeGrantees - Grantees to remove
78
+ * @param publisherPrivKey - Publisher's private key
79
+ * @returns New encrypted grantee list with removed grantees
80
+ */
81
+ export declare function removeFromGranteeList(encryptedList: Uint8Array, revokeGrantees: UncompressedPublicKey[], publisherPrivKey: Uint8Array): Uint8Array;
82
+ //# sourceMappingURL=grantee-list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grantee-list.d.ts","sourceRoot":"","sources":["../../../src/proxy/act/grantee-list.ts"],"names":[],"mappings":"AAWA;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,CAAC,EAAE,UAAU,CAAA;IACb,CAAC,EAAE,UAAU,CAAA;CACd;AAED;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAC5C,gBAAgB,EAAE,UAAU,GAC3B,UAAU,CAGZ;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,qBAAqB,EAAE,GAChC,UAAU,CAiBZ;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,UAAU,GACf,qBAAqB,EAAE,CAqCzB;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,WAAW,EAAE,UAAU,EACvB,gBAAgB,EAAE,UAAU,GAC3B,UAAU,CAGZ;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,aAAa,EAAE,UAAU,EACzB,gBAAgB,EAAE,UAAU,GAC3B,UAAU,CAGZ;AAED;;;;;;GAMG;AACH,wBAAgB,8BAA8B,CAC5C,QAAQ,EAAE,qBAAqB,EAAE,EACjC,gBAAgB,EAAE,UAAU,GAC3B,UAAU,CAGZ;AAED;;;;;;GAMG;AACH,wBAAgB,gCAAgC,CAC9C,aAAa,EAAE,UAAU,EACzB,gBAAgB,EAAE,UAAU,GAC3B,qBAAqB,EAAE,CAGzB;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,aAAa,EAAE,UAAU,EACzB,WAAW,EAAE,qBAAqB,EAAE,EACpC,gBAAgB,EAAE,UAAU,GAC3B,UAAU,CAYZ;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,aAAa,EAAE,UAAU,EACzB,cAAc,EAAE,qBAAqB,EAAE,EACvC,gBAAgB,EAAE,UAAU,GAC3B,UAAU,CAcZ"}
@@ -0,0 +1,183 @@
1
+ /**
2
+ * ACT History Management
3
+ *
4
+ * This module provides timestamped versioning of ACT entries, matching Bee's
5
+ * approach to tracking ACT versions over time.
6
+ *
7
+ * Key concepts:
8
+ * - Each ACT update creates a new history entry
9
+ * - Entries are keyed by reversed timestamp (MaxInt64 - timestamp)
10
+ * - History enables looking up ACT state at any point in time
11
+ * - Encrypted grantee list reference is stored in metadata
12
+ *
13
+ * This implementation uses the MantarayNode class from bee-js to produce
14
+ * Bee-compatible binary manifests with the proper version hash header.
15
+ *
16
+ * IMPORTANT: Mantaray manifests are hierarchical - each child node must be
17
+ * uploaded separately to Swarm. The root node references children by their
18
+ * content addresses (selfAddress). To read entries, all child nodes must be
19
+ * loaded recursively.
20
+ */
21
+ import { MantarayNode } from "@ethersphere/bee-js";
22
+ /**
23
+ * Single history entry metadata
24
+ */
25
+ export interface HistoryEntryMetadata {
26
+ actReference: string;
27
+ encryptedGranteeListRef?: string;
28
+ }
29
+ /**
30
+ * History entry with timestamp
31
+ */
32
+ export interface HistoryEntry {
33
+ timestamp: number;
34
+ metadata: HistoryEntryMetadata;
35
+ }
36
+ /**
37
+ * Result of serializing a history tree
38
+ */
39
+ export interface SerializedHistoryTree {
40
+ blobs: Map<string, Uint8Array>;
41
+ rootReference: string;
42
+ }
43
+ /**
44
+ * Result of saving a history tree
45
+ */
46
+ export interface SaveHistoryTreeResult {
47
+ rootReference: string;
48
+ tagUid?: number;
49
+ }
50
+ /**
51
+ * Calculate reversed timestamp key for history lookup
52
+ *
53
+ * Bee uses reversed timestamps so that the latest entry sorts first.
54
+ * Key = MaxInt64 - timestamp
55
+ *
56
+ * @param timestamp - Unix timestamp in seconds
57
+ * @returns Reversed timestamp as string (for use as path)
58
+ */
59
+ export declare function calculateReversedTimestamp(timestamp: number): string;
60
+ /**
61
+ * Calculate original timestamp from reversed key
62
+ *
63
+ * @param reversedKey - Reversed timestamp string
64
+ * @returns Original Unix timestamp in seconds
65
+ */
66
+ export declare function calculateOriginalTimestamp(reversedKey: string): number;
67
+ /**
68
+ * Create a new empty history manifest using MantarayNode
69
+ */
70
+ export declare function createHistoryManifest(): MantarayNode;
71
+ /**
72
+ * Add an entry to the history manifest
73
+ *
74
+ * This mutates the manifest in place by adding a fork.
75
+ *
76
+ * @param manifest - Existing history manifest (MantarayNode)
77
+ * @param timestamp - Unix timestamp for this entry
78
+ * @param actReference - Reference to the ACT manifest (hex string)
79
+ * @param encryptedGranteeListRef - Optional reference to encrypted grantee list (hex string)
80
+ */
81
+ export declare function addHistoryEntry(manifest: MantarayNode, timestamp: number, actReference: string, encryptedGranteeListRef?: string): void;
82
+ /**
83
+ * Get the latest history entry (most recent timestamp)
84
+ *
85
+ * Since keys are reversed timestamps, the smallest key is the latest entry.
86
+ * NOTE: This requires the manifest to have been loaded with loadRecursively()
87
+ * or to have been populated locally with addHistoryEntry().
88
+ *
89
+ * @param manifest - History manifest (MantarayNode)
90
+ * @returns Latest entry with its timestamp, or undefined if empty
91
+ */
92
+ export declare function getLatestEntry(manifest: MantarayNode): HistoryEntry | undefined;
93
+ /**
94
+ * Get entry at or before a specific timestamp
95
+ *
96
+ * This finds the ACT state that was valid at the given timestamp.
97
+ * NOTE: This requires the manifest to have been loaded with loadRecursively().
98
+ *
99
+ * @param manifest - History manifest (MantarayNode)
100
+ * @param timestamp - Target timestamp
101
+ * @returns Entry at or before timestamp, or undefined if none exists
102
+ */
103
+ export declare function getEntryAtTimestamp(manifest: MantarayNode, timestamp: number): HistoryEntry | undefined;
104
+ /**
105
+ * Get all history entries sorted by timestamp (newest first)
106
+ *
107
+ * @param manifest - History manifest (MantarayNode)
108
+ * @returns Array of entries sorted newest first
109
+ */
110
+ export declare function getAllEntries(manifest: MantarayNode): HistoryEntry[];
111
+ /**
112
+ * Serialize the entire history manifest tree to individual blobs
113
+ *
114
+ * Mantaray manifests are hierarchical - each node is stored at its content
115
+ * address. This function returns all blobs that need to be uploaded, keyed
116
+ * by their content addresses.
117
+ *
118
+ * @deprecated Use saveHistoryTreeRecursively instead which uploads bottom-up
119
+ * and uses Bee's actual returned references to avoid address mismatches.
120
+ *
121
+ * @param manifest - History manifest (MantarayNode)
122
+ * @returns Map of content address -> serialized data, plus root reference
123
+ */
124
+ export declare function serializeHistoryTree(manifest: MantarayNode): Promise<SerializedHistoryTree>;
125
+ /**
126
+ * Upload callback type for saveHistoryTreeRecursively
127
+ */
128
+ export type UploadCallback = (data: Uint8Array, isRoot: boolean) => Promise<{
129
+ reference: string;
130
+ tagUid?: number;
131
+ }>;
132
+ /**
133
+ * Save the entire history manifest tree by uploading bottom-up
134
+ *
135
+ * This function uploads nodes in the correct order (children before parents)
136
+ * and uses Bee's actual returned references to update selfAddress before
137
+ * marshaling parents. This avoids address mismatches between local hash
138
+ * computation and Bee's storage.
139
+ *
140
+ * The flow mirrors MantarayNode.saveRecursively() from bee-js:
141
+ * 1. Recursively save all child forks first
142
+ * 2. Marshal this node (which uses children's updated selfAddress)
143
+ * 3. Upload and set selfAddress from Bee's response
144
+ *
145
+ * @param manifest - History manifest (MantarayNode)
146
+ * @param uploadFn - Callback to upload data, returns reference from Bee
147
+ * @returns Root reference from Bee and optional tag UID
148
+ */
149
+ export declare function saveHistoryTreeRecursively(manifest: MantarayNode, uploadFn: UploadCallback): Promise<SaveHistoryTreeResult>;
150
+ /**
151
+ * Serialize history manifest root to Mantaray binary format
152
+ *
153
+ * @deprecated Use serializeHistoryTree for proper Mantaray serialization
154
+ * @param manifest - History manifest (MantarayNode)
155
+ * @returns Serialized root manifest as Uint8Array
156
+ */
157
+ export declare function serializeHistory(manifest: MantarayNode): Promise<Uint8Array>;
158
+ /**
159
+ * Deserialize history manifest from Mantaray binary format
160
+ *
161
+ * NOTE: After deserialization, call loadRecursively() or manually load
162
+ * child nodes to populate targetAddress for entries.
163
+ *
164
+ * @param data - Serialized manifest
165
+ * @param selfAddress - The reference/address of the manifest (32 bytes as Uint8Array)
166
+ * @returns Parsed history manifest (MantarayNode)
167
+ */
168
+ export declare function deserializeHistory(data: Uint8Array, selfAddress: Uint8Array): MantarayNode;
169
+ /**
170
+ * Load child node data into a deserialized manifest
171
+ *
172
+ * After deserializing the root node, this function loads all child node data
173
+ * so that targetAddress is available for each entry.
174
+ *
175
+ * @param manifest - Deserialized root manifest
176
+ * @param loadData - Callback to load data for a given reference
177
+ */
178
+ export declare function loadHistoryEntries(manifest: MantarayNode, loadData: (reference: string) => Promise<Uint8Array>): Promise<void>;
179
+ /**
180
+ * Get current Unix timestamp in seconds
181
+ */
182
+ export declare function getCurrentTimestamp(): number;
183
+ //# sourceMappingURL=history.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../../src/proxy/act/history.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAclD;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,YAAY,EAAE,MAAM,CAAA;IACpB,uBAAuB,CAAC,EAAE,MAAM,CAAA;CACjC;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,oBAAoB,CAAA;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;IAC9B,aAAa,EAAE,MAAM,CAAA;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,aAAa,EAAE,MAAM,CAAA;IACrB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED;;;;;;;;GAQG;AACH,wBAAgB,0BAA0B,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAGpE;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,WAAW,EAAE,MAA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,kBAAkB,CACtC,QAAQ,EAAE,YAAY,EACtB,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,UAAU,CAAC,GACnD,OAAO,CAAC,IAAI,CAAC,CAiCf;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAQ5C"}
@@ -0,0 +1,104 @@
1
+ /**
2
+ * ACT (Access Control Tries) - Bee-Compatible Implementation
3
+ *
4
+ * This module provides client-side ACT operations with Bee-compatible
5
+ * Simple Manifest (JSON) format:
6
+ * - ACT manifest (JSON with lookup key -> encrypted access key mappings)
7
+ * - Encrypted grantee list (stored separately)
8
+ * - History manifest (tracks ACT versions over time)
9
+ */
10
+ import type { Bee, BeeRequestOptions, UploadOptions } from "@ethersphere/bee-js";
11
+ import type { UploadContext, UploadProgress } from "../types";
12
+ type ActUploadOptions = UploadOptions & {
13
+ beeCompatible?: boolean;
14
+ };
15
+ /**
16
+ * Result of ACT upload operation
17
+ */
18
+ export interface ActUploadResult {
19
+ encryptedReference: string;
20
+ historyReference: string;
21
+ granteeListReference: string;
22
+ publisherPubKey: string;
23
+ actReference: string;
24
+ tagUid?: number;
25
+ }
26
+ /**
27
+ * Result of ACT grantee modification
28
+ */
29
+ export interface ActGranteeModifyResult {
30
+ historyReference: string;
31
+ granteeListReference: string;
32
+ actReference: string;
33
+ tagUid?: number;
34
+ }
35
+ /**
36
+ * Result of ACT revocation (includes new encrypted reference due to key rotation)
37
+ */
38
+ export interface ActRevocationResult extends ActGranteeModifyResult {
39
+ encryptedReference: string;
40
+ }
41
+ /**
42
+ * Create an ACT-protected upload
43
+ *
44
+ * This creates:
45
+ * 1. ACT manifest (JSON Simple Manifest with lookup key -> encrypted access key mappings)
46
+ * 2. Encrypted grantee list (for publisher management)
47
+ * 3. History manifest (tracks ACT versions over time)
48
+ *
49
+ * @param context - Upload context with bee and stamper
50
+ * @param contentReference - The reference to protect (32 or 64 bytes)
51
+ * @param publisherPrivateKey - Publisher's private key (32 bytes)
52
+ * @param granteePublicKeys - Array of grantee public keys
53
+ * @param options - Upload options
54
+ * @param requestOptions - Bee request options
55
+ * @param onProgress - Progress callback
56
+ * @returns Multiple references for ACT
57
+ */
58
+ export declare function createActForContent(context: UploadContext, contentReference: Uint8Array, publisherPrivateKey: Uint8Array, granteePublicKeys: Array<{
59
+ x: Uint8Array;
60
+ y: Uint8Array;
61
+ }>, options?: ActUploadOptions, requestOptions?: BeeRequestOptions, onProgress?: (progress: UploadProgress) => void): Promise<ActUploadResult>;
62
+ /**
63
+ * Decrypt an ACT-protected reference
64
+ *
65
+ * @param bee - Bee instance
66
+ * @param encryptedReference - The encrypted reference (hex string)
67
+ * @param historyReference - History manifest reference
68
+ * @param publisherPubKeyHex - Publisher's compressed public key (hex)
69
+ * @param readerPrivateKey - Reader's private key (32 bytes)
70
+ * @param timestamp - Optional timestamp to look up specific ACT version
71
+ * @param requestOptions - Bee request options
72
+ * @returns Decrypted content reference (hex string)
73
+ */
74
+ export declare function decryptActReference(bee: Bee, encryptedReference: string, historyReference: string, publisherPubKeyHex: string, readerPrivateKey: Uint8Array, timestamp?: number, requestOptions?: BeeRequestOptions): Promise<string>;
75
+ /**
76
+ * Add grantees to an existing ACT
77
+ */
78
+ export declare function addGranteesToAct(context: UploadContext, historyReference: string, publisherPrivateKey: Uint8Array, newGranteePublicKeys: Array<{
79
+ x: Uint8Array;
80
+ y: Uint8Array;
81
+ }>, options?: ActUploadOptions, requestOptions?: BeeRequestOptions, onProgress?: (progress: UploadProgress) => void): Promise<ActGranteeModifyResult>;
82
+ /**
83
+ * Revoke grantees from an ACT (performs key rotation)
84
+ */
85
+ export declare function revokeGranteesFromAct(context: UploadContext, historyReference: string, encryptedReference: string, publisherPrivateKey: Uint8Array, revokePublicKeys: Array<{
86
+ x: Uint8Array;
87
+ y: Uint8Array;
88
+ }>, options?: ActUploadOptions, requestOptions?: BeeRequestOptions, onProgress?: (progress: UploadProgress) => void): Promise<ActRevocationResult>;
89
+ /**
90
+ * Get grantees from an ACT
91
+ */
92
+ export declare function getGranteesFromAct(bee: Bee, historyReference: string, publisherPrivateKey: Uint8Array, requestOptions?: BeeRequestOptions): Promise<string[]>;
93
+ /**
94
+ * Parse a compressed public key from hex string
95
+ */
96
+ export declare function parseCompressedPublicKey(hex: string): {
97
+ x: Uint8Array;
98
+ y: Uint8Array;
99
+ };
100
+ export { type ActEntry } from "./act";
101
+ export { type UncompressedPublicKey } from "./grantee-list";
102
+ export { type HistoryEntry, type HistoryEntryMetadata } from "./history";
103
+ export { publicKeyFromPrivate, compressPublicKey, publicKeyFromCompressed, } from "./crypto";
104
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/proxy/act/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAChF,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAe7D,KAAK,gBAAgB,GAAG,aAAa,GAAG;IAAE,aAAa,CAAC,EAAE,OAAO,CAAA;CAAE,CAAA;AA2BnE;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,kBAAkB,EAAE,MAAM,CAAA;IAC1B,gBAAgB,EAAE,MAAM,CAAA;IACxB,oBAAoB,EAAE,MAAM,CAAA;IAC5B,eAAe,EAAE,MAAM,CAAA;IACvB,YAAY,EAAE,MAAM,CAAA;IACpB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,gBAAgB,EAAE,MAAM,CAAA;IACxB,oBAAoB,EAAE,MAAM,CAAA;IAC5B,YAAY,EAAE,MAAM,CAAA;IACpB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAoB,SAAQ,sBAAsB;IACjE,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EAAE,UAAU,EAC/B,gBAAgB,EAAE,KAAK,CAAC;IAAE,CAAC,EAAE,UAAU,CAAC;IAAC,CAAC,EAAE,UAAU,CAAA;CAAE,CAAC,EACzD,OAAO,CAAC,EAAE,gBAAgB,EAC1B,cAAc,CAAC,EAAE,iBAAiB,EAClC,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,cAAc,KAAK,IAAI,GAC9C,OAAO,CAAC,mBAAmB,CAAC,CAsM9B;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,GAAG,EAAE,GAAG,EACR,gBAAgB,EAAE,MAAM,EACxB,mBAAmB,EAAE,UAAU,EAC/B,cAAc,CAAC,EAAE,iBAAiB,GACjC,OAAO,CAAC,MAAM,EAAE,CAAC,CAkDnB;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,MAAM,GAAG;IACrD,CAAC,EAAE,UAAU,CAAA;IACb,CAAC,EAAE,UAAU,CAAA;CACd,CAGA;AAGD,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,OAAO,CAAA;AACrC,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,gBAAgB,CAAA;AAC3D,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,oBAAoB,EAAE,MAAM,WAAW,CAAA;AACxE,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,UAAU,CAAA"}
@@ -0,0 +1,14 @@
1
+ import { Reference } from "@ethersphere/bee-js";
2
+ export declare const CHUNK_SIZE = 4096;
3
+ export declare const ENCRYPTED_REFS_PER_CHUNK = 64;
4
+ /**
5
+ * Build encrypted merkle tree from chunk references
6
+ * Adapted from bee-js encrypted-chunk-stream.ts
7
+ * Returns root reference (64 bytes: 32-byte address + 32-byte encryption key)
8
+ */
9
+ export declare function buildEncryptedMerkleTree(encryptedChunks: Array<{
10
+ address: Uint8Array;
11
+ key: Uint8Array;
12
+ span: bigint;
13
+ }>, onChunk: (encryptedChunkData: Uint8Array) => Promise<void>): Promise<Reference>;
14
+ //# sourceMappingURL=chunking-encrypted.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunking-encrypted.d.ts","sourceRoot":"","sources":["../../src/proxy/chunking-encrypted.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAQ,MAAM,qBAAqB,CAAA;AAKrD,eAAO,MAAM,UAAU,OAAO,CAAA;AAC9B,eAAO,MAAM,wBAAwB,KAAK,CAAA;AAE1C;;;;GAIG;AACH,wBAAsB,wBAAwB,CAC5C,eAAe,EAAE,KAAK,CAAC;IACrB,OAAO,EAAE,UAAU,CAAA;IACnB,GAAG,EAAE,UAAU,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;CACb,CAAC,EACF,OAAO,EAAE,CAAC,kBAAkB,EAAE,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,GACzD,OAAO,CAAC,SAAS,CAAC,CA0EpB"}
@@ -0,0 +1,15 @@
1
+ import { Reference } from "@ethersphere/bee-js";
2
+ import { type ContentAddressedChunk } from "../chunk";
3
+ import type { ChunkReference } from "./types";
4
+ export declare const CHUNK_SIZE = 4096;
5
+ export declare const REFS_PER_CHUNK = 64;
6
+ /**
7
+ * Split data into 4096-byte chunks
8
+ */
9
+ export declare function splitDataIntoChunks(data: Uint8Array): Uint8Array[];
10
+ /**
11
+ * Build merkle tree from chunk references
12
+ * Returns root reference (32 bytes)
13
+ */
14
+ export declare function buildMerkleTree(chunkRefs: ChunkReference[], onIntermediateChunk: (chunk: ContentAddressedChunk) => Promise<void>): Promise<Reference>;
15
+ //# sourceMappingURL=chunking.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunking.d.ts","sourceRoot":"","sources":["../../src/proxy/chunking.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAC/C,OAAO,EAA6B,KAAK,qBAAqB,EAAE,MAAM,UAAU,CAAA;AAChF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAG7C,eAAO,MAAM,UAAU,OAAO,CAAA;AAC9B,eAAO,MAAM,cAAc,KAAK,CAAA;AAEhC;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU,EAAE,CAMlE;AAED;;;GAGG;AACH,wBAAsB,eAAe,CACnC,SAAS,EAAE,cAAc,EAAE,EAC3B,mBAAmB,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,OAAO,CAAC,IAAI,CAAC,GACnE,OAAO,CAAC,SAAS,CAAC,CAsCpB"}
@@ -0,0 +1,16 @@
1
+ import { EthAddress, Identifier } from "@ethersphere/bee-js";
2
+ import type { Bee, BeeRequestOptions, DownloadOptions } from "@ethersphere/bee-js";
3
+ import type { UploadProgress } from "./types";
4
+ import type { SingleOwnerChunk } from "../types";
5
+ /**
6
+ * Download data using only the chunk API
7
+ * This ensures encrypted data remains encrypted during transmission and avoids metadata leakage
8
+ *
9
+ * Supports both:
10
+ * - Regular references (64 hex chars = 32 bytes)
11
+ * - Encrypted references (128 hex chars = 64 bytes: 32-byte address + 32-byte encryption key)
12
+ */
13
+ export declare function downloadDataWithChunkAPI(bee: Bee, reference: string, _options?: DownloadOptions, onProgress?: (progress: UploadProgress) => void, requestOptions?: BeeRequestOptions): Promise<Uint8Array>;
14
+ export declare function downloadSOC(bee: Bee, owner: string | Uint8Array | EthAddress, identifier: string | Uint8Array | Identifier, requestOptions?: BeeRequestOptions): Promise<SingleOwnerChunk>;
15
+ export declare function downloadEncryptedSOC(bee: Bee, owner: string | Uint8Array | EthAddress, identifier: string | Uint8Array | Identifier, encryptionKey: string | Uint8Array, requestOptions?: BeeRequestOptions): Promise<SingleOwnerChunk>;
16
+ //# sourceMappingURL=download-data.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"download-data.d.ts","sourceRoot":"","sources":["../../src/proxy/download-data.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,UAAU,EAGX,MAAM,qBAAqB,CAAA;AAC5B,OAAO,KAAK,EACV,GAAG,EACH,iBAAiB,EACjB,eAAe,EAChB,MAAM,qBAAqB,CAAA;AAa5B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAC7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AA4RhD;;;;;;;GAOG;AACH,wBAAsB,wBAAwB,CAC5C,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,MAAM,EACjB,QAAQ,CAAC,EAAE,eAAe,EAC1B,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,cAAc,KAAK,IAAI,EAC/C,cAAc,CAAC,EAAE,iBAAiB,GACjC,OAAO,CAAC,UAAU,CAAC,CAkFrB;AAED,wBAAsB,WAAW,CAC/B,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,MAAM,GAAG,UAAU,GAAG,UAAU,EACvC,UAAU,EAAE,MAAM,GAAG,UAAU,GAAG,UAAU,EAC5C,cAAc,CAAC,EAAE,iBAAiB,GACjC,OAAO,CAAC,gBAAgB,CAAC,CAY3B;AAED,wBAAsB,oBAAoB,CACxC,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,MAAM,GAAG,UAAU,GAAG,UAAU,EACvC,UAAU,EAAE,MAAM,GAAG,UAAU,GAAG,UAAU,EAC5C,aAAa,EAAE,MAAM,GAAG,UAAU,EAClC,cAAc,CAAC,EAAE,iBAAiB,GACjC,OAAO,CAAC,gBAAgB,CAAC,CAgB3B"}