neozipkit 0.1.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (330) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +371 -200
  3. package/contracts/ABI.txt +889 -0
  4. package/contracts/Bytecode.txt +1 -0
  5. package/contracts/COMPILATION_NOTES.md +59 -0
  6. package/contracts/QUICK_DEPLOY.md +286 -0
  7. package/contracts/README.md +256 -0
  8. package/contracts/VERIFICATION.md +308 -0
  9. package/contracts/deploy-interactive.js +448 -0
  10. package/contracts/deployment-arbitrum-sepolia.json +12 -0
  11. package/contracts/deployment-arbitrum.json +12 -0
  12. package/contracts/deployment-eth-sepolia.json +12 -0
  13. package/contracts/hardhat.config.js +114 -0
  14. package/contracts/package.json +20 -0
  15. package/contracts/scripts/compile-and-extract.js +119 -0
  16. package/contracts/scripts/verify-contract.js +223 -0
  17. package/contracts/src/{NZIP-NFT-Private.sol → NZIP-NFT-v2.0.sol} +66 -151
  18. package/contracts/src/NZIP-NFT.sol +9 -15
  19. package/dist/{browser → blockchain/browser}/TokenVerifierBrowser.d.ts +11 -20
  20. package/dist/blockchain/browser/TokenVerifierBrowser.d.ts.map +1 -0
  21. package/dist/{browser → blockchain/browser}/TokenVerifierBrowser.js +106 -92
  22. package/dist/blockchain/browser/TokenVerifierBrowser.js.map +1 -0
  23. package/dist/blockchain/browser/WalletManagerBrowser.d.ts +98 -0
  24. package/dist/blockchain/browser/WalletManagerBrowser.d.ts.map +1 -0
  25. package/dist/blockchain/browser/WalletManagerBrowser.js +434 -0
  26. package/dist/blockchain/browser/WalletManagerBrowser.js.map +1 -0
  27. package/dist/blockchain/browser/ZipkitMinterBrowser.d.ts +58 -0
  28. package/dist/blockchain/browser/ZipkitMinterBrowser.d.ts.map +1 -0
  29. package/dist/blockchain/browser/ZipkitMinterBrowser.js +317 -0
  30. package/dist/blockchain/browser/ZipkitMinterBrowser.js.map +1 -0
  31. package/dist/blockchain/browser/index.d.ts +11 -0
  32. package/dist/blockchain/browser/index.d.ts.map +1 -0
  33. package/dist/blockchain/browser/index.js +16 -0
  34. package/dist/blockchain/browser/index.js.map +1 -0
  35. package/dist/{server/blockchain/WalletAnalyzer.d.ts → blockchain/core/WalletManager.d.ts} +69 -26
  36. package/dist/blockchain/core/WalletManager.d.ts.map +1 -0
  37. package/dist/{server/blockchain/WalletAnalyzer.js → blockchain/core/WalletManager.js} +172 -160
  38. package/dist/blockchain/core/WalletManager.js.map +1 -0
  39. package/dist/blockchain/core/ZipkitMinter.d.ts +141 -0
  40. package/dist/blockchain/core/ZipkitMinter.d.ts.map +1 -0
  41. package/dist/blockchain/core/ZipkitMinter.js +548 -0
  42. package/dist/blockchain/core/ZipkitMinter.js.map +1 -0
  43. package/dist/blockchain/core/ZipkitOTS.d.ts +126 -0
  44. package/dist/blockchain/core/ZipkitOTS.d.ts.map +1 -0
  45. package/dist/blockchain/core/ZipkitOTS.js +506 -0
  46. package/dist/blockchain/core/ZipkitOTS.js.map +1 -0
  47. package/dist/blockchain/core/ZipkitVerifier.d.ts +177 -0
  48. package/dist/blockchain/core/ZipkitVerifier.d.ts.map +1 -0
  49. package/dist/blockchain/core/ZipkitVerifier.js +632 -0
  50. package/dist/blockchain/core/ZipkitVerifier.js.map +1 -0
  51. package/dist/blockchain/core/contracts.d.ts +83 -0
  52. package/dist/blockchain/core/contracts.d.ts.map +1 -0
  53. package/dist/blockchain/core/contracts.js +341 -0
  54. package/dist/blockchain/core/contracts.js.map +1 -0
  55. package/dist/blockchain/core/index.d.ts +12 -0
  56. package/dist/blockchain/core/index.d.ts.map +1 -0
  57. package/dist/blockchain/core/index.js +59 -0
  58. package/dist/blockchain/core/index.js.map +1 -0
  59. package/dist/blockchain/index.d.ts +11 -0
  60. package/dist/blockchain/index.d.ts.map +1 -0
  61. package/dist/blockchain/index.js +34 -0
  62. package/dist/blockchain/index.js.map +1 -0
  63. package/dist/blockchain/node/WalletManagerNode.d.ts +47 -0
  64. package/dist/blockchain/node/WalletManagerNode.d.ts.map +1 -0
  65. package/dist/blockchain/node/WalletManagerNode.js +203 -0
  66. package/dist/blockchain/node/WalletManagerNode.js.map +1 -0
  67. package/dist/blockchain/node/index.d.ts +12 -0
  68. package/dist/blockchain/node/index.d.ts.map +1 -0
  69. package/dist/blockchain/node/index.js +24 -0
  70. package/dist/blockchain/node/index.js.map +1 -0
  71. package/dist/browser/ZipkitBrowser.d.ts +27 -0
  72. package/dist/browser/ZipkitBrowser.d.ts.map +1 -0
  73. package/dist/browser/{ZipKitBrowser.js → ZipkitBrowser.js} +96 -43
  74. package/dist/browser/ZipkitBrowser.js.map +1 -0
  75. package/dist/browser/index.d.ts +12 -0
  76. package/dist/browser/index.d.ts.map +1 -0
  77. package/dist/browser/index.js +42 -0
  78. package/dist/browser/index.js.map +1 -0
  79. package/dist/browser-esm/index.d.ts +12 -0
  80. package/dist/browser-esm/index.js +59559 -0
  81. package/dist/browser-esm/index.js.map +7 -0
  82. package/dist/browser-umd/index.d.ts +12 -0
  83. package/dist/browser-umd/index.js +59576 -0
  84. package/dist/browser-umd/index.js.map +7 -0
  85. package/dist/browser-umd/index.min.js +63 -0
  86. package/dist/browser.d.ts +8 -17
  87. package/dist/browser.js +13 -29
  88. package/dist/core/ZipCompress.d.ts +99 -0
  89. package/dist/core/ZipCompress.d.ts.map +1 -0
  90. package/dist/core/ZipCompress.js +309 -0
  91. package/dist/core/ZipCompress.js.map +1 -0
  92. package/dist/core/ZipDecompress.d.ts +58 -0
  93. package/dist/core/ZipDecompress.d.ts.map +1 -0
  94. package/dist/core/ZipDecompress.js +172 -0
  95. package/dist/core/ZipDecompress.js.map +1 -0
  96. package/dist/{shared → core}/ZipEntry.d.ts +8 -1
  97. package/dist/core/ZipEntry.d.ts.map +1 -0
  98. package/dist/{shared → core}/ZipEntry.js +224 -81
  99. package/dist/core/ZipEntry.js.map +1 -0
  100. package/dist/core/Zipkit.d.ts +315 -0
  101. package/dist/core/Zipkit.d.ts.map +1 -0
  102. package/dist/core/Zipkit.js +647 -0
  103. package/dist/core/Zipkit.js.map +1 -0
  104. package/dist/core/components/HashCalculator.d.ts +138 -0
  105. package/dist/core/components/HashCalculator.d.ts.map +1 -0
  106. package/dist/core/components/HashCalculator.js +360 -0
  107. package/dist/core/components/HashCalculator.js.map +1 -0
  108. package/dist/core/components/Logger.d.ts +73 -0
  109. package/dist/core/components/Logger.d.ts.map +1 -0
  110. package/dist/core/components/Logger.js +156 -0
  111. package/dist/core/components/Logger.js.map +1 -0
  112. package/dist/core/components/ProgressTracker.d.ts +43 -0
  113. package/dist/core/components/ProgressTracker.d.ts.map +1 -0
  114. package/dist/core/components/ProgressTracker.js +112 -0
  115. package/dist/core/components/ProgressTracker.js.map +1 -0
  116. package/dist/{shared → core}/components/Support.d.ts +1 -0
  117. package/dist/core/components/Support.d.ts.map +1 -0
  118. package/dist/{shared → core}/components/Support.js +1 -0
  119. package/dist/core/components/Support.js.map +1 -0
  120. package/dist/{shared → core}/components/Util.d.ts +7 -2
  121. package/dist/core/components/Util.d.ts.map +1 -0
  122. package/dist/{shared → core}/components/Util.js +14 -34
  123. package/dist/core/components/Util.js.map +1 -0
  124. package/dist/{shared → core}/constants/Errors.d.ts +1 -2
  125. package/dist/core/constants/Errors.d.ts.map +1 -0
  126. package/dist/{shared → core}/constants/Errors.js +1 -3
  127. package/dist/core/constants/Errors.js.map +1 -0
  128. package/dist/{shared → core}/constants/Headers.d.ts +3 -0
  129. package/dist/core/constants/Headers.d.ts.map +1 -0
  130. package/dist/{shared → core}/constants/Headers.js +20 -17
  131. package/dist/core/constants/Headers.js.map +1 -0
  132. package/dist/core/encryption/Manager.d.ts +58 -0
  133. package/dist/core/encryption/Manager.d.ts.map +1 -0
  134. package/dist/core/encryption/Manager.js +121 -0
  135. package/dist/core/encryption/Manager.js.map +1 -0
  136. package/dist/core/encryption/ZipCrypto.d.ts +172 -0
  137. package/dist/core/encryption/ZipCrypto.d.ts.map +1 -0
  138. package/dist/core/encryption/ZipCrypto.js +554 -0
  139. package/dist/core/encryption/ZipCrypto.js.map +1 -0
  140. package/dist/core/encryption/index.d.ts +9 -0
  141. package/dist/core/encryption/index.d.ts.map +1 -0
  142. package/dist/core/encryption/index.js +17 -0
  143. package/dist/core/encryption/index.js.map +1 -0
  144. package/dist/core/encryption/types.d.ts +29 -0
  145. package/dist/core/encryption/types.d.ts.map +1 -0
  146. package/dist/core/encryption/types.js +12 -0
  147. package/dist/core/encryption/types.js.map +1 -0
  148. package/dist/core/index.d.ts +24 -0
  149. package/dist/core/index.d.ts.map +1 -0
  150. package/dist/core/index.js +57 -0
  151. package/dist/core/index.js.map +1 -0
  152. package/dist/{shared → core}/version.d.ts +1 -0
  153. package/dist/core/version.d.ts.map +1 -0
  154. package/dist/core/version.js +31 -0
  155. package/dist/core/version.js.map +1 -0
  156. package/dist/index.d.ts +8 -25
  157. package/dist/index.d.ts.map +1 -0
  158. package/dist/index.js +29 -47
  159. package/dist/index.js.map +1 -0
  160. package/dist/node/ZipCompressNode.d.ts +123 -0
  161. package/dist/node/ZipCompressNode.d.ts.map +1 -0
  162. package/dist/node/ZipCompressNode.js +576 -0
  163. package/dist/node/ZipCompressNode.js.map +1 -0
  164. package/dist/node/ZipDecompressNode.d.ts +120 -0
  165. package/dist/node/ZipDecompressNode.d.ts.map +1 -0
  166. package/dist/node/ZipDecompressNode.js +461 -0
  167. package/dist/node/ZipDecompressNode.js.map +1 -0
  168. package/dist/node/ZipkitNode.d.ts +406 -0
  169. package/dist/node/ZipkitNode.d.ts.map +1 -0
  170. package/dist/node/ZipkitNode.js +1305 -0
  171. package/dist/node/ZipkitNode.js.map +1 -0
  172. package/dist/node/index.d.ts +26 -0
  173. package/dist/node/index.d.ts.map +1 -0
  174. package/dist/node/index.js +65 -0
  175. package/dist/node/index.js.map +1 -0
  176. package/dist/types/index.d.ts +59 -0
  177. package/dist/types/index.d.ts.map +1 -0
  178. package/dist/types/index.js +36 -1
  179. package/dist/types/index.js.map +1 -0
  180. package/examples/README.md +269 -0
  181. package/examples/blockchain-tokenize.ts +354 -0
  182. package/examples/create-zip.ts +172 -0
  183. package/examples/extract-zip.ts +158 -0
  184. package/examples/list-zip.ts +161 -0
  185. package/examples/test-files/data.json +116 -0
  186. package/examples/test-files/document.md +80 -0
  187. package/examples/test-files/document.txt +2 -0
  188. package/examples/test-files/file1.txt +48 -0
  189. package/examples/test-files/file2.txt +80 -0
  190. package/examples/tsconfig.json +44 -0
  191. package/examples/unzip-token.ts +6 -3
  192. package/examples/verify-tokenized-zip.ts +305 -0
  193. package/package.json +117 -23
  194. package/src/blockchain/README.md +222 -0
  195. package/src/{browser → blockchain/browser}/TokenVerifierBrowser.ts +125 -79
  196. package/src/blockchain/browser/WalletManagerBrowser.ts +486 -0
  197. package/src/blockchain/browser/ZipkitMinterBrowser.ts +400 -0
  198. package/src/blockchain/browser/index.ts +13 -0
  199. package/src/blockchain/core/WalletManager.ts +436 -0
  200. package/src/blockchain/core/ZipkitMinter.ts +716 -0
  201. package/src/blockchain/core/ZipkitOTS.ts +588 -0
  202. package/src/blockchain/core/ZipkitVerifier.ts +853 -0
  203. package/src/blockchain/core/contracts.ts +370 -0
  204. package/src/blockchain/core/index.ts +71 -0
  205. package/src/blockchain/index.ts +27 -0
  206. package/src/blockchain/node/WalletManagerNode.ts +171 -0
  207. package/src/blockchain/node/index.ts +40 -0
  208. package/src/browser/{ZipKitBrowser.ts → ZipkitBrowser.ts} +104 -41
  209. package/src/browser/index.esm.ts +37 -0
  210. package/src/browser/index.ts +25 -0
  211. package/src/core/ZipCompress.ts +398 -0
  212. package/src/core/ZipDecompress.ts +212 -0
  213. package/src/{shared → core}/ZipEntry.ts +239 -89
  214. package/src/core/Zipkit.ts +794 -0
  215. package/src/core/components/HashCalculator.ts +384 -0
  216. package/src/core/components/Logger.ts +180 -0
  217. package/src/core/components/ProgressTracker.ts +134 -0
  218. package/src/{shared → core}/components/Util.ts +12 -34
  219. package/src/{shared → core}/constants/Errors.ts +0 -4
  220. package/src/{shared → core}/constants/Headers.ts +19 -17
  221. package/src/core/encryption/Manager.ts +137 -0
  222. package/src/core/encryption/ZipCrypto.ts +650 -0
  223. package/src/core/encryption/index.ts +15 -0
  224. package/src/core/encryption/types.ts +33 -0
  225. package/src/core/index.ts +34 -0
  226. package/src/core/version.ts +33 -0
  227. package/src/index.ts +54 -32
  228. package/src/node/ZipCompressNode.ts +632 -0
  229. package/src/node/ZipDecompressNode.ts +508 -0
  230. package/src/node/ZipkitNode.ts +1559 -0
  231. package/src/node/index.ts +69 -0
  232. package/src/types/index.ts +131 -1
  233. package/src/types/opentimestamps.d.ts +1 -23
  234. package/contracts/Lock.sol +0 -34
  235. package/contracts/bytecode.txt +0 -1
  236. package/contracts/compile-contract.js +0 -168
  237. package/contracts/deploy/deploy-both-contracts.js +0 -286
  238. package/contracts/deploy/deploy-enhanced-contract.js +0 -197
  239. package/contracts/deploy/deploy-private-contract.js +0 -190
  240. package/contracts/deploy/deploy-public-clean.js +0 -1063
  241. package/contracts/deploy/deploy-public-contract.js +0 -1107
  242. package/contracts/deployment.config.example.js +0 -25
  243. package/contracts/remix-compile.js +0 -222
  244. package/contracts/setup-deployment.js +0 -51
  245. package/contracts/src/ZipFileNFT-DEPRECATED-6field.sol +0 -260
  246. package/contracts/src/ZipFileNFT-DEPRECATED-Enhanced.sol +0 -289
  247. package/dist/browser/CertificateGeneratorBrowser.d.ts +0 -75
  248. package/dist/browser/CertificateGeneratorBrowser.js +0 -433
  249. package/dist/browser/ZipKitBrowser.d.ts +0 -18
  250. package/dist/browser/ZipKitStampBrowser.d.ts +0 -2
  251. package/dist/browser/ZipKitStampBrowser.js +0 -12
  252. package/dist/browser-index.d.ts +0 -21
  253. package/dist/browser-index.js +0 -58
  254. package/dist/server/blockchain/CertificateToken.d.ts +0 -48
  255. package/dist/server/blockchain/CertificateToken.js +0 -386
  256. package/dist/server/blockchain/NFTMinter.d.ts +0 -41
  257. package/dist/server/blockchain/NFTMinter.js +0 -323
  258. package/dist/server/blockchain/TokenQuerier.d.ts +0 -31
  259. package/dist/server/blockchain/TokenQuerier.js +0 -259
  260. package/dist/server/blockchain/TokenVerifier.d.ts +0 -20
  261. package/dist/server/blockchain/TokenVerifier.js +0 -395
  262. package/dist/server/blockchain/WalletFormatter.d.ts +0 -39
  263. package/dist/server/blockchain/WalletFormatter.js +0 -196
  264. package/dist/server/blockchain/WalletManager.d.ts +0 -46
  265. package/dist/server/blockchain/WalletManager.js +0 -294
  266. package/dist/server/blockchain/ZipMetadata.d.ts +0 -27
  267. package/dist/server/blockchain/ZipMetadata.js +0 -131
  268. package/dist/server/blockchain/ZipTokenProcessor.d.ts +0 -44
  269. package/dist/server/blockchain/ZipTokenProcessor.js +0 -204
  270. package/dist/server/blockchain/constants.d.ts +0 -102
  271. package/dist/server/blockchain/constants.js +0 -968
  272. package/dist/server/blockchain/index.d.ts +0 -9
  273. package/dist/server/blockchain/index.js +0 -44
  274. package/dist/server/blockchain/test-certificate.d.ts +0 -8
  275. package/dist/server/blockchain/test-certificate.js +0 -100
  276. package/dist/server/blockchain/types.d.ts +0 -69
  277. package/dist/server/blockchain/types.js +0 -51
  278. package/dist/server/platform/server/ZipKitServer.d.ts +0 -105
  279. package/dist/server/platform/server/ZipKitServer.js +0 -437
  280. package/dist/server/platform/servercomponents/ZipKitOTS.d.ts +0 -91
  281. package/dist/server/platform/servercomponents/ZipKitOTS.js +0 -271
  282. package/dist/shared/ZipKit.d.ts +0 -249
  283. package/dist/shared/ZipKit.js +0 -789
  284. package/dist/shared/components/CertificateOTS.d.ts +0 -15
  285. package/dist/shared/components/CertificateOTS.js +0 -116
  286. package/dist/shared/components/FileSys.d.ts +0 -2
  287. package/dist/shared/components/FileSys.js +0 -113
  288. package/dist/shared/components/HashAccumulator.d.ts +0 -55
  289. package/dist/shared/components/HashAccumulator.js +0 -100
  290. package/dist/shared/components/ZipCrypto.d.ts +0 -3
  291. package/dist/shared/components/ZipCrypto.js +0 -78
  292. package/dist/shared/components/merkleTree.d.ts +0 -66
  293. package/dist/shared/components/merkleTree.js +0 -136
  294. package/dist/shared/types/index.d.ts +0 -21
  295. package/dist/shared/types/index.js +0 -3
  296. package/dist/shared/types.d.ts +0 -33
  297. package/dist/shared/types.js +0 -8
  298. package/dist/shared/version.js +0 -7
  299. package/src/browser/CertificateGeneratorBrowser.ts +0 -498
  300. package/src/browser/ZipKitStampBrowser.ts +0 -9
  301. package/src/browser-index.ts +0 -36
  302. package/src/server/blockchain/CertificateToken.ts +0 -444
  303. package/src/server/blockchain/NFTMinter.ts +0 -357
  304. package/src/server/blockchain/TokenQuerier.ts +0 -287
  305. package/src/server/blockchain/TokenVerifier.ts +0 -453
  306. package/src/server/blockchain/WalletAnalyzer.ts +0 -397
  307. package/src/server/blockchain/WalletFormatter.ts +0 -206
  308. package/src/server/blockchain/WalletManager.ts +0 -294
  309. package/src/server/blockchain/ZipMetadata.ts +0 -117
  310. package/src/server/blockchain/ZipTokenProcessor.ts +0 -234
  311. package/src/server/blockchain/constants.ts +0 -969
  312. package/src/server/blockchain/index.ts +0 -42
  313. package/src/server/blockchain/test-certificate.ts +0 -137
  314. package/src/server/blockchain/types.ts +0 -134
  315. package/src/server/platform/server/ZipKitServer.ts +0 -459
  316. package/src/server/platform/servercomponents/ZipKitOTS.ts +0 -313
  317. package/src/server/platform/servercomponents/opentimestamps.d.ts +0 -23
  318. package/src/shared/ZipKit.ts +0 -899
  319. package/src/shared/components/CertificateOTS.ts +0 -132
  320. package/src/shared/components/FileSys.ts +0 -87
  321. package/src/shared/components/HashAccumulator.ts +0 -113
  322. package/src/shared/components/ZipCrypto.ts +0 -91
  323. package/src/shared/components/merkleTree.ts +0 -162
  324. package/src/shared/types/index.ts +0 -25
  325. package/src/shared/types/modules.d.ts +0 -22
  326. package/src/shared/types/opentimestamps.d.ts +0 -23
  327. package/src/shared/types.d.ts +0 -8
  328. package/src/shared/types.ts +0 -43
  329. package/src/shared/version.ts +0 -4
  330. /package/src/{shared → core}/components/Support.ts +0 -0
