neozipkit 0.2.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.
- package/LICENSE +22 -0
- package/README.md +410 -186
- package/contracts/ABI.txt +889 -0
- package/contracts/Bytecode.txt +1 -0
- package/contracts/COMPILATION_NOTES.md +59 -0
- package/contracts/QUICK_DEPLOY.md +286 -0
- package/contracts/README.md +235 -131
- package/contracts/VERIFICATION.md +308 -0
- package/contracts/deploy-interactive.js +448 -0
- package/contracts/deployment-arbitrum-sepolia.json +12 -0
- package/contracts/deployment-arbitrum.json +12 -0
- package/contracts/deployment-eth-sepolia.json +12 -0
- package/contracts/hardhat.config.js +114 -0
- package/contracts/package.json +20 -0
- package/contracts/scripts/compile-and-extract.js +119 -0
- package/contracts/scripts/verify-contract.js +223 -0
- package/contracts/src/{NZIP-NFT-Private.sol → NZIP-NFT-v2.0.sol} +66 -151
- package/contracts/src/NZIP-NFT.sol +9 -15
- package/dist/blockchain/browser/TokenVerifierBrowser.d.ts +67 -0
- package/dist/blockchain/browser/TokenVerifierBrowser.d.ts.map +1 -0
- package/dist/blockchain/browser/TokenVerifierBrowser.js +313 -0
- package/dist/blockchain/browser/TokenVerifierBrowser.js.map +1 -0
- package/dist/blockchain/browser/WalletManagerBrowser.d.ts +98 -0
- package/dist/blockchain/browser/WalletManagerBrowser.d.ts.map +1 -0
- package/dist/blockchain/browser/WalletManagerBrowser.js +434 -0
- package/dist/blockchain/browser/WalletManagerBrowser.js.map +1 -0
- package/dist/blockchain/browser/ZipkitMinterBrowser.d.ts +58 -0
- package/dist/blockchain/browser/ZipkitMinterBrowser.d.ts.map +1 -0
- package/dist/blockchain/browser/ZipkitMinterBrowser.js +317 -0
- package/dist/blockchain/browser/ZipkitMinterBrowser.js.map +1 -0
- package/dist/blockchain/browser/index.d.ts +11 -0
- package/dist/blockchain/browser/index.d.ts.map +1 -0
- package/dist/blockchain/browser/index.js +16 -0
- package/dist/blockchain/browser/index.js.map +1 -0
- package/dist/blockchain/core/WalletManager.d.ts +124 -0
- package/dist/blockchain/core/WalletManager.d.ts.map +1 -0
- package/dist/blockchain/{ZipKitWallet.js → core/WalletManager.js} +157 -177
- package/dist/blockchain/core/WalletManager.js.map +1 -0
- package/dist/blockchain/{ZipKitMinter.d.ts → core/ZipkitMinter.d.ts} +46 -11
- package/dist/blockchain/core/ZipkitMinter.d.ts.map +1 -0
- package/dist/blockchain/core/ZipkitMinter.js +548 -0
- package/dist/blockchain/core/ZipkitMinter.js.map +1 -0
- package/dist/blockchain/{ZipKitOTS.d.ts → core/ZipkitOTS.d.ts} +6 -15
- package/dist/blockchain/core/ZipkitOTS.d.ts.map +1 -0
- package/dist/blockchain/{ZipKitOTS.js → core/ZipkitOTS.js} +26 -84
- package/dist/blockchain/core/ZipkitOTS.js.map +1 -0
- package/dist/blockchain/core/ZipkitVerifier.d.ts +177 -0
- package/dist/blockchain/core/ZipkitVerifier.d.ts.map +1 -0
- package/dist/blockchain/core/ZipkitVerifier.js +632 -0
- package/dist/blockchain/core/ZipkitVerifier.js.map +1 -0
- package/dist/blockchain/core/contracts.d.ts +83 -0
- package/dist/blockchain/core/contracts.d.ts.map +1 -0
- package/dist/blockchain/core/contracts.js +341 -0
- package/dist/blockchain/core/contracts.js.map +1 -0
- package/dist/blockchain/core/index.d.ts +12 -0
- package/dist/blockchain/core/index.d.ts.map +1 -0
- package/dist/blockchain/core/index.js +59 -0
- package/dist/blockchain/core/index.js.map +1 -0
- package/dist/blockchain/index.d.ts +11 -7
- package/dist/blockchain/index.d.ts.map +1 -0
- package/dist/blockchain/index.js +18 -34
- package/dist/blockchain/index.js.map +1 -0
- package/dist/blockchain/node/WalletManagerNode.d.ts +47 -0
- package/dist/blockchain/node/WalletManagerNode.d.ts.map +1 -0
- package/dist/blockchain/node/WalletManagerNode.js +203 -0
- package/dist/blockchain/node/WalletManagerNode.js.map +1 -0
- package/dist/blockchain/node/index.d.ts +12 -0
- package/dist/blockchain/node/index.d.ts.map +1 -0
- package/dist/blockchain/node/index.js +24 -0
- package/dist/blockchain/node/index.js.map +1 -0
- package/dist/browser/ZipkitBrowser.d.ts +27 -0
- package/dist/browser/ZipkitBrowser.d.ts.map +1 -0
- package/dist/browser/{ZipKitBrowser.js → ZipkitBrowser.js} +96 -43
- package/dist/browser/ZipkitBrowser.js.map +1 -0
- package/dist/browser/index.d.ts +12 -0
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/browser/index.js +42 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/browser-esm/index.d.ts +12 -0
- package/dist/browser-esm/index.js +59559 -0
- package/dist/browser-esm/index.js.map +7 -0
- package/dist/browser-umd/index.d.ts +12 -0
- package/dist/browser-umd/index.js +59576 -0
- package/dist/browser-umd/index.js.map +7 -0
- package/dist/browser-umd/index.min.js +63 -0
- package/dist/browser.d.ts +8 -14
- package/dist/browser.js +13 -28
- package/dist/core/ZipCompress.d.ts +99 -0
- package/dist/core/ZipCompress.d.ts.map +1 -0
- package/dist/core/ZipCompress.js +309 -0
- package/dist/core/ZipCompress.js.map +1 -0
- package/dist/core/ZipDecompress.d.ts +58 -0
- package/dist/core/ZipDecompress.d.ts.map +1 -0
- package/dist/core/ZipDecompress.js +172 -0
- package/dist/core/ZipDecompress.js.map +1 -0
- package/dist/{shared → core}/ZipEntry.d.ts +8 -1
- package/dist/core/ZipEntry.d.ts.map +1 -0
- package/dist/{shared → core}/ZipEntry.js +225 -82
- package/dist/core/ZipEntry.js.map +1 -0
- package/dist/core/Zipkit.d.ts +315 -0
- package/dist/core/Zipkit.d.ts.map +1 -0
- package/dist/core/Zipkit.js +647 -0
- package/dist/core/Zipkit.js.map +1 -0
- package/dist/core/components/HashCalculator.d.ts +138 -0
- package/dist/core/components/HashCalculator.d.ts.map +1 -0
- package/dist/core/components/HashCalculator.js +360 -0
- package/dist/core/components/HashCalculator.js.map +1 -0
- package/dist/core/components/Logger.d.ts +73 -0
- package/dist/core/components/Logger.d.ts.map +1 -0
- package/dist/core/components/Logger.js +156 -0
- package/dist/core/components/Logger.js.map +1 -0
- package/dist/core/components/ProgressTracker.d.ts +43 -0
- package/dist/core/components/ProgressTracker.d.ts.map +1 -0
- package/dist/core/components/ProgressTracker.js +112 -0
- package/dist/core/components/ProgressTracker.js.map +1 -0
- package/dist/{shared → core}/components/Support.d.ts +1 -0
- package/dist/core/components/Support.d.ts.map +1 -0
- package/dist/{shared → core}/components/Support.js +1 -0
- package/dist/core/components/Support.js.map +1 -0
- package/dist/{shared → core}/components/Util.d.ts +7 -2
- package/dist/core/components/Util.d.ts.map +1 -0
- package/dist/{shared → core}/components/Util.js +14 -34
- package/dist/core/components/Util.js.map +1 -0
- package/dist/{shared → core}/constants/Errors.d.ts +1 -2
- package/dist/core/constants/Errors.d.ts.map +1 -0
- package/dist/{shared → core}/constants/Errors.js +1 -3
- package/dist/core/constants/Errors.js.map +1 -0
- package/dist/{shared → core}/constants/Headers.d.ts +3 -0
- package/dist/core/constants/Headers.d.ts.map +1 -0
- package/dist/{shared → core}/constants/Headers.js +20 -17
- package/dist/core/constants/Headers.js.map +1 -0
- package/dist/core/encryption/Manager.d.ts +58 -0
- package/dist/core/encryption/Manager.d.ts.map +1 -0
- package/dist/core/encryption/Manager.js +121 -0
- package/dist/core/encryption/Manager.js.map +1 -0
- package/dist/core/encryption/ZipCrypto.d.ts +172 -0
- package/dist/core/encryption/ZipCrypto.d.ts.map +1 -0
- package/dist/core/encryption/ZipCrypto.js +554 -0
- package/dist/core/encryption/ZipCrypto.js.map +1 -0
- package/dist/core/encryption/index.d.ts +9 -0
- package/dist/core/encryption/index.d.ts.map +1 -0
- package/dist/core/encryption/index.js +17 -0
- package/dist/core/encryption/index.js.map +1 -0
- package/dist/core/encryption/types.d.ts +29 -0
- package/dist/core/encryption/types.d.ts.map +1 -0
- package/dist/core/encryption/types.js +12 -0
- package/dist/core/encryption/types.js.map +1 -0
- package/dist/core/index.d.ts +24 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +57 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/version.d.ts +5 -0
- package/dist/core/version.d.ts.map +1 -0
- package/dist/core/version.js +31 -0
- package/dist/core/version.js.map +1 -0
- package/dist/index.d.ts +8 -18
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +29 -35
- package/dist/index.js.map +1 -0
- package/dist/node/ZipCompressNode.d.ts +123 -0
- package/dist/node/ZipCompressNode.d.ts.map +1 -0
- package/dist/node/ZipCompressNode.js +576 -0
- package/dist/node/ZipCompressNode.js.map +1 -0
- package/dist/node/ZipDecompressNode.d.ts +120 -0
- package/dist/node/ZipDecompressNode.d.ts.map +1 -0
- package/dist/node/ZipDecompressNode.js +461 -0
- package/dist/node/ZipDecompressNode.js.map +1 -0
- package/dist/node/ZipkitNode.d.ts +406 -0
- package/dist/node/ZipkitNode.d.ts.map +1 -0
- package/dist/node/ZipkitNode.js +1305 -0
- package/dist/node/ZipkitNode.js.map +1 -0
- package/dist/node/index.d.ts +26 -0
- package/dist/node/index.d.ts.map +1 -0
- package/dist/node/index.js +65 -0
- package/dist/node/index.js.map +1 -0
- package/dist/types/index.d.ts +59 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +36 -1
- package/dist/types/index.js.map +1 -0
- package/examples/README.md +269 -0
- package/examples/blockchain-tokenize.ts +354 -0
- package/examples/create-zip.ts +172 -0
- package/examples/extract-zip.ts +158 -0
- package/examples/list-zip.ts +161 -0
- package/examples/test-files/data.json +116 -0
- package/examples/test-files/document.md +80 -0
- package/examples/test-files/document.txt +2 -0
- package/examples/test-files/file1.txt +48 -0
- package/examples/test-files/file2.txt +80 -0
- package/examples/tsconfig.json +44 -0
- package/examples/unzip-token.ts +491 -0
- package/examples/verify-tokenized-zip.ts +305 -0
- package/examples/zip-token.ts +604 -0
- package/package.json +108 -24
- package/src/blockchain/README.md +59 -66
- package/src/{browser/TokenVerifierBrowser.ts-remove → blockchain/browser/TokenVerifierBrowser.ts} +125 -79
- package/src/blockchain/browser/WalletManagerBrowser.ts +486 -0
- package/src/blockchain/browser/ZipkitMinterBrowser.ts +400 -0
- package/src/blockchain/browser/index.ts +13 -0
- package/src/blockchain/{ZipKitWallet.ts → core/WalletManager.ts} +241 -143
- package/src/blockchain/core/ZipkitMinter.ts +716 -0
- package/src/blockchain/{ZipKitOTS.ts → core/ZipkitOTS.ts} +28 -62
- package/src/blockchain/core/ZipkitVerifier.ts +853 -0
- package/src/blockchain/core/contracts.ts +370 -0
- package/src/blockchain/core/index.ts +71 -0
- package/src/blockchain/index.ts +21 -55
- package/src/blockchain/node/WalletManagerNode.ts +171 -0
- package/src/blockchain/node/index.ts +40 -0
- package/src/browser/{ZipKitBrowser.ts → ZipkitBrowser.ts} +104 -41
- package/src/browser/index.esm.ts +37 -0
- package/src/browser/index.ts +25 -0
- package/src/core/ZipCompress.ts +398 -0
- package/src/core/ZipDecompress.ts +212 -0
- package/src/{shared → core}/ZipEntry.ts +240 -90
- package/src/core/Zipkit.ts +794 -0
- package/src/core/components/HashCalculator.ts +384 -0
- package/src/core/components/Logger.ts +180 -0
- package/src/core/components/ProgressTracker.ts +134 -0
- package/src/{shared → core}/components/Util.ts +12 -34
- package/src/{shared → core}/constants/Errors.ts +0 -4
- package/src/{shared → core}/constants/Headers.ts +19 -17
- package/src/core/encryption/Manager.ts +137 -0
- package/src/core/encryption/ZipCrypto.ts +650 -0
- package/src/core/encryption/index.ts +15 -0
- package/src/core/encryption/types.ts +33 -0
- package/src/core/index.ts +34 -0
- package/src/core/version.ts +33 -0
- package/src/index.ts +54 -25
- package/src/node/ZipCompressNode.ts +632 -0
- package/src/node/ZipDecompressNode.ts +508 -0
- package/src/node/ZipkitNode.ts +1559 -0
- package/src/node/index.ts +69 -0
- package/src/types/index.ts +131 -1
- package/src/types/modules.d.ts +1 -11
- package/src/types/opentimestamps.d.ts +1 -23
- package/contracts/INTEGRATION.md +0 -338
- package/contracts/NETWORKS.md +0 -156
- package/contracts/NZIP-NFT-bytecode.txt +0 -1
- package/contracts/constants.ts +0 -952
- package/contracts/deploy-bytecode.mjs +0 -94
- package/dist/blockchain/CertificateToken.d.ts +0 -48
- package/dist/blockchain/CertificateToken.js +0 -386
- package/dist/blockchain/ZipKitMinter.js +0 -347
- package/dist/blockchain/ZipKitNFT.d.ts +0 -3
- package/dist/blockchain/ZipKitNFT.js +0 -7
- package/dist/blockchain/ZipKitVerifier.d.ts +0 -69
- package/dist/blockchain/ZipKitVerifier.js +0 -289
- package/dist/blockchain/ZipKitWallet.d.ts +0 -69
- package/dist/blockchain/contracts.d.ts +0 -14
- package/dist/blockchain/contracts.js +0 -77
- package/dist/blockchain/types.d.ts +0 -47
- package/dist/blockchain/types.js +0 -30
- package/dist/browser/ZipKitBrowser.d.ts +0 -18
- package/dist/browser/ZipKitStampBrowser.d.ts +0 -2
- package/dist/browser/ZipKitStampBrowser.js +0 -12
- package/dist/browser-index.d.ts +0 -18
- package/dist/browser-index.js +0 -57
- package/dist/server/ZipKitServer.d.ts +0 -74
- package/dist/server/ZipKitServer.js +0 -310
- package/dist/shared/ZipKit.d.ts +0 -243
- package/dist/shared/ZipKit.js +0 -772
- package/dist/shared/components/CertificateOTS.d.ts +0 -15
- package/dist/shared/components/CertificateOTS.js +0 -116
- package/dist/shared/components/FileSys.d.ts +0 -2
- package/dist/shared/components/FileSys.js +0 -113
- package/dist/shared/components/HashAccumulator.d.ts +0 -55
- package/dist/shared/components/HashAccumulator.js +0 -100
- package/dist/shared/components/ZipCrypto.d.ts +0 -3
- package/dist/shared/components/ZipCrypto.js +0 -78
- package/dist/shared/components/merkleTree.d.ts +0 -66
- package/dist/shared/components/merkleTree.js +0 -136
- package/dist/shared/types/index.d.ts +0 -21
- package/dist/shared/types/index.js +0 -3
- package/dist/shared/types.d.ts +0 -33
- package/dist/shared/types.js +0 -8
- package/dist/shared/version.d.ts +0 -2
- package/dist/shared/version.js +0 -6
- package/src/blockchain/CertificateToken.ts +0 -444
- package/src/blockchain/ZipKitMinter.ts +0 -470
- package/src/blockchain/ZipKitNFT.ts +0 -12
- package/src/blockchain/ZipKitVerifier.ts +0 -382
- package/src/blockchain/contracts.ts +0 -88
- package/src/blockchain/types.ts +0 -91
- package/src/browser/CertificateGeneratorBrowser.ts-remove +0 -498
- package/src/browser/ZipKitStampBrowser.ts +0 -9
- package/src/browser-index.ts +0 -36
- package/src/server/README.md +0 -25
- package/src/server/ZipKitServer.ts +0 -305
- package/src/shared/ZipKit.ts +0 -881
- package/src/shared/components/CertificateOTS.ts +0 -132
- package/src/shared/components/FileSys.ts +0 -87
- package/src/shared/components/HashAccumulator.ts +0 -113
- package/src/shared/components/ZipCrypto.ts +0 -91
- package/src/shared/components/merkleTree.ts +0 -162
- package/src/shared/types/index.ts +0 -25
- package/src/shared/types/modules.d.ts +0 -22
- package/src/shared/types/opentimestamps.d.ts +0 -23
- package/src/shared/types.d.ts +0 -8
- package/src/shared/types.ts +0 -43
- package/src/shared/version.ts +0 -3
- /package/src/{shared → core}/components/Support.ts +0 -0
|
@@ -1,289 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
/**
|
|
4
|
-
* ZipKitVerifier - Handles NFT token verification for ZIP files
|
|
5
|
-
* Verifier API for NZIP-NFT smart contract.
|
|
6
|
-
*/
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.ZipKitVerifier = void 0;
|
|
9
|
-
const ethers_1 = require("ethers");
|
|
10
|
-
const contracts_1 = require("./contracts");
|
|
11
|
-
// Network configurations
|
|
12
|
-
const NETWORK_CONFIGS = {
|
|
13
|
-
'base-sepolia': {
|
|
14
|
-
name: 'Base Sepolia',
|
|
15
|
-
rpcUrl: 'https://sepolia.base.org',
|
|
16
|
-
contractAddress: contracts_1.CONTRACT_CONFIGS[84532].address, // Use real contract address
|
|
17
|
-
explorerUrl: 'https://sepolia.basescan.org',
|
|
18
|
-
chainId: 84532
|
|
19
|
-
},
|
|
20
|
-
'base-mainnet': {
|
|
21
|
-
name: 'Base Mainnet',
|
|
22
|
-
rpcUrl: 'https://mainnet.base.org',
|
|
23
|
-
contractAddress: contracts_1.CONTRACT_CONFIGS[8453].address, // Use real contract address
|
|
24
|
-
explorerUrl: 'https://basescan.org',
|
|
25
|
-
chainId: 8453
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
/**
|
|
29
|
-
* Blockchain Token Verifier for ZIP files
|
|
30
|
-
*/
|
|
31
|
-
class ZipKitVerifier {
|
|
32
|
-
constructor(options = {}) {
|
|
33
|
-
this.debug = options.debug || false;
|
|
34
|
-
if (this.debug) {
|
|
35
|
-
console.log(`[DEBUG] ZipKitVerifier initialized`);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Extract and validate token metadata from ZIP
|
|
40
|
-
*/
|
|
41
|
-
async extractTokenMetadata(tokenBuffer) {
|
|
42
|
-
try {
|
|
43
|
-
if (this.debug) {
|
|
44
|
-
console.log(`[DEBUG] Extracting token metadata from buffer (${tokenBuffer.length} bytes)`);
|
|
45
|
-
}
|
|
46
|
-
const tokenData = JSON.parse(tokenBuffer.toString('utf8'));
|
|
47
|
-
// Validate required fields
|
|
48
|
-
const requiredFields = ['tokenId', 'contractAddress', 'network'];
|
|
49
|
-
for (const field of requiredFields) {
|
|
50
|
-
if (!tokenData[field]) {
|
|
51
|
-
if (this.debug) {
|
|
52
|
-
console.log(`[DEBUG] Missing required field: ${field}`);
|
|
53
|
-
}
|
|
54
|
-
return {
|
|
55
|
-
success: false,
|
|
56
|
-
error: `Missing required field: ${field}`
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
if (this.debug) {
|
|
61
|
-
console.log(`[DEBUG] Token metadata extracted successfully`);
|
|
62
|
-
console.log(`[DEBUG] Token ID: ${tokenData.tokenId}, Network: ${tokenData.network}`);
|
|
63
|
-
}
|
|
64
|
-
return {
|
|
65
|
-
success: true,
|
|
66
|
-
metadata: tokenData
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
catch (error) {
|
|
70
|
-
const errorMessage = error instanceof Error ? error.message : 'Invalid JSON format';
|
|
71
|
-
if (this.debug) {
|
|
72
|
-
console.log(`[DEBUG] Failed to parse token metadata: ${errorMessage}`);
|
|
73
|
-
}
|
|
74
|
-
return {
|
|
75
|
-
success: false,
|
|
76
|
-
error: `Invalid token metadata format: ${errorMessage}`
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Map network name to RPC configuration
|
|
82
|
-
*/
|
|
83
|
-
getNetworkConfig(networkName) {
|
|
84
|
-
const normalizedName = networkName.toLowerCase();
|
|
85
|
-
if (this.debug) {
|
|
86
|
-
console.log(`[DEBUG] Looking up network config for: ${normalizedName}`);
|
|
87
|
-
}
|
|
88
|
-
// Map various network name variations to our configs
|
|
89
|
-
if (normalizedName.includes('sepolia')) {
|
|
90
|
-
return { success: true, config: NETWORK_CONFIGS['base-sepolia'] };
|
|
91
|
-
}
|
|
92
|
-
else if (normalizedName.includes('base') && !normalizedName.includes('sepolia')) {
|
|
93
|
-
return { success: true, config: NETWORK_CONFIGS['base-mainnet'] };
|
|
94
|
-
}
|
|
95
|
-
if (this.debug) {
|
|
96
|
-
console.log(`[DEBUG] Unsupported network: ${normalizedName}`);
|
|
97
|
-
}
|
|
98
|
-
return {
|
|
99
|
-
success: false,
|
|
100
|
-
error: `Unsupported network: ${networkName}`
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Perform merkle root comparison
|
|
105
|
-
*/
|
|
106
|
-
compareMerkleRoots(calculated, declared) {
|
|
107
|
-
if (this.debug) {
|
|
108
|
-
console.log(`[DEBUG] Comparing merkle roots`);
|
|
109
|
-
console.log(`[DEBUG] Calculated: ${calculated || 'null'}`);
|
|
110
|
-
console.log(`[DEBUG] Declared: ${declared || 'null'}`);
|
|
111
|
-
}
|
|
112
|
-
if (!calculated) {
|
|
113
|
-
return {
|
|
114
|
-
success: false,
|
|
115
|
-
match: false,
|
|
116
|
-
error: 'Cannot calculate merkle root from archive contents'
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
if (!declared) {
|
|
120
|
-
return {
|
|
121
|
-
success: false,
|
|
122
|
-
match: false,
|
|
123
|
-
calculated,
|
|
124
|
-
error: 'No merkle root found in token metadata'
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
const match = calculated === declared;
|
|
128
|
-
if (this.debug) {
|
|
129
|
-
console.log(`[DEBUG] Merkle root match: ${match}`);
|
|
130
|
-
}
|
|
131
|
-
return {
|
|
132
|
-
success: true,
|
|
133
|
-
match,
|
|
134
|
-
calculated,
|
|
135
|
-
declared
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
/**
|
|
139
|
-
* Verify token against blockchain
|
|
140
|
-
*/
|
|
141
|
-
async verifyOnChain(tokenId, contractAddress, networkConfig, merkleRoot) {
|
|
142
|
-
try {
|
|
143
|
-
if (this.debug) {
|
|
144
|
-
console.log(`[DEBUG] Starting on-chain verification`);
|
|
145
|
-
console.log(`[DEBUG] Token ID: ${tokenId}, Contract: ${contractAddress}`);
|
|
146
|
-
console.log(`[DEBUG] Network: ${networkConfig.name}, RPC: ${networkConfig.rpcUrl}`);
|
|
147
|
-
}
|
|
148
|
-
const provider = new ethers_1.ethers.JsonRpcProvider(networkConfig.rpcUrl);
|
|
149
|
-
const contract = new ethers_1.ethers.Contract(contractAddress, contracts_1.NZIP_CONTRACT_ABI, provider);
|
|
150
|
-
if (this.debug) {
|
|
151
|
-
console.log(`[DEBUG] Calling contract.verifyZipFile(${tokenId}, ${merkleRoot.substring(0, 10)}...)`);
|
|
152
|
-
}
|
|
153
|
-
const isValid = await contract.verifyZipFile(tokenId, merkleRoot);
|
|
154
|
-
if (this.debug) {
|
|
155
|
-
console.log(`[DEBUG] On-chain verification result: ${isValid}`);
|
|
156
|
-
}
|
|
157
|
-
return { success: true, isValid };
|
|
158
|
-
}
|
|
159
|
-
catch (error) {
|
|
160
|
-
const errorMessage = error instanceof Error ? error.message : 'Network error';
|
|
161
|
-
if (this.debug) {
|
|
162
|
-
console.log(`[DEBUG] On-chain verification failed: ${errorMessage}`);
|
|
163
|
-
}
|
|
164
|
-
return {
|
|
165
|
-
success: false,
|
|
166
|
-
error: errorMessage
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
/**
|
|
171
|
-
* Complete verification process
|
|
172
|
-
*/
|
|
173
|
-
async verifyToken(tokenMetadata, calculatedMerkleRoot, options = {}) {
|
|
174
|
-
try {
|
|
175
|
-
if (this.debug) {
|
|
176
|
-
console.log(`[DEBUG] Starting complete token verification`);
|
|
177
|
-
}
|
|
178
|
-
// Get network configuration
|
|
179
|
-
const networkResult = this.getNetworkConfig(tokenMetadata.network);
|
|
180
|
-
if (!networkResult.success || !networkResult.config) {
|
|
181
|
-
return {
|
|
182
|
-
success: false,
|
|
183
|
-
message: networkResult.error || 'Unknown network error',
|
|
184
|
-
errorDetails: {
|
|
185
|
-
errorType: 'NETWORK_ERROR',
|
|
186
|
-
networkName: tokenMetadata.network
|
|
187
|
-
}
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
|
-
const networkConfig = networkResult.config;
|
|
191
|
-
const declaredMerkleRoot = tokenMetadata.merkleRoot;
|
|
192
|
-
// Compare merkle roots if hash verification is not skipped
|
|
193
|
-
if (!options.skipHash) {
|
|
194
|
-
const merkleComparison = this.compareMerkleRoots(calculatedMerkleRoot, declaredMerkleRoot);
|
|
195
|
-
if (!merkleComparison.success) {
|
|
196
|
-
return {
|
|
197
|
-
success: false,
|
|
198
|
-
message: merkleComparison.error || 'Merkle root verification failed',
|
|
199
|
-
errorDetails: {
|
|
200
|
-
errorType: 'MERKLE_ERROR',
|
|
201
|
-
merkleRoot: declaredMerkleRoot || 'null'
|
|
202
|
-
}
|
|
203
|
-
};
|
|
204
|
-
}
|
|
205
|
-
if (!merkleComparison.match) {
|
|
206
|
-
return {
|
|
207
|
-
success: false,
|
|
208
|
-
message: 'Archive integrity verification FAILED - merkle root mismatch',
|
|
209
|
-
errorDetails: {
|
|
210
|
-
errorType: 'MERKLE_ERROR',
|
|
211
|
-
merkleRoot: `calculated: ${merkleComparison.calculated}, declared: ${merkleComparison.declared}`
|
|
212
|
-
}
|
|
213
|
-
};
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
// Perform on-chain verification
|
|
217
|
-
const merkleToVerify = calculatedMerkleRoot;
|
|
218
|
-
if (!merkleToVerify) {
|
|
219
|
-
return {
|
|
220
|
-
success: false,
|
|
221
|
-
message: 'No merkle root available for verification',
|
|
222
|
-
errorDetails: {
|
|
223
|
-
errorType: 'MERKLE_ERROR'
|
|
224
|
-
}
|
|
225
|
-
};
|
|
226
|
-
}
|
|
227
|
-
const onChainResult = await this.verifyOnChain(tokenMetadata.tokenId, tokenMetadata.contractAddress, networkConfig, merkleToVerify);
|
|
228
|
-
if (!onChainResult.success) {
|
|
229
|
-
return {
|
|
230
|
-
success: false,
|
|
231
|
-
message: `Blockchain verification failed: ${onChainResult.error}`,
|
|
232
|
-
errorDetails: {
|
|
233
|
-
errorType: 'CONTRACT_ERROR',
|
|
234
|
-
networkName: tokenMetadata.network,
|
|
235
|
-
rpcUrl: networkConfig.rpcUrl,
|
|
236
|
-
contractAddress: tokenMetadata.contractAddress,
|
|
237
|
-
tokenId: tokenMetadata.tokenId
|
|
238
|
-
}
|
|
239
|
-
};
|
|
240
|
-
}
|
|
241
|
-
if (!onChainResult.isValid) {
|
|
242
|
-
return {
|
|
243
|
-
success: false,
|
|
244
|
-
message: 'Blockchain verification FAILED - token or merkle root invalid',
|
|
245
|
-
errorDetails: {
|
|
246
|
-
errorType: 'CONTRACT_ERROR',
|
|
247
|
-
tokenId: tokenMetadata.tokenId,
|
|
248
|
-
contractAddress: tokenMetadata.contractAddress,
|
|
249
|
-
merkleRoot: merkleToVerify
|
|
250
|
-
}
|
|
251
|
-
};
|
|
252
|
-
}
|
|
253
|
-
// Success - create verification details
|
|
254
|
-
const mintDate = tokenMetadata.mintDate ||
|
|
255
|
-
(tokenMetadata.creationTimestamp ? new Date(tokenMetadata.creationTimestamp * 1000).toLocaleString() : '') ||
|
|
256
|
-
'8/01/2025 at 1:00:00 PM'; // fallback
|
|
257
|
-
return {
|
|
258
|
-
success: true,
|
|
259
|
-
message: 'Archive integrity VERIFIED against blockchain records',
|
|
260
|
-
tokenMetadata,
|
|
261
|
-
verificationDetails: {
|
|
262
|
-
tokenId: tokenMetadata.tokenId,
|
|
263
|
-
network: tokenMetadata.network,
|
|
264
|
-
contractAddress: tokenMetadata.contractAddress,
|
|
265
|
-
merkleRoot: merkleToVerify,
|
|
266
|
-
mintDate,
|
|
267
|
-
calculatedMerkleRoot: calculatedMerkleRoot || undefined,
|
|
268
|
-
declaredMerkleRoot: declaredMerkleRoot || undefined,
|
|
269
|
-
merkleRootMatch: !options.skipHash ? calculatedMerkleRoot === declaredMerkleRoot : undefined,
|
|
270
|
-
onChainValid: true
|
|
271
|
-
}
|
|
272
|
-
};
|
|
273
|
-
}
|
|
274
|
-
catch (error) {
|
|
275
|
-
const errorMessage = error instanceof Error ? error.message : 'Unknown verification error';
|
|
276
|
-
if (this.debug) {
|
|
277
|
-
console.log(`[DEBUG] Verification process failed: ${errorMessage}`);
|
|
278
|
-
}
|
|
279
|
-
return {
|
|
280
|
-
success: false,
|
|
281
|
-
message: `Tokenization verification failed: ${errorMessage}`,
|
|
282
|
-
errorDetails: {
|
|
283
|
-
errorType: 'METADATA_ERROR'
|
|
284
|
-
}
|
|
285
|
-
};
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
exports.ZipKitVerifier = ZipKitVerifier;
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { ethers } from 'ethers';
|
|
2
|
-
import { WalletSetupResult, MintingOptions } from './types';
|
|
3
|
-
export interface CommonTokenConfig {
|
|
4
|
-
address: string;
|
|
5
|
-
name: string;
|
|
6
|
-
symbol: string;
|
|
7
|
-
type: 'ERC20' | 'ERC721';
|
|
8
|
-
}
|
|
9
|
-
export interface TokenInfo {
|
|
10
|
-
address: string;
|
|
11
|
-
name: string;
|
|
12
|
-
symbol: string;
|
|
13
|
-
balance: string;
|
|
14
|
-
decimals?: number;
|
|
15
|
-
type: 'ERC20' | 'ERC721' | 'NZIP';
|
|
16
|
-
}
|
|
17
|
-
export interface WalletBasicInfo {
|
|
18
|
-
ethBalance: string;
|
|
19
|
-
transactionCount: number;
|
|
20
|
-
networkName: string;
|
|
21
|
-
chainId: bigint;
|
|
22
|
-
latestBlock: number;
|
|
23
|
-
}
|
|
24
|
-
export interface TokenScanResult {
|
|
25
|
-
foundTokens: number[];
|
|
26
|
-
searchMethod: 'recent-events' | 'iteration' | 'common-ids' | 'none';
|
|
27
|
-
}
|
|
28
|
-
export interface NZipTokenDetails {
|
|
29
|
-
tokenId: string;
|
|
30
|
-
merkleRootHash: string;
|
|
31
|
-
fileName: string;
|
|
32
|
-
timestamp: number;
|
|
33
|
-
tokenURI?: string;
|
|
34
|
-
creator: string;
|
|
35
|
-
creationTimestamp: number;
|
|
36
|
-
tokenizationTime: number;
|
|
37
|
-
ipfsHash?: string;
|
|
38
|
-
}
|
|
39
|
-
export declare class ZipKitWallet {
|
|
40
|
-
private wallet;
|
|
41
|
-
private provider;
|
|
42
|
-
private promptUser;
|
|
43
|
-
private findExistingWallets;
|
|
44
|
-
private loadWalletFromFile;
|
|
45
|
-
setupWallet(options: MintingOptions): Promise<WalletSetupResult>;
|
|
46
|
-
private createNewWallet;
|
|
47
|
-
private connectToNetwork;
|
|
48
|
-
getWallet(): ethers.Wallet | null;
|
|
49
|
-
getProvider(): ethers.JsonRpcProvider | null;
|
|
50
|
-
isReady(): boolean;
|
|
51
|
-
isOnline(): boolean;
|
|
52
|
-
}
|
|
53
|
-
export declare class WalletAnalyzer {
|
|
54
|
-
private provider;
|
|
55
|
-
constructor(provider: ethers.JsonRpcProvider);
|
|
56
|
-
getWalletBasics(address: string): Promise<WalletBasicInfo>;
|
|
57
|
-
scanForNZipTokens(contractAddress: string, ownerAddress: string): Promise<TokenScanResult>;
|
|
58
|
-
getNZipTokenDetails(contractAddress: string, tokenIds: number[]): Promise<NZipTokenDetails[]>;
|
|
59
|
-
getContractInfo(contractAddress: string): Promise<{
|
|
60
|
-
name: string;
|
|
61
|
-
symbol: string;
|
|
62
|
-
totalSupply: string;
|
|
63
|
-
} | null>;
|
|
64
|
-
checkERC20Tokens(ownerAddress: string, tokenConfigs: CommonTokenConfig[]): Promise<TokenInfo[]>;
|
|
65
|
-
checkNFTCollections(ownerAddress: string, nftConfigs: CommonTokenConfig[]): Promise<TokenInfo[]>;
|
|
66
|
-
static detectNZipContract(): string | undefined;
|
|
67
|
-
static getCommonTokens(network: string): CommonTokenConfig[];
|
|
68
|
-
static getCommonNFTs(network: string): CommonTokenConfig[];
|
|
69
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export interface ContractConfig {
|
|
2
|
-
address: string;
|
|
3
|
-
network: string;
|
|
4
|
-
chainId: number;
|
|
5
|
-
explorerUrl: string;
|
|
6
|
-
rpcUrls: string[];
|
|
7
|
-
}
|
|
8
|
-
export declare const CONTRACT_CONFIGS: Record<number, ContractConfig>;
|
|
9
|
-
export declare const NZIP_CONTRACT_ABI: string[];
|
|
10
|
-
export declare const DEFAULT_NETWORK = 84532;
|
|
11
|
-
export declare const CURRENT_DEPLOYMENT: ContractConfig;
|
|
12
|
-
export declare const getContractConfig: (chainId: number) => ContractConfig;
|
|
13
|
-
export declare const getSupportedNetworks: () => number[];
|
|
14
|
-
export declare const isNetworkSupported: (chainId: number) => boolean;
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Contract addresses and configurations for different networks
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.isNetworkSupported = exports.getSupportedNetworks = exports.getContractConfig = exports.CURRENT_DEPLOYMENT = exports.DEFAULT_NETWORK = exports.NZIP_CONTRACT_ABI = exports.CONTRACT_CONFIGS = void 0;
|
|
5
|
-
// NZIP NFT Contract configurations by network
|
|
6
|
-
exports.CONTRACT_CONFIGS = {
|
|
7
|
-
// Base Sepolia (Primary testnet)
|
|
8
|
-
84532: {
|
|
9
|
-
address: '0xFD76a5d420704F34d84b0767961835c43D7b30a8', // Production contract v2.0
|
|
10
|
-
network: 'Base Sepolia',
|
|
11
|
-
chainId: 84532,
|
|
12
|
-
explorerUrl: 'https://sepolia.basescan.org',
|
|
13
|
-
rpcUrls: [
|
|
14
|
-
'https://sepolia.base.org',
|
|
15
|
-
'https://base-sepolia.g.alchemy.com/v2/demo',
|
|
16
|
-
'https://base-sepolia-rpc.publicnode.com'
|
|
17
|
-
]
|
|
18
|
-
},
|
|
19
|
-
// Base Mainnet (Production)
|
|
20
|
-
8453: {
|
|
21
|
-
address: '0x2716c4609fD97DaEdF429BC4B4Ec2faa81e2cC60',
|
|
22
|
-
network: 'Base Mainnet',
|
|
23
|
-
chainId: 8453,
|
|
24
|
-
explorerUrl: 'https://basescan.org',
|
|
25
|
-
rpcUrls: [
|
|
26
|
-
'https://mainnet.base.org',
|
|
27
|
-
'https://base.drpc.org',
|
|
28
|
-
'https://base.gateway.tenderly.co'
|
|
29
|
-
]
|
|
30
|
-
},
|
|
31
|
-
// Ethereum Sepolia (Testnet) - disabled until NZIP is deployed
|
|
32
|
-
// 11155111: {
|
|
33
|
-
// address: '0x0000000000000000000000000000000000000000',
|
|
34
|
-
// network: 'Sepolia Testnet',
|
|
35
|
-
// chainId: 11155111,
|
|
36
|
-
// explorerUrl: 'https://sepolia.etherscan.io',
|
|
37
|
-
// rpcUrls: []
|
|
38
|
-
// },
|
|
39
|
-
// Ethereum Mainnet (Production) - disabled until NZIP is deployed
|
|
40
|
-
// 1: {
|
|
41
|
-
// address: '0x0000000000000000000000000000000000000000',
|
|
42
|
-
// network: 'Ethereum Mainnet',
|
|
43
|
-
// chainId: 1,
|
|
44
|
-
// explorerUrl: 'https://etherscan.io',
|
|
45
|
-
// rpcUrls: []
|
|
46
|
-
// }
|
|
47
|
-
};
|
|
48
|
-
// Contract ABI (same for all networks)
|
|
49
|
-
exports.NZIP_CONTRACT_ABI = [
|
|
50
|
-
"function publicMintZipFile(string memory fileName, string memory merkleRootHash, uint256 creationTimestamp, string memory ipfsHash, string memory metadataURI) public returns (uint256)",
|
|
51
|
-
"function totalSupply() external view returns (uint256)",
|
|
52
|
-
"function getTokensByMerkleRoot(string memory merkleRoot) external view returns (uint256[])",
|
|
53
|
-
"function getZipFileInfo(uint256 tokenId) external view returns (tuple(string fileName, string merkleRootHash, string ipfsHash, address creator, uint256 creationTimestamp, uint256 tokenizationTime, uint256 blockNumber))",
|
|
54
|
-
"function ownerOf(uint256 tokenId) external view returns (address)",
|
|
55
|
-
"function balanceOf(address owner) external view returns (uint256)",
|
|
56
|
-
"function isZipFileTokenized(string memory merkleRootHash, uint256 creationTimestamp) external view returns (bool exists, uint256 tokenId)",
|
|
57
|
-
"function verifyZipFile(uint256 tokenId, string memory providedMerkleRoot) external view returns (bool isValid)",
|
|
58
|
-
"function getVersion() external pure returns (string memory)",
|
|
59
|
-
"event Transfer(address indexed from, address indexed to, uint256 indexed tokenId)",
|
|
60
|
-
"event ZipFileTokenized(uint256 indexed tokenId, address indexed creator, string fileName, string merkleRootHash, uint256 creationTimestamp, string ipfsHash, uint256 tokenizationTime, uint256 blockNumber)"
|
|
61
|
-
];
|
|
62
|
-
// Default configuration (Base Sepolia for development)
|
|
63
|
-
exports.DEFAULT_NETWORK = 84532;
|
|
64
|
-
exports.CURRENT_DEPLOYMENT = exports.CONTRACT_CONFIGS[exports.DEFAULT_NETWORK];
|
|
65
|
-
// Helper functions
|
|
66
|
-
const getContractConfig = (chainId) => {
|
|
67
|
-
return exports.CONTRACT_CONFIGS[chainId] || exports.CURRENT_DEPLOYMENT;
|
|
68
|
-
};
|
|
69
|
-
exports.getContractConfig = getContractConfig;
|
|
70
|
-
const getSupportedNetworks = () => {
|
|
71
|
-
return Object.keys(exports.CONTRACT_CONFIGS).map(Number);
|
|
72
|
-
};
|
|
73
|
-
exports.getSupportedNetworks = getSupportedNetworks;
|
|
74
|
-
const isNetworkSupported = (chainId) => {
|
|
75
|
-
return chainId in exports.CONTRACT_CONFIGS;
|
|
76
|
-
};
|
|
77
|
-
exports.isNetworkSupported = isNetworkSupported;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import type { Wallet, JsonRpcProvider } from 'ethers';
|
|
2
|
-
export interface WalletInfo {
|
|
3
|
-
address: string;
|
|
4
|
-
privateKey: string;
|
|
5
|
-
mnemonic: string;
|
|
6
|
-
}
|
|
7
|
-
export interface NetworkConfig {
|
|
8
|
-
name: string;
|
|
9
|
-
rpcUrl: string;
|
|
10
|
-
chainId: number;
|
|
11
|
-
explorerUrl: string;
|
|
12
|
-
}
|
|
13
|
-
export interface WalletSetupResult {
|
|
14
|
-
wallet: Wallet | null;
|
|
15
|
-
provider: JsonRpcProvider | null;
|
|
16
|
-
success: boolean;
|
|
17
|
-
message?: string;
|
|
18
|
-
}
|
|
19
|
-
export interface MintingResult {
|
|
20
|
-
success: boolean;
|
|
21
|
-
message: string;
|
|
22
|
-
tokenId?: string;
|
|
23
|
-
txHash?: string;
|
|
24
|
-
creationTimestamp?: number;
|
|
25
|
-
}
|
|
26
|
-
export interface MintingOptions {
|
|
27
|
-
wallet?: string;
|
|
28
|
-
network: string;
|
|
29
|
-
mintToken: boolean;
|
|
30
|
-
}
|
|
31
|
-
export interface TokenMetadata {
|
|
32
|
-
tokenId: string;
|
|
33
|
-
contractAddress: string;
|
|
34
|
-
network: string;
|
|
35
|
-
merkleRoot: string;
|
|
36
|
-
networkChainId?: number;
|
|
37
|
-
transactionHash?: string;
|
|
38
|
-
blockNumber?: number;
|
|
39
|
-
fileName?: string;
|
|
40
|
-
archiveName?: string;
|
|
41
|
-
mintedAt?: string;
|
|
42
|
-
mintDate?: string;
|
|
43
|
-
creationTimestamp?: number;
|
|
44
|
-
ipfsHash?: string;
|
|
45
|
-
version?: string;
|
|
46
|
-
}
|
|
47
|
-
export declare const NETWORKS: Record<string, NetworkConfig>;
|
package/dist/blockchain/types.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
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
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import ZipKit, { CompressOptions, CreateZipOptions } from '../shared/ZipKit';
|
|
2
|
-
import ZipEntry from '../shared/ZipEntry';
|
|
3
|
-
import Errors from '../shared/constants/Errors';
|
|
4
|
-
import * as Headers from '../shared/constants/Headers';
|
|
5
|
-
import { sha256 } from '../shared/components/ZipCrypto';
|
|
6
|
-
import { getTypeOf } from '../shared/components/Util';
|
|
7
|
-
import type { FileData } from '../shared/types';
|
|
8
|
-
export * from '../shared/ZipKit';
|
|
9
|
-
export { ZipEntry, Errors, Headers, sha256, getTypeOf };
|
|
10
|
-
export default class ZipKitBrowser extends ZipKit {
|
|
11
|
-
constructor();
|
|
12
|
-
loadZipBlob(data: Blob): Promise<ZipEntry[] | null>;
|
|
13
|
-
createZipFileEntry(file: FileData): ZipEntry;
|
|
14
|
-
hashFile(file: FileData): Promise<string>;
|
|
15
|
-
compressDataBlob(entry: ZipEntry, data: Blob, options?: CompressOptions): Promise<Buffer>;
|
|
16
|
-
extractBlob(entry: ZipEntry, skipHashCheck?: boolean): Promise<Blob | null>;
|
|
17
|
-
createZipBlob(cmpOptions?: CompressOptions, options?: CreateZipOptions): Promise<Blob | null>;
|
|
18
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// A browser-safe version of ZipKitStamp
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.verifyTimestamp = exports.createTimestamp = void 0;
|
|
5
|
-
const createTimestamp = async (hash, options = {}) => {
|
|
6
|
-
throw new Error('Blockchain timestamp creation is not supported in browsers');
|
|
7
|
-
};
|
|
8
|
-
exports.createTimestamp = createTimestamp;
|
|
9
|
-
const verifyTimestamp = async (timestamp, options = {}) => {
|
|
10
|
-
throw new Error('Blockchain timestamp verification is not supported in browsers');
|
|
11
|
-
};
|
|
12
|
-
exports.verifyTimestamp = verifyTimestamp;
|
package/dist/browser-index.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import ZipKit from './shared/ZipKit';
|
|
2
|
-
export { ZipEntry, Errors, CMP_METHOD, TIMESTAMP_METADATA, TIMESTAMP_SUBMITTED } from './shared/ZipKit';
|
|
3
|
-
export type { CompressOptions } from './shared/ZipKit';
|
|
4
|
-
export * from './shared/ZipKit';
|
|
5
|
-
export * from './shared/ZipEntry';
|
|
6
|
-
export default ZipKit;
|
|
7
|
-
export { default as ZipKitBrowser } from './browser/ZipKitBrowser';
|
|
8
|
-
export { default as HashAccumulator } from './shared/components/HashAccumulator';
|
|
9
|
-
export * from './shared/components/Util';
|
|
10
|
-
export * from './shared/components/Support';
|
|
11
|
-
export * from './shared/types';
|
|
12
|
-
export * from './shared/constants/Headers';
|
|
13
|
-
export * from './shared/constants/Errors';
|
|
14
|
-
export * from './shared/version';
|
|
15
|
-
export declare const PlatformUtils: {
|
|
16
|
-
isBrowser: boolean;
|
|
17
|
-
isNode: string | false;
|
|
18
|
-
};
|
package/dist/browser-index.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// =============================================================================
|
|
3
|
-
// NeoZipKit - Browser-Only Package Exports
|
|
4
|
-
// =============================================================================
|
|
5
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
-
}
|
|
11
|
-
Object.defineProperty(o, k2, desc);
|
|
12
|
-
}) : (function(o, m, k, k2) {
|
|
13
|
-
if (k2 === undefined) k2 = k;
|
|
14
|
-
o[k2] = m[k];
|
|
15
|
-
}));
|
|
16
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
17
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
18
|
-
};
|
|
19
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
20
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
21
|
-
};
|
|
22
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
-
exports.PlatformUtils = exports.HashAccumulator = exports.ZipKitBrowser = exports.TIMESTAMP_SUBMITTED = exports.TIMESTAMP_METADATA = exports.CMP_METHOD = exports.Errors = exports.ZipEntry = void 0;
|
|
24
|
-
// Core shared exports
|
|
25
|
-
const ZipKit_1 = __importDefault(require("./shared/ZipKit"));
|
|
26
|
-
var ZipKit_2 = require("./shared/ZipKit");
|
|
27
|
-
Object.defineProperty(exports, "ZipEntry", { enumerable: true, get: function () { return ZipKit_2.ZipEntry; } });
|
|
28
|
-
Object.defineProperty(exports, "Errors", { enumerable: true, get: function () { return ZipKit_2.Errors; } });
|
|
29
|
-
Object.defineProperty(exports, "CMP_METHOD", { enumerable: true, get: function () { return ZipKit_2.CMP_METHOD; } });
|
|
30
|
-
Object.defineProperty(exports, "TIMESTAMP_METADATA", { enumerable: true, get: function () { return ZipKit_2.TIMESTAMP_METADATA; } });
|
|
31
|
-
Object.defineProperty(exports, "TIMESTAMP_SUBMITTED", { enumerable: true, get: function () { return ZipKit_2.TIMESTAMP_SUBMITTED; } });
|
|
32
|
-
__exportStar(require("./shared/ZipKit"), exports);
|
|
33
|
-
__exportStar(require("./shared/ZipEntry"), exports);
|
|
34
|
-
exports.default = ZipKit_1.default;
|
|
35
|
-
// Browser-only exports
|
|
36
|
-
var ZipKitBrowser_1 = require("./browser/ZipKitBrowser");
|
|
37
|
-
Object.defineProperty(exports, "ZipKitBrowser", { enumerable: true, get: function () { return __importDefault(ZipKitBrowser_1).default; } });
|
|
38
|
-
// export { CertificateGeneratorBrowser } from './browser/CertificateGeneratorBrowser';
|
|
39
|
-
// export { TokenVerificationResult, checkForTokenization as checkForTokenizationBrowser, NZipTokenInfo } from './browser/TokenVerifierBrowser';
|
|
40
|
-
// export type { TokenVerificationOptions } from './browser/TokenVerifierBrowser';
|
|
41
|
-
// Shared component exports
|
|
42
|
-
var HashAccumulator_1 = require("./shared/components/HashAccumulator");
|
|
43
|
-
Object.defineProperty(exports, "HashAccumulator", { enumerable: true, get: function () { return __importDefault(HashAccumulator_1).default; } });
|
|
44
|
-
__exportStar(require("./shared/components/Util"), exports);
|
|
45
|
-
__exportStar(require("./shared/components/Support"), exports);
|
|
46
|
-
// Type and constant exports
|
|
47
|
-
__exportStar(require("./shared/types"), exports);
|
|
48
|
-
__exportStar(require("./shared/constants/Headers"), exports);
|
|
49
|
-
__exportStar(require("./shared/constants/Errors"), exports);
|
|
50
|
-
__exportStar(require("./shared/version"), exports);
|
|
51
|
-
// Platform-specific conditional exports
|
|
52
|
-
exports.PlatformUtils = {
|
|
53
|
-
// Browser detection
|
|
54
|
-
isBrowser: typeof window !== 'undefined' && typeof document !== 'undefined',
|
|
55
|
-
// Node.js detection
|
|
56
|
-
isNode: typeof process !== 'undefined' && process.versions && process.versions.node,
|
|
57
|
-
};
|