neozipkit 0.1.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 (135) hide show
  1. package/README.md +400 -0
  2. package/contracts/Lock.sol +34 -0
  3. package/contracts/bytecode.txt +1 -0
  4. package/contracts/compile-contract.js +168 -0
  5. package/contracts/deploy/deploy-both-contracts.js +286 -0
  6. package/contracts/deploy/deploy-enhanced-contract.js +197 -0
  7. package/contracts/deploy/deploy-private-contract.js +190 -0
  8. package/contracts/deploy/deploy-public-clean.js +1063 -0
  9. package/contracts/deploy/deploy-public-contract.js +1107 -0
  10. package/contracts/deployment.config.example.js +25 -0
  11. package/contracts/remix-compile.js +222 -0
  12. package/contracts/setup-deployment.js +51 -0
  13. package/contracts/src/NZIP-NFT-Private.sol +350 -0
  14. package/contracts/src/NZIP-NFT.sol +265 -0
  15. package/contracts/src/ZipFileNFT-DEPRECATED-6field.sol +260 -0
  16. package/contracts/src/ZipFileNFT-DEPRECATED-Enhanced.sol +289 -0
  17. package/dist/browser/CertificateGeneratorBrowser.d.ts +75 -0
  18. package/dist/browser/CertificateGeneratorBrowser.js +433 -0
  19. package/dist/browser/TokenVerifierBrowser.d.ts +76 -0
  20. package/dist/browser/TokenVerifierBrowser.js +299 -0
  21. package/dist/browser/ZipKitBrowser.d.ts +18 -0
  22. package/dist/browser/ZipKitBrowser.js +250 -0
  23. package/dist/browser/ZipKitStampBrowser.d.ts +2 -0
  24. package/dist/browser/ZipKitStampBrowser.js +12 -0
  25. package/dist/browser-index.d.ts +21 -0
  26. package/dist/browser-index.js +58 -0
  27. package/dist/browser.d.ts +21 -0
  28. package/dist/browser.js +58 -0
  29. package/dist/index.d.ts +29 -0
  30. package/dist/index.js +76 -0
  31. package/dist/server/blockchain/CertificateToken.d.ts +48 -0
  32. package/dist/server/blockchain/CertificateToken.js +386 -0
  33. package/dist/server/blockchain/NFTMinter.d.ts +41 -0
  34. package/dist/server/blockchain/NFTMinter.js +323 -0
  35. package/dist/server/blockchain/TokenQuerier.d.ts +31 -0
  36. package/dist/server/blockchain/TokenQuerier.js +259 -0
  37. package/dist/server/blockchain/TokenVerifier.d.ts +20 -0
  38. package/dist/server/blockchain/TokenVerifier.js +395 -0
  39. package/dist/server/blockchain/WalletAnalyzer.d.ts +81 -0
  40. package/dist/server/blockchain/WalletAnalyzer.js +356 -0
  41. package/dist/server/blockchain/WalletFormatter.d.ts +39 -0
  42. package/dist/server/blockchain/WalletFormatter.js +196 -0
  43. package/dist/server/blockchain/WalletManager.d.ts +46 -0
  44. package/dist/server/blockchain/WalletManager.js +294 -0
  45. package/dist/server/blockchain/ZipMetadata.d.ts +27 -0
  46. package/dist/server/blockchain/ZipMetadata.js +131 -0
  47. package/dist/server/blockchain/ZipTokenProcessor.d.ts +44 -0
  48. package/dist/server/blockchain/ZipTokenProcessor.js +204 -0
  49. package/dist/server/blockchain/constants.d.ts +102 -0
  50. package/dist/server/blockchain/constants.js +968 -0
  51. package/dist/server/blockchain/index.d.ts +9 -0
  52. package/dist/server/blockchain/index.js +44 -0
  53. package/dist/server/blockchain/test-certificate.d.ts +8 -0
  54. package/dist/server/blockchain/test-certificate.js +100 -0
  55. package/dist/server/blockchain/types.d.ts +69 -0
  56. package/dist/server/blockchain/types.js +51 -0
  57. package/dist/server/platform/server/ZipKitServer.d.ts +105 -0
  58. package/dist/server/platform/server/ZipKitServer.js +437 -0
  59. package/dist/server/platform/servercomponents/ZipKitOTS.d.ts +91 -0
  60. package/dist/server/platform/servercomponents/ZipKitOTS.js +271 -0
  61. package/dist/shared/ZipEntry.d.ts +131 -0
  62. package/dist/shared/ZipEntry.js +686 -0
  63. package/dist/shared/ZipKit.d.ts +249 -0
  64. package/dist/shared/ZipKit.js +789 -0
  65. package/dist/shared/components/CertificateOTS.d.ts +15 -0
  66. package/dist/shared/components/CertificateOTS.js +116 -0
  67. package/dist/shared/components/FileSys.d.ts +2 -0
  68. package/dist/shared/components/FileSys.js +113 -0
  69. package/dist/shared/components/HashAccumulator.d.ts +55 -0
  70. package/dist/shared/components/HashAccumulator.js +100 -0
  71. package/dist/shared/components/Support.d.ts +63 -0
  72. package/dist/shared/components/Support.js +70 -0
  73. package/dist/shared/components/Util.d.ts +21 -0
  74. package/dist/shared/components/Util.js +115 -0
  75. package/dist/shared/components/ZipCrypto.d.ts +3 -0
  76. package/dist/shared/components/ZipCrypto.js +78 -0
  77. package/dist/shared/components/merkleTree.d.ts +66 -0
  78. package/dist/shared/components/merkleTree.js +136 -0
  79. package/dist/shared/constants/Errors.d.ts +53 -0
  80. package/dist/shared/constants/Errors.js +69 -0
  81. package/dist/shared/constants/Headers.d.ts +167 -0
  82. package/dist/shared/constants/Headers.js +191 -0
  83. package/dist/shared/types/index.d.ts +21 -0
  84. package/dist/shared/types/index.js +3 -0
  85. package/dist/shared/types.d.ts +33 -0
  86. package/dist/shared/types.js +8 -0
  87. package/dist/shared/version.d.ts +4 -0
  88. package/dist/shared/version.js +7 -0
  89. package/dist/types/index.d.ts +21 -0
  90. package/dist/types/index.js +3 -0
  91. package/examples/unzip-token.ts +488 -0
  92. package/examples/zip-token.ts +604 -0
  93. package/package.json +117 -0
  94. package/src/browser/CertificateGeneratorBrowser.ts +498 -0
  95. package/src/browser/TokenVerifierBrowser.ts +344 -0
  96. package/src/browser/ZipKitBrowser.ts +242 -0
  97. package/src/browser/ZipKitStampBrowser.ts +9 -0
  98. package/src/browser-index.ts +36 -0
  99. package/src/index.ts +48 -0
  100. package/src/server/blockchain/CertificateToken.ts +444 -0
  101. package/src/server/blockchain/NFTMinter.ts +357 -0
  102. package/src/server/blockchain/TokenQuerier.ts +287 -0
  103. package/src/server/blockchain/TokenVerifier.ts +453 -0
  104. package/src/server/blockchain/WalletAnalyzer.ts +397 -0
  105. package/src/server/blockchain/WalletFormatter.ts +206 -0
  106. package/src/server/blockchain/WalletManager.ts +294 -0
  107. package/src/server/blockchain/ZipMetadata.ts +117 -0
  108. package/src/server/blockchain/ZipTokenProcessor.ts +234 -0
  109. package/src/server/blockchain/constants.ts +969 -0
  110. package/src/server/blockchain/index.ts +42 -0
  111. package/src/server/blockchain/test-certificate.ts +137 -0
  112. package/src/server/blockchain/types.ts +134 -0
  113. package/src/server/platform/server/ZipKitServer.ts +459 -0
  114. package/src/server/platform/servercomponents/ZipKitOTS.ts +313 -0
  115. package/src/server/platform/servercomponents/opentimestamps.d.ts +23 -0
  116. package/src/shared/ZipEntry.ts +767 -0
  117. package/src/shared/ZipKit.ts +899 -0
  118. package/src/shared/components/CertificateOTS.ts +132 -0
  119. package/src/shared/components/FileSys.ts +87 -0
  120. package/src/shared/components/HashAccumulator.ts +113 -0
  121. package/src/shared/components/Support.ts +77 -0
  122. package/src/shared/components/Util.ts +113 -0
  123. package/src/shared/components/ZipCrypto.ts +91 -0
  124. package/src/shared/components/merkleTree.ts +162 -0
  125. package/src/shared/constants/Errors.ts +82 -0
  126. package/src/shared/constants/Headers.ts +203 -0
  127. package/src/shared/types/index.ts +25 -0
  128. package/src/shared/types/modules.d.ts +22 -0
  129. package/src/shared/types/opentimestamps.d.ts +23 -0
  130. package/src/shared/types.d.ts +8 -0
  131. package/src/shared/types.ts +43 -0
  132. package/src/shared/version.ts +4 -0
  133. package/src/types/index.ts +25 -0
  134. package/src/types/modules.d.ts +22 -0
  135. package/src/types/opentimestamps.d.ts +23 -0