package/README.md CHANGED
@@ -1,14 +1,18 @@
1
1
  # neozipkit
2
2
 
3
+ > **⚠️ Alpha Release Notice**: This is an alpha/pre-release version (0.3.0). The API may change before the stable 1.0.0 release. Use with caution in production environments.
4
+
3
5
  Advanced ZIP file creation and verification library with blockchain timestamping and NFT tokenization capabilities.
4
6
 
5
7
  ## 🌟 Features
6
8
 
7
9
  - **Advanced ZIP compression** with support for multiple compression methods (Deflate, ZStandard, Stored)
8
- - **Blockchain timestamping** using OpenTimestamps for file integrity verification
10
+ - **Streaming compression** for memory-efficient processing of large files
9
11
  - **NFT tokenization** for creating blockchain-backed ZIP file certificates
10
12
  - **Hash-based verification** with Merkle tree support
11
- - **Browser and server compatibility** with clean platform separation
13
+ - **Blockchain timestamping** using OpenTimestamps for file integrity verification
14
+ - **Real-time progress tracking** for long-running operations
15
+ - **Browser and Node.js compatibility** with clean platform separation
12
16
  - **TypeScript support** with full type definitions
13
17
 
14
18
  ## 📦 Installation
@@ -19,101 +23,164 @@ yarn add neozipkit
19
23
 
20
24
  ## 🚀 Quick Start
21
25
 
22
- ### Basic ZIP Creation
26
+ ### Basic Usage
23
27
 
28
+ NeoZipKit provides both browser and Node.js implementations for creating, extracting, and managing ZIP files.
29
+
30
+ **Node.js:**
24
31
  ```typescript
25
- import { ZipKitBrowser } from 'neozipkit/browser';
26
- import { CompressOptions } from 'neozipkit';
27
-
28
- const zipKit = new ZipKitBrowser();
29
- const options: CompressOptions = {
30
- useZstd: false, // Use deflate compression
31
- level: 6
32
- };
33
-
34
- // Add files to ZIP
35
- await zipKit.addFile('example.txt', fileBuffer, options);
36
- const zipBuffer = await zipKit.finalize();
37
- ```
32
+ import { ZipkitNode } from 'neozipkit/node';
33
+
34
+ const zip = new ZipkitNode();
38
35
 
39
- ### ZIP Verification
36
+ // Create a ZIP from files
37
+ await zip.createZipFromFiles(['file1.txt', 'file2.txt'], 'output.zip');
40
38
 
39
+ // Extract a ZIP file
40
+ await zip.extractZipFile('archive.zip', './output');
41
+ ```
42
+
43
+ **Browser:**
41
44
  ```typescript