@@ -0,0 +1,9 @@
1
+ export * from './types';
2
+ export { WalletManager } from './WalletManager';
3
+ export { NFTMinter } from './NFTMinter';
4
+ export { ZipTokenProcessor } from './ZipTokenProcessor';
5
+ export { ZipMetadata } from './ZipMetadata';
6
+ export { checkForTokenization, TokenVerificationOptions, TokenVerificationResult } from './TokenVerifier';
7
+ export { queryBlockchainForExistingToken, queryWalletTokens, ExistingTokenInfo, TokenQueryOptions } from './TokenQuerier';
8
+ export { WalletAnalyzer, TokenInfo, NZipTokenDetails, WalletBasicInfo, TokenScanResult, CommonTokenConfig } from './WalletAnalyzer';
9
+ export { WalletFormatter } from './WalletFormatter';
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.WalletFormatter = exports.WalletAnalyzer = exports.queryWalletTokens = exports.queryBlockchainForExistingToken = exports.checkForTokenization = exports.ZipMetadata = exports.ZipTokenProcessor = exports.NFTMinter = exports.WalletManager = void 0;
18
+ // Export all types
19
+ __exportStar(require("./types"), exports);
20
+ // Export wallet management
21
+ var WalletManager_1 = require("./WalletManager");
22
+ Object.defineProperty(exports, "WalletManager", { enumerable: true, get: function () { return WalletManager_1.WalletManager; } });
23
+ // Export NFT minting
24
+ var NFTMinter_1 = require("./NFTMinter");
25
+ Object.defineProperty(exports, "NFTMinter", { enumerable: true, get: function () { return NFTMinter_1.NFTMinter; } });
26
+ // Export main processor
27
+ var ZipTokenProcessor_1 = require("./ZipTokenProcessor");
28
+ Object.defineProperty(exports, "ZipTokenProcessor", { enumerable: true, get: function () { return ZipTokenProcessor_1.ZipTokenProcessor; } });
29
+ // Export ZIP metadata utilities
30
+ var ZipMetadata_1 = require("./ZipMetadata");
31
+ Object.defineProperty(exports, "ZipMetadata", { enumerable: true, get: function () { return ZipMetadata_1.ZipMetadata; } });
32
+ // Export token verification utilities
33
+ var TokenVerifier_1 = require("./TokenVerifier");
34
+ Object.defineProperty(exports, "checkForTokenization", { enumerable: true, get: function () { return TokenVerifier_1.checkForTokenization; } });
35
+ // Export token querying utilities
36
+ var TokenQuerier_1 = require("./TokenQuerier");
37
+ Object.defineProperty(exports, "queryBlockchainForExistingToken", { enumerable: true, get: function () { return TokenQuerier_1.queryBlockchainForExistingToken; } });
38
+ Object.defineProperty(exports, "queryWalletTokens", { enumerable: true, get: function () { return TokenQuerier_1.queryWalletTokens; } });
39
+ // Export wallet analysis utilities
40
+ var WalletAnalyzer_1 = require("./WalletAnalyzer");
41
+ Object.defineProperty(exports, "WalletAnalyzer", { enumerable: true, get: function () { return WalletAnalyzer_1.WalletAnalyzer; } });
42
+ // Export wallet formatting utilities
43
+ var WalletFormatter_1 = require("./WalletFormatter");
44
+ Object.defineProperty(exports, "WalletFormatter", { enumerable: true, get: function () { return WalletFormatter_1.WalletFormatter; } });
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Test/Demo script for CertificateToken functionality
4
+ *
5
+ * This demonstrates how to generate certificates for tokenized ZIP files
6
+ * independently of the neozipkit integration.
7
+ */
8
+ export {};
@@ -0,0 +1,100 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ /**
4
+ * Test/Demo script for CertificateToken functionality
5
+ *
6
+ * This demonstrates how to generate certificates for tokenized ZIP files
7
+ * independently of the neozipkit integration.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ const CertificateToken_1 = require("./CertificateToken");
11
+ const constants_1 = require("./constants");
12
+ // Example token information
13
+ const sampleTokenInfo = {
14
+ tokenId: "10",
15
+ contractAddress: constants_1.CURRENT_DEPLOYMENT.address, // NZIP NFT Contract v2.0
16
+ network: "Base Sepolia",
17
+ transactionHash: "0x403331e67051b70c92af413ad9424e70f4e4cacb5512a2f6e6af46a6cb198340",
18
+ wallet: "0x1234567890123456789012345678901234567890",
19
+ timestamp: Math.floor(Date.now() / 1000),
20
+ note: "Test tokenized ZIP file for demonstration"
21
+ };
22
+ // Example blockchain verification results
23
+ const sampleVerification = {
24
+ merkleRootMatches: true,
25
+ blockchainMerkleRoot: "abc123def456789012345678901234567890123456789012345678901234567890",
26
+ calculatedMerkleRoot: "abc123def456789012345678901234567890123456789012345678901234567890",
27
+ verificationStatus: 'PASSED',
28
+ verificationTime: Math.floor(Date.now() / 1000),
29
+ blockNumber: 12345678
30
+ };
31
+ // Example wallet information
32
+ const sampleWalletInfo = {
33
+ address: "0x1234567890123456789012345678901234567890",
34
+ network: "Base Sepolia",
35
+ balance: "1.234 ETH",
36
+ ensName: "demo.eth"
37
+ };
38
+ // Example file information
39
+ const sampleFiles = [
40
+ {
41
+ filename: "README.md",
42
+ size: 1024,
43
+ date: "2025-01-10 12:00:00 UTC",
44
+ hash: "a1b2c3d4e5f6789012345678901234567890123456789012345678901234567890"
45
+ },
46
+ {
47
+ filename: "document.pdf",
48
+ size: 2048576,
49
+ date: "2025-01-10 11:30:00 UTC",
50
+ hash: "b2c3d4e5f6a7890123456789012345678901234567890123456789012345678901"
51
+ },
52
+ {
53
+ filename: "image.jpg",
54
+ size: 512000,
55
+ date: "2025-01-10 10:15:00 UTC",
56
+ hash: "c3d4e5f6a7b8901234567890123456789012345678901234567890123456789012"
57
+ }
58
+ ];
59
+ function testCertificateGeneration() {
60
+ console.log('🧪 Testing Certificate Generation...');
61
+ console.log('=====================================');
62
+ try {
63
+ // Test with full information
64
+ console.log('1. Generating certificate with full information...');
65
+ const fullCertificate = (0, CertificateToken_1.createTokenCertificate)(sampleTokenInfo, 'test-archive.zip', sampleVerification, sampleWalletInfo, sampleFiles);
66
+ const fullCertPath = (0, CertificateToken_1.saveCertificate)('test-archive.zip', fullCertificate, './certificates');
67
+ console.log(`✅ Full certificate saved: ${fullCertPath}`);
68
+ // Test with minimal information
69
+ console.log('\n2. Generating certificate with minimal information...');
70
+ const minimalVerification = {
71
+ merkleRootMatches: false,
72
+ blockchainMerkleRoot: "different123456789012345678901234567890123456789012345678901234567890",
73
+ calculatedMerkleRoot: "calculated123456789012345678901234567890123456789012345678901234567890",
74
+ verificationStatus: 'FAILED'
75
+ };
76
+ const minimalCertificate = (0, CertificateToken_1.createTokenCertificate)(sampleTokenInfo, 'minimal-archive.zip', minimalVerification);
77
+ const minimalCertPath = (0, CertificateToken_1.saveCertificate)('minimal-archive.zip', minimalCertificate, './blockchain/output');
78
+ console.log(`✅ Minimal certificate saved: ${minimalCertPath}`);
79
+ // Test with unavailable verification
80
+ console.log('\n3. Generating certificate with unavailable verification...');
81
+ const unavailableVerification = {
82
+ merkleRootMatches: false,
83
+ blockchainMerkleRoot: "N/A",
84
+ calculatedMerkleRoot: "calculated123456789012345678901234567890123456789012345678901234567890",
85
+ verificationStatus: 'UNAVAILABLE'
86
+ };
87
+ const unavailableCertificate = (0, CertificateToken_1.createTokenCertificate)(sampleTokenInfo, 'unavailable-archive.zip', unavailableVerification, sampleWalletInfo);
88
+ const unavailableCertPath = (0, CertificateToken_1.saveCertificate)('unavailable-archive.zip', unavailableCertificate, './blockchain/output');
89
+ console.log(`✅ Unavailable verification certificate saved: ${unavailableCertPath}`);
90
+ console.log('\n🎉 All certificate tests completed successfully!');
91
+ console.log('Check the ./blockchain/output directory for generated certificates.');
92
+ }
93
+ catch (error) {
94
+ console.error('❌ Error during certificate generation:', error);
95
+ }
96
+ }
97
+ // Run the test
98
+ if (require.main === module) {
99
+ testCertificateGeneration();
100
+ }
@@ -0,0 +1,69 @@
1
+ import { ethers } from 'ethers';
2
+ export interface NFTAttribute {
3
+ trait_type: string;
4
+ value: string;
5
+ }
6
+ export interface NFTMetadata {
7
+ name: string;
8
+ description: string;
9
+ image: string;
10
+ attributes: NFTAttribute[];
11
+ }
12
+ export interface WalletInfo {
13
+ address: string;
14
+ privateKey: string;
15
+ mnemonic: string;
16
+ }
17
+ export interface NetworkConfig {
18
+ name: string;
19
+ rpcUrl: string;
20
+ chainId: number;
21
+ explorerUrl: string;
22
+ }
23
+ export interface WalletSetupResult {
24
+ wallet: ethers.Wallet | null;
25
+ provider: ethers.JsonRpcProvider | null;
26
+ success: boolean;
27
+ message?: string;
28
+ }
29
+ export interface ContractInfo {
30
+ address: string;
31
+ abi: any[];
32
+ network: string;
33
+ deployer: string;
34
+ deploymentTime: string;
35
+ }
36
+ export interface MintingResult {
37
+ success: boolean;
38
+ message: string;
39
+ tokenId?: string;
40
+ txHash?: string;
41
+ creationTimestamp?: number;
42
+ }
43
+ export interface ZipTokenData {
44
+ zipFile: string;
45
+ merkleRoot: string;
46
+ fileName: string;
47
+ timestamp: string;
48
+ }
49
+ export interface MintingOptions {
50
+ wallet?: string;
51
+ network: string;
52
+ mintToken: boolean;
53
+ }
54
+ export interface NZipTokenInfo {
55
+ version: string;
56
+ tokenId: string;
57
+ contractAddress: string;
58
+ network: string;
59
+ networkChainId: number;
60
+ transactionHash: string;
61
+ merkleRoot: string;
62
+ fileName: string;
63
+ mintedAt: string;
64
+ creationTimestamp?: number;
65
+ blockNumber?: number;
66
+ ipfsHash?: string;
67
+ }
68
+ export declare const NETWORKS: Record<string, NetworkConfig>;
69
+ export declare const NFT_METADATA_TEMPLATE: NFTMetadata;
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NFT_METADATA_TEMPLATE = exports.NETWORKS = void 0;
4
+ // Network configuration
5
+ exports.NETWORKS = {
6
+ 'base': {
7
+ name: 'Base Mainnet',
8
+ rpcUrl: 'https://mainnet.base.org',
9
+ chainId: 8453,
10
+ explorerUrl: 'https://basescan.org'
11
+ },
12
+ 'base-sepolia': {
13
+ name: 'Base Sepolia',
14
+ rpcUrl: 'https://sepolia.base.org',
15
+ chainId: 84532,
16
+ explorerUrl: 'https://sepolia.basescan.org'
17
+ },
18
+ 'base-goerli': {
19
+ name: 'Base Goerli',
20
+ rpcUrl: 'https://goerli.base.org',
21
+ chainId: 84531,
22
+ explorerUrl: 'https://goerli.basescan.org'
23
+ },
24
+ 'localhost': {
25
+ name: 'Localhost',
26
+ rpcUrl: 'http://localhost:8545',
27
+ chainId: 31337,
28
+ explorerUrl: 'http://localhost:8545'
29
+ }
30
+ };
31
+ // Token metadata constants - use TOKENIZED_METADATA from constants/Headers
32
+ // NFT Metadata template
33
+ exports.NFT_METADATA_TEMPLATE = {
34
+ name: "NeoZip Archive Token",
35
+ description: "This NFT represents ownership of a timestamped and verified ZIP archive on Base",
36
+ image: "", // Will be set to IPFS hash of thumbnail
37
+ attributes: [
38
+ {
39
+ trait_type: "Archive Hash",
40
+ value: "" // Will be set to the Merkle root hash of the archive
41
+ },
42
+ {
43
+ trait_type: "Creation Date",
44
+ value: "" // Will be set to timestamp
45
+ },
46
+ {
47
+ trait_type: "Blockchain",
48
+ value: "Base" // Specify Base as the blockchain
49
+ }
50
+ ]
51
+ };
@@ -0,0 +1,105 @@
1
+ /**
2
+ * ZipKitServer
3
+ * Copyright (c) 2025 NeoWare, Inc. All rights reserved.
4
+ *
5
+ * Server-side implementation of ZipKit that passes through all functions
6
+ * directly to the parent ZipKit class. This class provides a consistent interface
7
+ * for server environments and ensures all ZipKit functionality is available.
8
+ */
9
+ import ZipKit, { CompressOptions, ZipEntry } from '../../../shared/ZipKit';
10
+ import { TimestampResult } from '../servercomponents/ZipKitOTS';
11
+ import * as Headers from '../../../shared/constants/Headers';
12
+ export * from '../../../shared/ZipKit';
13
+ export { Headers };
14
+ /**
15
+ * This implementation is optimized for server environments and handles all
16
+ * ZIP operations including compression, extraction, encryption, and file management.
17
+ */
18
+ export default class ZipKitServer extends ZipKit {
19
+ /**
20
+ * Creates a new ZipKitServer instance
21
+ *
22
+ * Initializes the parent ZipKit class and logs environment support information
23
+ * for diagnostic purposes.
24
+ */
25
+ constructor();
26
+ /**
27
+ * Loads a ZIP file from the filesystem for updating/creating operations
28
+ *
29
+ * Attempts to read an existing ZIP file, but creates a new empty archive if
30
+ * the file doesn't exist. This method is used when adding or updating entries
31
+ * in an archive, handling both new and existing ZIP files gracefully.
32
+ *
33
+ * @param zipFile - Path to the ZIP file to load or create
34
+ */
35
+ loadZipFile(zipFile: string): void;
36
+ /**
37
+ * Loads a ZIP file from the filesystem for extraction and listing operations
38
+ *
39
+ * Reads an existing ZIP file and throws an error if the file doesn't exist.
40
+ * Use this method when working with existing archives that need to be extracted.
41
+ *
42
+ * @param zipFile - Path to the ZIP file to load
43
+ * @throws Error if the file doesn't exist or can't be read
44
+ */
45
+ loadUnzipFile(zipFile: string): void;
46
+ /**
47
+ * Adds a single file to the ZIP archive
48
+ * @param filename - Path to the file to be added
49
+ * @param comment - Optional comment for the file entry
50
+ *
51
+ * Handles:
52
+ * - Creating/updating ZipEntry objects
53
+ * - Setting file attributes and timestamps
54
+ * - Respecting freshen (-f) and update (-u) flags
55
+ * - Setting compression method
56
+ */
57
+ addFile(filename: string, freshen?: boolean, update?: boolean): void;
58
+ /**
59
+ * Processes files to be added to the ZIP archive
60
+ * Creates ZipEntry objects for each file and initiates the compression process
61
+ */
62
+ addFiles(files: string[], freshen?: boolean, update?: boolean): number;
63
+ /**
64
+ * Creates a ZIP file with optional OpenTimestamps (OTS) metadata
65
+ *
66
+ * This method creates a ZIP file with optional OpenTimestamps (OTS) metadata,
67
+ * which includes a timestamp of the ZIP file's contents on the Bitcoin blockchain.
68
+ *
69
+ * @param zipFile - The path to the ZIP file to create
70
+ * @param compressOptions - The compression options for the ZIP file
71
+ * @returns void - The method triggers a download of the ZIP file
72
+ */
73
+ createZip(zipFile: string, compressOptions: CompressOptions): Promise<void>;
74
+ /**
75
+ * Creates a ZIP file with OpenTimestamps (OTS) metadata
76
+ *
77
+ * This method creates a ZIP file with OpenTimestamps (OTS) metadata, which
78
+ * includes a timestamp of the ZIP file's contents on the Bitcoin blockchain.
79
+ *
80
+ * @param zipFile - The path to the ZIP file to create
81
+ * @param compressOptions - The compression options for the ZIP file
82
+ * @returns void - The method triggers a download of the ZIP file
83
+ */
84
+ createZipOTS(zipFile: string, compressOptions: CompressOptions): Promise<void>;
85
+ /**
86
+ * Removes specified files from the ZIP archive
87
+ * Deletes matching ZipEntry objects and rebuilds the archive if any files were removed
88
+ */
89
+ deleteFiles(delFiles: string[]): number;
90
+ /**
91
+ * Upgrades a timestamp in an existing ZIP file
92
+ *
93
+ * This method takes an existing ZIP file and upgrades its timestamp by:
94
+ * 1. Loading the original ZIP file
95
+ * 2. Removing any existing timestamp metadata entries
96
+ * 3. Adding a new timestamp metadata entry with the upgraded OTS proof
97
+ * 4. Creating a new ZIP file with the updated timestamp
98
+ *
99
+ * @param zipFile - The original ZIP file to upgrade
100
+ * @param upgradedOts - The upgraded OpenTimestamps proof as an ArrayBuffer
101
+ * @returns void - The method triggers a download of the upgraded ZIP file
102
+ */
103
+ upgradeOTS(fileName: string, upgradedOts: Buffer): Promise<void>;
104
+ createCertificateOTS(fileName: string, zipEntries: ZipEntry[], timestampResult: TimestampResult): Promise<string>;
105
+ }