42
- import { ZipKitBrowser } from 'neozipkit/browser';
43
- import { ZipEntry } from 'neozipkit';
45
+ import { ZipkitBrowser } from 'neozipkit/browser-esm';
46
+
47
+ const zip = new ZipkitBrowser();
48
+ await zip.addFile(file, { level: 6 });
49
+ const zipBlob = await zip.createZipBlob();
50
+ ```
51
+
52
+ ### Examples
53
+
54
+ Complete, runnable examples are available in the `examples/` directory:
44
55
 
45
- const zipKit = new ZipKitBrowser();
46
- const entries: ZipEntry[] = await zipKit.loadFromBuffer(zipBuffer);
56
+ - **`examples/create-zip.ts`** - Create ZIP archives from multiple files
57
+ - **`examples/extract-zip.ts`** - Extract ZIP files to directories
58
+ - **`examples/list-zip.ts`** - List ZIP archive contents
59
+ - **`examples/blockchain-tokenize.ts`** - Create tokenized ZIP files with NFT minting
60
+ - **`examples/verify-tokenized-zip.ts`** - Verify tokenized ZIP files on blockchain
47
61
 
48
- // Verify file integrity
49
- for (const entry of entries) {
50
- const isValid = await zipKit.verifyEntry(entry);
51
- console.log(`${entry.filename}: ${isValid ? 'Valid' : 'Invalid'}`);
52
- }
62
+ Run examples with:
63
+ ```bash
64
+ ts-node examples/create-zip.ts
53
65
  ```
54
66
 
67
+ See [`examples/README.md`](examples/README.md) for detailed usage instructions and all available examples.
68
+
69
+ **Note:** The browser bundle includes all necessary polyfills (Buffer, crypto) automatically. No additional configuration is required.
70
+
55
71
  ## 🏗️ Package Architecture
56
72
 
57
- ### Unified Directory Structure
73
+ ### Source Code Structure
58
74
 
59
75
  ```
60
- packages/neozipkit/
61
- ├── src/ # TypeScript source files
62
- │ ├── browser/ # Browser-only implementations
63
- │ │ ├── ZipKitBrowser.ts
64
- │ │ ├── CertificateGeneratorBrowser.ts
65
- │ │ └── TokenVerifierBrowser.ts
66
- │ ├── server/ # Server-only implementations
67
- │ │ ├── blockchain/ # Blockchain integration utilities
68
- │ │ │ ├── TokenVerifier.ts # Verify tokenized ZIP files
69
- │ │ │ ├── NFTMinter.ts # Mint NFTs for ZIP files
70
- │ │ │ ├── WalletManager.ts # Manage wallet connections
71
- │ │ │ └── ... # Additional blockchain components
72
- │ │ └── platform/ # Server platform code
73
- │ │ ├── server/ # Server-specific ZIP operations
74
- │ │ └── servercomponents/ # OpenTimestamps & server utilities
75
- │ ├── shared/ # Shared utilities
76
- │ │ ├── components/ # Core ZIP utilities
77
- │ │ ├── constants/ # Headers, errors, etc.
78
- │ │ ├── types/ # Type definitions
79
- │ │ ├── ZipKit.ts # Main ZipKit class
80
- │ │ └── ZipEntry.ts # ZIP entry handling
81
- │ ├── browser-index.ts # Browser-specific exports
82
- │ └── index.ts # Main exports (all platforms)
83
- ├── dist/ # Compiled JavaScript output
84
- │ ├── browser.js/.d.ts # Browser-only bundle
85
- │ ├── server/ # Server bundle
86
- │ ├── shared/ # Shared code
87
- │ └── index.js/.d.ts # Main bundle
88
- ├── contracts/ # Smart contracts for NFT tokenization
89
- ├── examples/ # Usage examples
90
- └── docs/ # Documentation
76
+ src/
77
+ ├── Zipkit.ts # Core ZipKit class with buffer-based ZIP operations
78
+ ├── ZipEntry.ts # ZIP entry handling
79
+ ├── ZipCompress.ts # Compression algorithms
80
+ ├── ZipDecompress.ts # Decompression algorithms
81
+ ├── Logger.ts # Logging utility
82
+ ├── types.ts # Shared type definitions
83
+ ├── version.ts # Version information
84
+ ├── components/ # Core ZIP utilities
85
+ │ ├── HashCalculator.ts # Unified hash calculator (incremental hashing, accumulation, Merkle tree)
86
+ │ ├── ProgressTracker.ts # Progress tracking
87
+ │ ├── Support.ts # Feature support detection
88
+ │ └── Util.ts # General utilities (CRC32 delegates to ZipCrypto)
89
+ ├── constants/ # Constants and definitions
90
+ │ ├── Errors.ts # Error definitions
91
+ │ └── Headers.ts # ZIP header constants
92
+ ├── encryption/ # Encryption utilities
93
+ │ ├── index.ts # Encryption exports
94
+ │ ├── Manager.ts # Encryption manager (unified interface)
95
+ │ ├── types.ts # Encryption types
96
+ │ └── ZipCrypto.ts # ZIP crypto implementation (includes CRC32)
97
+ ├── browser/ # Browser-only implementations
98
+ │ ├── ZipkitBrowser.ts # Browser ZIP operations with Blob support
99
+ │ └── index.ts # Browser-specific exports
100
+ ├── node/ # Node.js-only implementations
101
+ │ ├── ZipkitNode.ts # Node.js file-based ZIP operations (extends Zipkit)
102
+ │ ├── ZipCompressNode.ts # Node.js compression with file I/O
103
+ │ ├── ZipDecompressNode.ts # Node.js decompression with file I/O
104
+ │ └── index.ts # Node.js exports
105
+ ├── blockchain/ # Blockchain integration module
106
+ │ ├── core/ # Core blockchain functionality
107
+ │ │ ├── ZipkitOTS.ts # OpenTimestamps utilities
108
+ │ │ ├── ZipkitVerifier.ts # Token verification
109
+ │ │ ├── ZipkitMinter.ts # NFT minting
110
+ │ │ ├── WalletManager.ts # Core wallet management
111
+ │ │ ├── contracts.ts # Contract addresses & ABIs
112
+ │ │ ├── types.ts # Blockchain types
113
+ │ │ └── index.ts # Core exports
114
+ │ ├── browser/ # Browser blockchain components
115
+ │ │ ├── WalletManagerBrowser.ts # Browser wallet management
116
+ │ │ ├── ZipkitMinterBrowser.ts # Browser minting
117
+ │ │ ├── TokenVerifierBrowser.ts # Browser token verification
118
+ │ │ └── index.ts # Browser exports
119
+ │ ├── node/ # Node.js blockchain components
120
+ │ │ └── WalletManagerNode.ts # Node.js wallet management (file system)
121
+ │ │ └── index.ts # Node.js exports
122
+ │ ├── index.ts # Main blockchain exports
123
+ │ └── README.md # Blockchain module documentation
124
+ ├── types/ # External module declarations
125
+ │ ├── index.ts # Type exports
126
+ │ ├── modules.d.ts # Module declarations
127
+ │ └── opentimestamps.d.ts # OpenTimestamps type definitions
128
+ └── index.ts # Main exports (all platforms)
91
129
  ```
92
130
 
131
+ ### Architecture
132
+
133
+ NeoZipKit provides platform-specific implementations optimized for different environments:
134
+
135
+ - **`ZipkitBrowser`** - Browser implementation using Blob API for memory-efficient operations
136
+ - **`ZipkitNode`** - Node.js implementation with file-based streaming for large files
137
+
138
+ Both implementations support:
139
+ - Multiple compression methods (Deflate, ZStandard, Stored)
140
+ - Streaming for large files
141
+ - Progress tracking
142
+ - Hash verification (CRC-32, SHA-256)
143
+
93
144
  ## 📚 Import Patterns
94
145
 
95
146
  ### Browser Applications (Recommended)
96
147
 
97
148
  ```typescript
98
149
  // Browser-only bundle (excludes Node.js dependencies)
99
- import { ZipKitBrowser, CertificateGeneratorBrowser } from 'neozipkit/browser';
100
- import { TOKENIZED_METADATA } from 'neozipkit/browser';
150
+ import { ZipkitBrowser } from 'neozipkit/browser';
151
+ import { TokenMetadata } from 'neozipkit/browser';
101
152
  ```
102
153
 
103
154
  ### Universal Applications (Next.js, Node.js)
104
155
 
105
156
  ```typescript
106
- // Main bundle (includes both browser and server when possible)
107
- import { ZipKitBrowser, CertificateGeneratorBrowser } from 'neozipkit';
108
- import { TOKENIZED_METADATA } from 'neozipkit/shared/constants/Headers';
157
+ // Main bundle
158
+ import Zipkit from 'neozipkit';
159
+ import { createTimestamp, verifyOts } from 'neozipkit/blockchain';
160
+ import { TokenMetadata } from 'neozipkit';
161
+ ```
162
+
163
+ ### Node.js-Only Components
164
+
165
+ ```typescript
166
+ // Node.js-specific components
167
+ import { ZipkitNode } from 'neozipkit/node';
168
+ import { ZipCompress } from 'neozipkit';
169
+ import { createTimestamp, verifyOts } from 'neozipkit/blockchain';
170
+ import { ZipkitVerifier, ZipkitMinter } from 'neozipkit/blockchain';
109
171
  ```
110
172
 
111
- ### Server-Only Components (Node.js)
173
+ ### Blockchain Components
112
174
 
113
175
  ```typescript
114
- // Direct TypeScript imports for server components
115
- import { TokenVerifier } from 'neozipkit/server/blockchain/TokenVerifier';
116
- import { ZipKitOTS } from 'neozipkit/server/platform/servercomponents/ZipKitOTS';
176
+ // Blockchain functionality (works in both browser and Node.js)
177
+ import {
178
+ ZipkitVerifier,
179
+ ZipkitMinter,
180
+ WalletManager,
181
+ createTimestamp,
182
+ verifyOts
183
+ } from 'neozipkit/blockchain';
117
184
  ```
118
185
 
119
186
  ## 🔗 Blockchain Integration
@@ -133,30 +200,17 @@ NeoZipKit includes comprehensive blockchain integration for creating and verifyi
133
200
  - **`TokenVerifier`** - Verify tokenized ZIP files against blockchain
134
201
  - **`NFTMinter`** - Mint NFTs for ZIP files
135
202
  - **`TokenQuerier`** - Query token information from blockchain
136
- - **`CertificateToken`** - Generate certificates for tokenized files
203
+ - **`TokenCertificate`** - Generate certificates for tokenized files
137
204
  - **`ZipTokenProcessor`** - Process ZIP files for tokenization
138
205
  - **`WalletManager`** - Manage wallet connections and networks
139
206
 
140
- ### Usage Example
207
+ ### Usage
141
208
 
142
- ```typescript
143
- import { ZipTokenProcessor, MintingOptions } from 'neozipkit/server/blockchain';
144
-
145
- const options: MintingOptions = {
146
- wallet: 'path/to/wallet.json',
147
- network: 'base-sepolia',
148
- mintToken: true
149
- };
150
-
151
- const processor = new ZipTokenProcessor('archive.zip', 'merkle_root_hash', options);
152
- const result = await processor.processZipToken(options);
153
-
154
- if (result.error) {
155
- console.error('Processing failed:', result.error);
156
- } else {
157
- console.log('Success!', result);
158
- }
159
- ```
209
+ See the blockchain examples for complete implementations:
210
+ - **`examples/blockchain-tokenize.ts`** - Create and mint tokenized ZIP files
211
+ - **`examples/verify-tokenized-zip.ts`** - Verify tokenized ZIP files on blockchain
212
+
213
+ For detailed blockchain integration documentation, see [`src/blockchain/README.md`](src/blockchain/README.md).
160
214
 
161
215
  ## 🎯 Smart Contracts
162
216
 
@@ -170,60 +224,38 @@ The package includes production-ready smart contracts for ZIP file tokenization:
170
224
  - **Use cases**: Certificates, public records, open-source projects
171
225
  - **Symbol**: `NZIP`
172
226
 
173
- #### 🔒 Private Contract (`NZIP-NFT-Private.sol`)
174
- - **Owner-only verification** - Only token owners can verify their tokens
175
- - **Private blockchain metadata** - Sensitive data hidden from public
176
- - **Selective authorization** - Owners can authorize specific verifiers
177
- - **Use cases**: Medical records, legal documents, private archives
178
- - **Symbol**: `NZIPPRV`
179
227
 
180
228
  ### Current Deployment
181
229
 
182
- **✅ Production Contract (v2.0)**:
230
+ **✅ Production Contract (v2.10)**:
183
231
  ```
184
- Address: 0xFD76a5d420704F34d84b0767961835c43D7b30a8
232
+ Address: 0x6313074922717351986929879903441992482216
185
233
  Network: Base Sepolia
186
- Version: 2.0.0
234
+ Version: 2.10.0
187
235
  Status: ✅ ACTIVE - Use for all new integrations
188
- Explorer: https://sepolia.basescan.org/address/0xFD76a5d420704F34d84b0767961835c43D7b30a8
236
+ Explorer: https://sepolia.basescan.org/address/0x6313074922717351986929879903441992482216
189
237
  ```
190
238
 
191
239
  ### Contract Deployment
192
240
 
193
- Deploy your own contracts using the included scripts:
194
-
195
- ```bash
196
- # Setup deployment configuration
197
- npm run setup-deployment
198
-
199
- # Deploy both contracts (public + private)
200
- npm run deploy:both
241
+ For contract deployment and verification, see [`contracts/README.md`](contracts/README.md) for complete instructions.
201
242
 
202
- # Deploy only public contract
203
- npm run deploy:public
204
-
205
- # Deploy to mainnet
206
- npm run deploy:both:mainnet
207
- ```
208
-
209
- ## 🔧 Development Workflow
243
+ ## 🔧 Development
210
244
 
211
245
  ### Build Process
212
246
 
213
247
  ```bash
214
- # Full build process
215
- npm run build
248
+ # Production build
249
+ yarn build
216
250
 
217
- # Individual steps
218
- npm run clean # Remove compiled files
219
- npm run compile # TypeScript compilation
220
- npm run watch # Watch mode for development
251
+ # Development build (for feature branches)
252
+ yarn dev:build
253
+
254
+ # Watch mode
255
+ yarn dev:watch
221
256
  ```
222
257
 
223
- This runs:
224
- 1. `npm run clean` - Removes old compiled files
225
- 2. `npm run compile` - Compiles TypeScript to dist/
226
- 3. `npm run create-browser-entry` - Creates browser-only bundle
258
+ See [`docs/DEV_BUILD.md`](docs/DEV_BUILD.md) for details on the development build system.
227
259
 
228
260
  ### TypeScript Configuration
229
261
 
@@ -235,58 +267,207 @@ This runs:
235
267
 
236
268
  ## 📖 API Reference
237
269
 
270
+ ### Zipkit Class
271
+
272
+ **Zipkit** is the core ZIP file processing library with dual-mode support for efficient handling of ZIP archives of any size.
273
+
274
+ #### Architecture
275
+
276
+ Zipkit uses a dual-mode architecture:
277
+ - **Buffer-based mode**: Entire ZIP file is loaded into memory for fast random access. Ideal for small to medium archives (< 100MB).
278
+ - **File-based mode**: ZIP file is accessed via file handles with chunked reading/writing. Ideal for large archives (> 100MB) to minimize memory usage.
279
+
280
+ #### Core Components
281
+
282
+ - **ZipCompress**: Handles compression of ZIP entries (STORED, DEFLATED, ZSTD)
283
+ - **ZipDecompress**: Handles decompression of ZIP entries with streaming support
284
+ - **Zipkit**: Core class that manages parsing and loading of ZIP file structure (buffer-based)
285
+ - **ZipkitNode**: Extends Zipkit with file-based operations for Node.js environments
286
+ - **zipEntries[]**: Protected array that serves as the single source of truth for ZIP entry order and metadata (accessible by subclasses, use `getDirectory()` for external access)
287
+
288
+ #### Entry Management
289
+
290
+ The `zipEntries[]` array is the central repository for all ZIP entries. It maintains the order of entries as they appear in the ZIP file's Central Directory, ensuring consistency between write order and read order. Entries are automatically added to this array when:
291
+ - Loading an existing ZIP file via `loadZip()` or `loadZipFile()`
292
+ - Creating new entries via `createZipEntry()`
293
+
294
+ **Note**: The `zipEntries[]` array is now **protected** (not public). External code should use `getDirectory()` to access entries. Subclasses (like `ZipkitNode` and `ZipkitBrowser`) can still access it directly.
295
+
296
+ #### Usage Patterns
297
+
298
+ See the examples directory for complete usage patterns:
299
+ - **Creating ZIPs**: `examples/create-zip.ts`
300
+ - **Extracting ZIPs**: `examples/extract-zip.ts`
301
+ - **Listing ZIPs**: `examples/list-zip.ts`
302
+
303
+ #### Compression Methods
304
+
305
+ Zipkit supports three compression methods:
306
+ - **STORED (0)**: No compression, data stored as-is
307
+ - **DEFLATED (8)**: Standard deflate compression (default)
308
+ - **ZSTD (93)**: Zstandard compression (faster, modern algorithm)
309
+
310
+ #### Hash Calculation
311
+
312
+ Zipkit calculates and verifies file integrity using:
313
+ - **CRC-32**: Standard ZIP checksum (always calculated via `ZipCrypto.crc32()`)
314
+ - **SHA-256**: Optional cryptographic hash for enhanced security
315
+
316
+ #### ZipDecompress Component
317
+
318
+ ZipDecompress is the decompression component of Zipkit, responsible for:
319
+ - Extracting entries from ZIP archives (buffer-based or file-based)
320
+ - Decompressing data using STORED, DEFLATED, or ZSTD methods
321
+ - Verifying file integrity via CRC-32 or SHA-256 hashes
322
+ - Streaming decompression for memory-efficient extraction of large files
323
+
324
+ **Methods:**
325
+ - `extract(entry, skipHashCheck?)`: Extracts a ZIP entry from a buffer-based ZIP archive
326
+ - `extractToFile(entry, outputPath, options?)`: Extracts a ZIP entry directly to disk with true streaming
327
+
328
+ **Supported Compression Methods:**
329
+ - **STORED (0)**: No decompression needed, data passed through unchanged
330
+ - **DEFLATED (8)**: Standard deflate decompression using pako library
331
+ - **ZSTD (93)**: Zstandard decompression (lazy initialization on first use)
332
+
333
+ **Hash Verification:**
334
+ By default, extracted data is verified against stored hashes:
335
+ - If entry has SHA-256 hash, it is verified
336
+ - Otherwise, CRC-32 checksum is verified
337
+ - Hash verification can be skipped by passing `skipHashCheck: true`
338
+
339
+ **Streaming Architecture:**
340
+ For file-based ZIPs, ZipDecompress uses a streaming architecture:
341
+ 1. Reads compressed data in chunks from the ZIP file
342
+ 2. Decompresses chunks incrementally
343
+ 3. Writes decompressed chunks directly to output file
344
+ 4. Calculates and verifies hash during decompression
345
+
346
+ #### ZipCompress Component
347
+
348
+ ZipCompress is the compression component of Zipkit, responsible for:
349
+ - Compressing data using STORED, DEFLATED, or ZSTD methods
350
+ - Calculating CRC-32 and SHA-256 hashes during compression
351
+ - Chunked processing for memory-efficient compression of large files
352
+ - Supporting both buffer-based and streaming compression modes
353
+
354
+ **Methods:**
355
+ - `compressData(entry, data, options?, onOutputBuffer?)`: Main compression entry point
356
+ - `deflateCompress(data, options?, bufferSize?, entry?, onOutputBuffer?)`: Compresses using deflate algorithm
357
+ - `zstdCompress(input, options?, bufferSize?, entry?, onOutputBuffer?)`: Compresses using Zstandard algorithm
358
+
359
+ **Compression Options:**
360
+ - `level`: Compression level 1-9 (0 = store, default: 6)
361
+ - `useSHA256`: Calculate SHA-256 hash in addition to CRC-32 (default: false)
362
+ - `useZstd`: Use Zstandard compression instead of deflate (default: false)
363
+ - `bufferSize`: Override default buffer size for chunked processing (default: 512KB)
364
+
365
+ **Compression Method Selection:**
366
+ ZipCompress automatically selects the compression method based on options:
367
+ - **STORED**: If `options.level === 0` or file is too small for ZSTD (< 100 bytes)
368
+ - **ZSTD**: If `options.useZstd === true` and file is >= 100 bytes
369
+ - **DEFLATED**: Default method (standard ZIP compression)
370
+
371
+ **Hash Calculation:**
372
+ Hash calculation is performed incrementally during compression using HashCalculator:
373
+ - **CRC-32**: Always calculated for standard ZIP compatibility (via `ZipCrypto.crc32()`)
374
+ - **SHA-256**: Calculated if `options.useSHA256 === true`
375
+
376
+ **Chunked Processing:**
377
+ For large files, ZipCompress processes data in chunks for memory efficiency:
378
+ - **STORED**: Outputs chunks directly without accumulating
379
+ - **DEFLATED**: Streams compression using chunked reader, can output incrementally
380
+ - **ZSTD**: Accumulates all chunks, then compresses (requires full buffer)
381
+
382
+ **Streaming Output:**
383
+ When `onOutputBuffer` callback is provided, compressed data chunks are written incrementally as they are produced, allowing writing compressed data directly to output streams without accumulating everything in memory.
384
+
385
+ #### Merkle Root Calculation
386
+
387
+ For blockchain integration, Zipkit can calculate Merkle roots from entry SHA-256 hashes, automatically excluding metadata files (META-INF/*) to ensure consistent calculation across different ZIP creation methods.
388
+
238
389
  ### Core Classes
239
390
 
240
- - **`ZipKit`** - Core ZIP functionality (shared)
241
- - **`ZipKitBrowser`** - Browser-compatible ZIP operations
242
- - **`ZipKitServer`** - Server-side ZIP operations with full Node.js support
391
+ - **`ZipKit`** - Core ZIP functionality (shared across all platforms, buffer-based)
392
+ - **`ZipkitBrowser`** - Browser-compatible ZIP operations (extends Zipkit, adds Blob support)
393
+ - **`ZipkitNode`** - Node.js file-based ZIP operations (extends Zipkit, adds file I/O)
243
394
  - **`ZipEntry`** - ZIP entry representation and manipulation
244
- - **`HashAccumulator`** - Hash accumulation for Merkle tree verification
395
+ - **`HashCalculator`** - Unified hash calculator supporting incremental hashing, hash accumulation, and Merkle tree operations
396
+
397
+ ### Core Components
398
+
399
+ - **`ZipCompress`** - Compression algorithms (shared, handles both buffer and file modes)
400
+ - **`ZipDecompress`** - Decompression algorithms (shared, handles both buffer and file modes)
401
+ - **`ProgressTracker`** - Real-time progress tracking for operations
402
+ - **`EncryptionManager`** - Encryption manager (unified encryption interface)
403
+ - **`ZipCrypto`** - ZIP crypto implementation (includes CRC32 calculation)
404
+
405
+ ### Blockchain Components
406
+
407
+ - **`ZipkitVerifier`** - Verify tokenized ZIP files against blockchain
408
+ - **`ZipkitMinter`** - Mint NFTs for ZIP files
409
+ - **`WalletManager`** - Manage wallet connections and networks
410
+ - **`createTimestamp`** - Create OpenTimestamps proofs
411
+ - **`verifyOts`** - Verify OpenTimestamps proofs
245
412
 
246
413
  ### Platform-Specific Components
247
414
 
415
+ #### Node.js Components
416
+
417
+ - **`ZipkitNode`** - Node.js file-based ZIP operations (extends Zipkit)
418
+
419
+ **File Loading:**
420
+ - `loadZipFile(filePath)` - Load ZIP from file path (asynchronous)
421
+ - `loadZipFromFile(filePath)` - Alias for `loadZipFile()`
422
+
423
+ **File Extraction:**
424
+ - `extractZipFile(archivePath, destination, options?)` - Extract entire ZIP file to directory (main unzip function with comprehensive options)
425
+ - `extractToFile(entry, outputPath, options?)` - Extract entry to file with streaming support
426
+ - `extractEntryToFile(entry, outputPath, options?)` - Alias for `extractToFile()`
427
+ - `extractEntryToPath(entry, outputPath, options?)` - Extract entry with advanced features (symlinks, hardlinks, timestamps, permissions)
428
+ - `extractAll(outputDir, options?)` - Extract all entries to directory with progress tracking
429
+
430
+ **File Compression:**
431
+ - `compressFile(filePath, entry, options?)` - Compress a file from disk
432
+ - `compressFileStream(filePath, entry, options?, onOutputBuffer?)` - Compress a file using streaming for large files
433
+ - `compressData(entry, data, options?, onOutputBuffer?)` - Compress data buffer (overrides base class)
434
+
435
+ **ZIP File Creation:**
436
+ - `createZipFromFiles(filePaths, outputPath, options?)` - Create a ZIP file from multiple file paths
437
+ - `addFileToZip(filePath, entryName?, options?)` - Add a file to the current ZIP
438
+
439
+ **Advanced ZIP Creation (Low-level API):**
440
+ - `initializeZipFile(outputPath)` - Initialize ZIP file for writing, returns ZipFileWriter
441
+ - `prepareEntryFromFile(filePath, entryName?)` - Prepare ZipEntry from file path with metadata
442
+ - `writeZipEntry(writer, entry, filePath, options?, callbacks?)` - Write a ZIP entry to the file
443
+ - `writeCentralDirectory(writer, entries, options?)` - Write central directory
444
+ - `writeEndOfCentralDirectory(writer, totalEntries, centralDirSize, centralDirOffset, comment?)` - Write end of central directory
445
+ - `finalizeZipFile(writer)` - Finalize and close ZIP file
446
+
447
+ **File Management:**
448
+ - `getFileHandle()` - Get underlying file handle for advanced operations
449
+ - `closeFile()` - Close file handle explicitly
450
+ - `copyEntry(entry)` - Copy entry from file-based ZIP (returns Buffer)
451
+
248
452
  #### Browser Components
249
- - **`CertificateGeneratorBrowser`** - Generate verification certificates
250
453
  - **`TokenVerifierBrowser`** - Browser-based token verification
251
- - **`ZipKitStampBrowser`** - Browser timestamping utilities
252
-
253
- #### Server Components
254
- - **`ZipKitOTS`** - OpenTimestamps integration
255
- - **Blockchain Classes** - Complete blockchain integration suite
454
+ - **`WalletManagerBrowser`** - Browser wallet management
256
455
 
257
456
  ### Constants and Types
258
457
 
259
458
  - **`constants/Headers`** - ZIP header constants and compression methods
260
459
  - **`constants/Errors`** - Error definitions
261
- - **`shared/types`** - TypeScript type definitions
460
+ - **`types`** - TypeScript type definitions
262
461
  - **`CMP_METHOD`** - Compression method constants
263
462
 
264
463
  ### Compression Methods
265
464
 
266
- ```typescript
267
- import { CMP_METHOD } from 'neozipkit/shared/constants/Headers';
268
-
269
- // Available compression methods
270
- const compressionType = entry.cmpMethod;
271
-
272
- if (compressionType === CMP_METHOD.ZSTD) {
273
- console.log('ZStandard compression');
274
- } else if (compressionType === CMP_METHOD.DEFLATED) {
275
- console.log('Deflate compression');
276
- } else if (compressionType === CMP_METHOD.STORED) {
277
- console.log('No compression');
278
- }
279
- ```
280
-
281
- ### Hash Accumulation
465
+ Zipkit supports three compression methods:
466
+ - **STORED (0)**: No compression, data stored as-is
467
+ - **DEFLATED (8)**: Standard deflate compression (default)
468
+ - **ZSTD (93)**: Zstandard compression (faster, modern algorithm)
282
469
 
283
- ```typescript
284
- import { HashAccumulator } from 'neozipkit/shared/components/HashAccumulator';
285
-
286
- const accumulator = new HashAccumulator();
287
- accumulator.addFile('example.txt', fileBuffer);
288
- const merkleRoot = accumulator.finalize();
289
- ```
470
+ See the examples for usage patterns with different compression methods.
290
471
 
291
472
  ## 🌐 Network Support
292
473
 
@@ -300,27 +481,34 @@ const merkleRoot = accumulator.finalize();
300
481
 
301
482
  ### Network Configuration
302
483
 
303
- ```typescript
304
- // Networks are configured in blockchain components
305
- const networkConfig = {
306
- 'base': {
307
- chainId: 8453,
308
- rpcUrl: 'https://mainnet.base.org',
309
- explorer: 'https://basescan.org'
310
- },
311
- 'base-sepolia': {
312
- chainId: 84532,
313
- rpcUrl: 'https://sepolia.base.org',
314
- explorer: 'https://sepolia.basescan.org'
315
- }
316
- };
317
- ```
484
+ Network configurations are defined in `src/blockchain/core/contracts.ts`. Supported networks include Base Mainnet, Base Sepolia, Ethereum, Polygon, and Arbitrum.
485
+
486
+ See the blockchain examples for network usage.
318
487
 
319
488
  ## 🔐 Security Considerations
320
489
 
490
+ ### Private Key Security
491
+
492
+ **CRITICAL**: Never commit private keys to version control or hardcode them in your code.
493
+
494
+ - ✅ **Use environment variables** - Store private keys in `.env` file (see `.env.example`)
495
+ - ✅ **Testnet only for examples** - Never use mainnet keys in examples
496
+ - ✅ **Exclude sensitive files** - Wallet files and `.env` files are automatically excluded from git
497
+ - ✅ **Secure key management for production** - Use HSMs or KMS for production applications
498
+
499
+ **Quick Security Checklist:**
500
+ - [ ] Private keys stored in environment variables (not hardcoded)
501
+ - [ ] `.env` file excluded from git (automatically via `.gitignore`)
502
+ - [ ] Wallet files excluded from git (automatically via `.gitignore`)
503
+ - [ ] Only testnet keys used for examples
504
+ - [ ] Secure key management for production deployments
505
+
506
+ For comprehensive security guidelines, see [SECURITY.md](SECURITY.md).
507
+
321
508
  ### Development Best Practices
322
509
 
323
510
  - **Private Keys**: Never commit private keys or mnemonics to version control
511
+ - **Environment Variables**: Use `.env` file for private keys (see `.env.example` template)
324
512
  - **Network Security**: Use secure RPC endpoints and validate all inputs
325
513
  - **Smart Contract Audits**: Audit contracts before production deployment
326
514
  - **Error Handling**: Implement comprehensive error handling for all operations
@@ -346,33 +534,14 @@ const networkConfig = {
346
534
  - **`@types/node`** - Node.js type definitions
347
535
  - **`typescript`** - TypeScript compiler
348
536
 
349
- ## 🔄 Migration Guide
350
-
351
- ### From Previous Versions
352
-
353
- If upgrading from previous versions:
354
-
355
- 1. **Update Import Paths**:
356
- ```typescript
357
- // OLD
358
- import { TokenVerifier } from 'neozipkit/server-components/blockchain/TokenVerifier';
359
-
360
- // NEW
361
- import { checkForTokenizationServer } from 'neozipkit/server/blockchain/TokenVerifier';
362
- ```
363
-
364
- 2. **Browser Imports**: Replace main package imports with browser-specific imports for browser applications
365
- 3. **Contract Addresses**: Update to use the new production contract address
366
- 4. **Build Process**: Remove any manual copying scripts - everything now uses TypeScript compilation
367
-
368
537
  ## 🤝 Contributing
369
538
 
370
539
  ### Development Setup
371
540
 
372
- 1. Clone the repository and install dependencies
541
+ 1. Clone the repository and install dependencies: `yarn install`
373
542
  2. Make changes to TypeScript files in `src/`
374
- 3. Run `npm run build` to compile changes
375
- 4. Test changes in consuming applications
543
+ 3. Run `yarn dev:build` for development builds
544
+ 4. Test changes using the examples: `ts-node examples/create-zip.ts`
376
545
  5. Commit only source files, not generated files
377
546
 
378
547
  ### Making Changes
@@ -381,7 +550,9 @@ If upgrading from previous versions:
381
550
  - Update exports in `src/index.ts` if adding new public modules
382
551
  - Update `package.json` exports if creating new public modules
383
552
  - Run build process to generate JavaScript
384
- - Test in portal application
553
+ - Test using examples before submitting PRs
554
+
555
+ For detailed contributing guidelines, see [`docs/REPOSITORY_MANAGEMENT.md`](docs/REPOSITORY_MANAGEMENT.md).
385
556
 
386
557
  ## 📄 License
387
558
 
@@ -392,9 +563,9 @@ MIT
392
563
  Ready to start using NeoZipKit? Here are some next steps:
393
564
 
394
565
  1. **Install the package**: `yarn add neozipkit`
395
- 2. **Choose your use case**: Basic ZIP operations, OpenTimestamps, or NFT tokenization
396
- 3. **Follow the examples**: Check the `examples/` directory for complete implementations
397
- 4. **Deploy contracts**: Use the deployment scripts for blockchain features
398
- 5. **Build something amazing**: Leverage the full power of blockchain-backed file verification
566
+ 2. **Run the examples**: Start with `ts-node examples/create-zip.ts` to see basic usage
567
+ 3. **Explore the examples**: Check [`examples/README.md`](examples/README.md) for all available examples
568
+ 4. **Read the API docs**: See the API Reference section below for detailed method documentation
569
+ 5. **Try blockchain features**: Run `examples/blockchain-tokenize.ts` for NFT tokenization
399
570
 
400
- For detailed examples and advanced usage, explore the examples directory and blockchain integration documentation.
571
+ For detailed examples and advanced usage, explore the `examples/` directory and [`src/blockchain/README.md`](src/blockchain/README.md) for blockchain integration.