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,78 @@
1
+ // ======================================
2
+ // ZipCrypto.ts
3
+ // Copyright (c) 2024 NeoWare, Inc. All rights reserved.
4
+ // ======================================
5
+ // Zip Cryptography Routines
6
+ "use strict";
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.sha256 = sha256;
9
+ exports.encrypter = encrypter;
10
+ exports.decrypter = decrypter;
11
+ const crypto_1 = require("crypto");
12
+ const Util_1 = require("./Util");
13
+ const Headers_1 = require("../constants/Headers");
14
+ // Return the SHA256 hash of a buffer
15
+ function sha256(data) {
16
+ const hash = (0, crypto_1.createHash)('sha256');
17
+ return hash
18
+ .update(data)
19
+ .digest('hex');
20
+ }
21
+ class InitKeys {
22
+ constructor(pw) {
23
+ this.keys = new Uint32Array([0x12345678, 0x23456789, 0x34567890]);
24
+ const pass = typeof pw === 'string' ? Buffer.from(pw) : pw;
25
+ for (let i = 0; i < pass.length; i++) {
26
+ this.updateKeys(pass[i]);
27
+ }
28
+ }
29
+ updateKeys(byteValue) {
30
+ this.keys[0] = (0, Util_1.crc32update)(this.keys[0], byteValue);
31
+ this.keys[1] = ((this.keys[1] + (this.keys[0] & 0xff)) * 0x08088405 + 1) >>> 0;
32
+ this.keys[2] = (0, Util_1.crc32update)(this.keys[2], this.keys[1] >>> 24);
33
+ return byteValue;
34
+ }
35
+ next() {
36
+ const k = (this.keys[2] | 2) >>> 0; // key
37
+ return ((0, Util_1.uMul)(k, k ^ 1) >> 8) & 0xff; // decode
38
+ }
39
+ }
40
+ // Return encrypting function, result and pos is here so we dont have to merge buffers later
41
+ function make_encrypter(pwd) {
42
+ const keys = new InitKeys(pwd);
43
+ return function (data, result, pos = 0) {
44
+ // result - we create new Buffer for results
45
+ if (!result)
46
+ result = Buffer.alloc(data.length);
47
+ // process input data
48
+ for (let c of data) {
49
+ const k = keys.next(); // save key byte
50
+ result[pos++] = c ^ k; // save val
51
+ keys.updateKeys(c); // update keys with decoded byte
52
+ }
53
+ return result;
54
+ };
55
+ }
56
+ // Encrypt data with password and include a checkByte verification byte at the end
57
+ function encrypter(data, checkByte, pwd) {
58
+ if (!data)
59
+ return null;
60
+ const _encrypter = make_encrypter(pwd);
61
+ const salt = (0, crypto_1.randomFillSync)(Buffer.alloc(Headers_1.ENCRYPT_HDR_SIZE));
62
+ salt[Headers_1.ENCRYPT_HDR_SIZE - 1] = checkByte;
63
+ // create encryption header
64
+ const result = Buffer.alloc(data.length + Headers_1.ENCRYPT_HDR_SIZE);
65
+ _encrypter(salt, result);
66
+ // encode content
67
+ return _encrypter(data, result, Headers_1.ENCRYPT_HDR_SIZE);
68
+ }
69
+ // Return the decrypter function
70
+ function decrypter(pwd) {
71
+ const keys = new InitKeys(pwd);
72
+ return function (data) {
73
+ for (let i = 0; i < data.length; i++) {
74
+ data[i] = keys.updateKeys(data[i] ^ keys.next());
75
+ }
76
+ return data;
77
+ };
78
+ }
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Configuration options for Merkle tree construction
3
+ */
4
+ interface MerkleTreeOptions {
5
+ hashLeaves: boolean;
6
+ sortLeaves: boolean;
7
+ sortPairs: boolean;
8
+ duplicateOdd: boolean;
9
+ }
10
+ /**
11
+ * Implementation of a Merkle Tree (hash tree) using SHA-256
12
+ *
13
+ * A Merkle tree is a binary tree where each non-leaf node is the hash of its two children.
14
+ * This allows efficient verification of large datasets by only storing/transmitting the root hash
15
+ * and generating proofs of inclusion for individual items.
16
+ */
17
+ export declare class MerkleTree {
18
+ private leaves;
19
+ private layers;
20
+ private options;
21
+ /**
22
+ * Creates a new Merkle tree from an array of leaf nodes
23
+ * @param leaves - Array of leaf node data as Buffers
24
+ * @param options - Configuration options for tree construction
25
+ */
26
+ constructor(leaves: Buffer[], options?: Partial<MerkleTreeOptions>);
27
+ /**
28
+ * Computes SHA-256 hash of input data
29
+ * @param data - Data to hash
30
+ * @returns Buffer containing hash
31
+ */
32
+ private hash;
33
+ /**
34
+ * Combines two child hashes to create parent hash
35
+ * @param left - Left child hash
36
+ * @param right - Right child hash
37
+ * @returns Combined hash of children
38
+ */
39
+ private combinedHash;
40
+ /**
41
+ * Builds the Merkle tree by creating successive layers of hashes
42
+ * @param nodes - Array of nodes in current layer
43
+ */
44
+ private createHashes;
45
+ /**
46
+ * Gets the root hash of the Merkle tree
47
+ * @returns Buffer containing root hash
48
+ */
49
+ getRoot(): Buffer;
50
+ /**
51
+ * Generates a proof of inclusion for a leaf node
52
+ * @param leaf - The leaf node to generate proof for
53
+ * @returns Array of sibling hashes needed to reconstruct root
54
+ * @throws Error if leaf not found in tree
55
+ */
56
+ getProof(leaf: Buffer): Buffer[];
57
+ /**
58
+ * Verifies a proof of inclusion for a leaf node
59
+ * @param proof - Array of sibling hashes from getProof()
60
+ * @param targetHash - Hash of the leaf node being verified
61
+ * @param root - Expected root hash
62
+ * @returns boolean indicating if proof is valid
63
+ */
64
+ verify(proof: Buffer[], targetHash: Buffer, root: Buffer): boolean;
65
+ }
66
+ export {};
@@ -0,0 +1,136 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MerkleTree = void 0;
4
+ const crypto_1 = require("crypto");
5
+ /**
6
+ * Implementation of a Merkle Tree (hash tree) using SHA-256
7
+ *
8
+ * A Merkle tree is a binary tree where each non-leaf node is the hash of its two children.
9
+ * This allows efficient verification of large datasets by only storing/transmitting the root hash
10
+ * and generating proofs of inclusion for individual items.
11
+ */
12
+ class MerkleTree {
13
+ /**
14
+ * Creates a new Merkle tree from an array of leaf nodes
15
+ * @param leaves - Array of leaf node data as Buffers
16
+ * @param options - Configuration options for tree construction
17
+ */
18
+ constructor(leaves, options = {}) {
19
+ this.options = {
20
+ hashLeaves: false,
21
+ sortLeaves: true,
22
+ sortPairs: true,
23
+ duplicateOdd: true,
24
+ ...options
25
+ };
26
+ // Process leaves according to options
27
+ this.leaves = leaves.map(leaf => {
28
+ if (this.options.hashLeaves) {
29
+ return this.hash(leaf);
30
+ }
31
+ return Buffer.isBuffer(leaf) ? leaf : Buffer.from(leaf);
32
+ });
33
+ if (this.options.sortLeaves) {
34
+ this.leaves.sort(Buffer.compare);
35
+ }
36
+ this.layers = [this.leaves];
37
+ this.createHashes(this.leaves);
38
+ }
39
+ /**
40
+ * Computes SHA-256 hash of input data
41
+ * @param data - Data to hash
42
+ * @returns Buffer containing hash
43
+ */
44
+ hash(data) {
45
+ return (0, crypto_1.createHash)('sha256').update(data).digest();
46
+ }
47
+ /**
48
+ * Combines two child hashes to create parent hash
49
+ * @param left - Left child hash
50
+ * @param right - Right child hash
51
+ * @returns Combined hash of children
52
+ */
53
+ combinedHash(left, right) {
54
+ if (this.options.sortPairs && Buffer.compare(left, right) > 0) {
55
+ [left, right] = [right, left];
56
+ }
57
+ return this.hash(Buffer.concat([left, right]));
58
+ }
59
+ /**
60
+ * Builds the Merkle tree by creating successive layers of hashes
61
+ * @param nodes - Array of nodes in current layer
62
+ */
63
+ createHashes(nodes) {
64
+ while (nodes.length > 1) {
65
+ const layerIndex = this.layers.length;
66
+ this.layers.push([]);
67
+ // Process pairs of nodes
68
+ for (let i = 0; i < nodes.length - 1; i += 2) {
69
+ const left = nodes[i];
70
+ const right = nodes[i + 1];
71
+ const hash = this.combinedHash(left, right);
72
+ this.layers[layerIndex].push(hash);
73
+ }
74
+ // Handle odd number of nodes
75
+ if (nodes.length % 2 === 1) {
76
+ const last = nodes[nodes.length - 1];
77
+ if (this.options.duplicateOdd) {
78
+ // Duplicate the last node if odd
79
+ const hash = this.combinedHash(last, last);
80
+ this.layers[layerIndex].push(hash);
81
+ }
82
+ else {
83
+ // Push last node up to next layer
84
+ this.layers[layerIndex].push(last);
85
+ }
86
+ }
87
+ nodes = this.layers[layerIndex];
88
+ }
89
+ }
90
+ /**
91
+ * Gets the root hash of the Merkle tree
92
+ * @returns Buffer containing root hash
93
+ */
94
+ getRoot() {
95
+ return this.layers[this.layers.length - 1][0];
96
+ }
97
+ /**
98
+ * Generates a proof of inclusion for a leaf node
99
+ * @param leaf - The leaf node to generate proof for
100
+ * @returns Array of sibling hashes needed to reconstruct root
101
+ * @throws Error if leaf not found in tree
102
+ */
103
+ getProof(leaf) {
104
+ let index = this.leaves.findIndex(item => item.equals(leaf));
105
+ if (index === -1) {
106
+ throw new Error('Leaf not found in tree');
107
+ }
108
+ return this.layers.reduce((proof, layer) => {
109
+ if (layer.length === 1)
110
+ return proof;
111
+ const pairIndex = index % 2 === 0 ? index + 1 : index - 1;
112
+ if (pairIndex < layer.length) {
113
+ proof.push(layer[pairIndex]);
114
+ }
115
+ index = Math.floor(index / 2);
116
+ return proof;
117
+ }, []);
118
+ }
119
+ /**
120
+ * Verifies a proof of inclusion for a leaf node
121
+ * @param proof - Array of sibling hashes from getProof()
122
+ * @param targetHash - Hash of the leaf node being verified
123
+ * @param root - Expected root hash
124
+ * @returns boolean indicating if proof is valid
125
+ */
126
+ verify(proof, targetHash, root) {
127
+ let computedHash = targetHash;
128
+ for (const proofElement of proof) {
129
+ computedHash = Buffer.compare(computedHash, proofElement) <= 0
130
+ ? this.combinedHash(computedHash, proofElement)
131
+ : this.combinedHash(proofElement, computedHash);
132
+ }
133
+ return computedHash.equals(root);
134
+ }
135
+ }
136
+ exports.MerkleTree = MerkleTree;
@@ -0,0 +1,53 @@
1
+ declare const _default: {
2
+ INVALID_LOC: string;
3
+ INVALID_CEN: string;
4
+ INVALID_END: string;
5
+ NO_DATA: string;
6
+ FILE_IN_THE_WAY: string;
7
+ UNKNOWN_METHOD: string;
8
+ STRONG_ENCRYPT_UNSUPPORTED: string;
9
+ INVALID_TIMESTAMP: string;
10
+ TIMESTAMP_FAILED: string;
11
+ AVAIL_DATA: string;
12
+ INVALID_DISTANCE: string;
13
+ TO_MANY_CODES: string;
14
+ INVALID_REPEAT_LEN: string;
15
+ INVALID_REPEAT_FIRST: string;
16
+ INCOMPLETE_CODES: string;
17
+ INVALID_DYN_DISTANCE: string;
18
+ INVALID_CODES_LEN: string;
19
+ INVALID_STORE_BLOCK: string;
20
+ INVALID_BLOCK_TYPE: string;
21
+ INVALID_CMP_DATA_LENGTH: string;
22
+ EXTRACT_FAILED: string;
23
+ INVALID_CRC: string;
24
+ UNKNOWN_SHA256: string;
25
+ INVALID_SHA256: string;
26
+ CANT_EXTRACT_FILE: string;
27
+ CANT_OVERRIDE: string;
28
+ NO_ZIP: string;
29
+ NO_ENTRY: string;
30
+ DIRECTORY_CONTENT_ERROR: string;
31
+ FILE_NOT_FOUND: string;
32
+ NOT_IMPLEMENTED: string;
33
+ INVALID_FILENAME: string;
34
+ INVALID_FORMAT: string;
35
+ NO_STREAM_SUPPORT: string;
36
+ NO_BLOB_SUPPORT: string;
37
+ NO_FILE_READER_SUPPORT: string;
38
+ NO_FILES: string;
39
+ DATATYPE_STRING_UNSUPPORTED: string;
40
+ DATATYPE_ARRAY_UNSUPPORTED: string;
41
+ DATATYPE_BUFFER_UNSUPPORTED: string;
42
+ DATATYPE_BLOB_UNSUPPORTED: string;
43
+ DATATYPE_U8ARRAY_UNSUPPORTED: string;
44
+ DATATYPE_ARRAYBUFFER_UNSUPPORTED: string;
45
+ DATATYPE_UNSUPPORTED: string;
46
+ COMPRESS_FAILED: string;
47
+ COMPRESSION_ERROR: string;
48
+ DECOMPRESSION_ERROR: string;
49
+ ENCRYPT_FAILED: string;
50
+ CERTIFICATE_OTS_BAD: string;
51
+ CERTIFICATE_OTS_FAILED: string;
52
+ };
53
+ export default _default;
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ // ======================================
3
+ // Errors.ts
4
+ // Copyright (c) 2024 NeoWare, Inc. All rights reserved.
5
+ // ======================================
6
+ // Error messages
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.default = {
9
+ /* Header error messages */
10
+ INVALID_LOC: "Invalid LOC header (bad signature)",
11
+ INVALID_CEN: "Invalid CEN header (bad signature)",
12
+ INVALID_END: "Invalid END header (bad signature)",
13
+ /* ZipEntry error messages*/
14
+ NO_DATA: "Nothing to decompress",
15
+ FILE_IN_THE_WAY: "There is a file in the way: %s",
16
+ UNKNOWN_METHOD: "Invalid/unsupported compression method",
17
+ /* Encryption Errors */
18
+ STRONG_ENCRYPT_UNSUPPORTED: "Strong Encryption is not supported",
19
+ /* Timestamp error messages */
20
+ INVALID_TIMESTAMP: "Invalid timestamp",
21
+ TIMESTAMP_FAILED: "Failed to create the timestamp",
22
+ /* Inflater error messages */
23
+ AVAIL_DATA: "inflate::Available inflate data did not terminate",
24
+ INVALID_DISTANCE: "inflate::Invalid literal/length or distance code in fixed or dynamic block",
25
+ TO_MANY_CODES: "inflate::Dynamic block code description: too many length or distance codes",
26
+ INVALID_REPEAT_LEN: "inflate::Dynamic block code description: repeat more than specified lengths",
27
+ INVALID_REPEAT_FIRST: "inflate::Dynamic block code description: repeat lengths with no first length",
28
+ INCOMPLETE_CODES: "inflate::Dynamic block code description: code lengths codes incomplete",
29
+ INVALID_DYN_DISTANCE: "inflate::Dynamic block code description: invalid distance code lengths",
30
+ INVALID_CODES_LEN: "inflate::Dynamic block code description: invalid literal/length code lengths",
31
+ INVALID_STORE_BLOCK: "inflate::Stored block length did not match one's complement",
32
+ INVALID_BLOCK_TYPE: "inflate::Invalid block type (type == 3)",
33
+ /* Extract error messages */
34
+ INVALID_CMP_DATA_LENGTH: "Compressed data length does not match the expected length",
35
+ EXTRACT_FAILED: "Failed to extract file",
36
+ INVALID_CRC: "CRC32 checksum does not match the expected value",
37
+ UNKNOWN_SHA256: "The SHA-256 hash has not been saved",
38
+ INVALID_SHA256: "The SHA-256 hash does not match the expected value",
39
+ /* NEO-ZIP error messages */
40
+ CANT_EXTRACT_FILE: "Could not extract the file",
41
+ CANT_OVERRIDE: "Target file already exists",
42
+ NO_ZIP: "No zip file was loaded",
43
+ NO_ENTRY: "Entry doesn't exist",
44
+ DIRECTORY_CONTENT_ERROR: "A directory cannot have content",
45
+ FILE_NOT_FOUND: "File not found: %s",
46
+ NOT_IMPLEMENTED: "Not implemented",
47
+ INVALID_FILENAME: "Invalid filename",
48
+ INVALID_FORMAT: "Invalid or unsupported zip format. No END header found",
49
+ // NeoZipKit error messages
50
+ NO_STREAM_SUPPORT: "Streams are not supported in this environment",
51
+ NO_BLOB_SUPPORT: "Blobs are not supported in this environment",
52
+ NO_FILE_READER_SUPPORT: "FileReader is not supported in this environment",
53
+ // Create Zip error messages
54
+ NO_FILES: "No files added, Zip file not created",
55
+ DATATYPE_STRING_UNSUPPORTED: "The String type is not supported by this platform.",
56
+ DATATYPE_ARRAY_UNSUPPORTED: "The Array type is not supported by this platform.",
57
+ DATATYPE_BUFFER_UNSUPPORTED: "The Buffer type is not supported by this platform.",
58
+ DATATYPE_BLOB_UNSUPPORTED: "The Blob type is not supported by this platform.",
59
+ DATATYPE_U8ARRAY_UNSUPPORTED: "The uint8Array type is not supported by this platform.",
60
+ DATATYPE_ARRAYBUFFER_UNSUPPORTED: "The ArrayBuffer type is not supported by this platform.",
61
+ DATATYPE_UNSUPPORTED: "Unsupported input type.",
62
+ COMPRESS_FAILED: 'Failed to compress data',
63
+ COMPRESSION_ERROR: 'Error occurred during compression',
64
+ DECOMPRESSION_ERROR: 'Error occurred during decompression',
65
+ ENCRYPT_FAILED: 'Encryption failed',
66
+ // Certificate error messages
67
+ CERTIFICATE_OTS_BAD: 'Unable to create OTS certificate, bad OTS timestamp',
68
+ CERTIFICATE_OTS_FAILED: 'Failed to create OTS certificate',
69
+ };
@@ -0,0 +1,167 @@
1
+ export declare const LOCAL_FILE_HEADER = "PK\u0003\u0004";
2
+ export declare const CENTRAL_FILE_HEADER = "PK\u0001\u0002";
3
+ export declare const CENTRAL_DIRECTORY_END = "PK\u0005\u0006";
4
+ export declare const ZIP64_CENTRAL_DIRECTORY_LOCATOR = "PK\u0006\u0007";
5
+ export declare const ZIP64_CENTRAL_DIRECTORY_END = "PK\u0006\u0006";
6
+ export declare const DATA_DESCRIPTOR = "PK\u0007\b";
7
+ export declare const TIMESTAMP_SUBMITTED = "META-INF/TS-SUBMIT.OTS";
8
+ export declare const TIMESTAMP_METADATA = "META-INF/TIMESTAMP.OTS";
9
+ export declare const TOKENIZED_METADATA = "META-INF/NZIP.TOKEN";
10
+ export declare const LOCAL_HDR: {
11
+ SIZE: number;
12
+ SIGNATURE: number;
13
+ VER_EXTRACT: number;
14
+ FLAGS: number;
15
+ COMPRESSION: number;
16
+ TIMEDATE_DOS: number;
17
+ CRC: number;
18
+ CMP_SIZE: number;
19
+ UNCMP_SIZE: number;
20
+ FNAME_LEN: number;
21
+ EXTRA_LEN: number;
22
+ };
23
+ export declare const ENCRYPT_HDR_SIZE = 12;
24
+ export declare const DATA_DESC: {
25
+ SIGNATURE: number;
26
+ SIZE: number;
27
+ CRC: number;
28
+ CMP_SIZE: number;
29
+ UNCMP_SIZE: number;
30
+ };
31
+ export declare const CENTRAL_DIR: {
32
+ SIZE: number;
33
+ SIGNATURE: number;
34
+ VER_MADE: number;
35
+ VER_EXT: number;
36
+ FLAGS: number;
37
+ CMP_METHOD: number;
38
+ TIMEDATE_DOS: number;
39
+ CRC: number;
40
+ CMP_SIZE: number;
41
+ UNCMP_SIZE: number;
42
+ FNAME_LEN: number;
43
+ EXTRA_LEN: number;
44
+ COMMENT_LEN: number;
45
+ DISK_NUM: number;
46
+ INT_FILE_ATTR: number;
47
+ EXT_FILE_ATTR: number;
48
+ LOCAL_HDR_OFFSET: number;
49
+ };
50
+ export declare const CENTRAL_END: {
51
+ SIZE: number;
52
+ SIGNATURE: number;
53
+ VOL_NUM: number;
54
+ VOLDIR_START: number;
55
+ VOL_ENTRIES: number;
56
+ TOTAL_ENTRIES: number;
57
+ CENTRAL_DIR_SIZE: number;
58
+ CENTRAL_DIR_OFFSET: number;
59
+ ZIP_COMMENT_LEN: number;
60
+ };
61
+ export declare const ZIP64_CENTRAL_DIR: {
62
+ SIGNATURE: number;
63
+ SIZE: number;
64
+ LEAD: number;
65
+ SIZE_FIELD: number;
66
+ VER_MADEBY: number;
67
+ VER_NEEDED: number;
68
+ VOL_NUM: number;
69
+ VOLDIR_START: number;
70
+ VOL_ENTRIES: number;
71
+ TOTAL_ENTRIES: number;
72
+ CENTRAL_DIR_SIZE: number;
73
+ CENTRAL_DIR_OFFSET: number;
74
+ EXTRA_FIELD: number;
75
+ };
76
+ export declare const ZIP64_CENTRAL_END: {
77
+ SIZE: number;
78
+ SIGNATURE: number;
79
+ VOL_NUM: number;
80
+ CENTRAL_DIR_OFFSET: number;
81
+ TOTAL_DISKS: number;
82
+ };
83
+ export declare const CMP_METHOD: {
84
+ STORED: number;
85
+ SHRUNK: number;
86
+ REDUCED1: number;
87
+ REDUCED2: number;
88
+ REDUCED3: number;
89
+ REDUCED4: number;
90
+ IMPLODED: number;
91
+ DEFLATED: number;
92
+ ENHANCED_DEFLATE: number;
93
+ BZIP2: number;
94
+ LZMA: number;
95
+ IBM_TERSE: number;
96
+ IBM_LZ77: number;
97
+ ZSTD: number;
98
+ AES_ENCRYPT: number;
99
+ };
100
+ export declare const GP_FLAG: {
101
+ ENCRYPTED: number;
102
+ COMPRESSION1: number;
103
+ COMPRESSION2: number;
104
+ DATA_DESC: number;
105
+ ENHANCED_DEFLATE: number;
106
+ PATCHED: number;
107
+ STRONG_ENCRYPT: number;
108
+ EFS: number;
109
+ MASK: number;
110
+ };
111
+ export declare const EXTENSIBLE_DATA_FIELDS: {
112
+ ID: number;
113
+ SIZE: number;
114
+ };
115
+ export declare const HDR_ID: {
116
+ ZIP64: number;
117
+ AVINFO: number;
118
+ PFS: number;
119
+ OS2: number;
120
+ NTFS: number;
121
+ OPENVMS: number;
122
+ UNIX: number;
123
+ FORK: number;
124
+ PATCH: number;
125
+ x509PKCS7: number;
126
+ x509CERT_IDF: number;
127
+ x509CERT_IDC: number;
128
+ STRONG_ENC: number;
129
+ RECORD_MGT: number;
130
+ x509PKCS7RL: number;
131
+ IBM1: number;
132
+ IBM2: number;
133
+ SHA256: number;
134
+ POSZIP: number;
135
+ UNV_TIME: number;
136
+ UID_GID: number;
137
+ UNICODE_PATH: number;
138
+ };
139
+ export declare const FILE_SYSTEM: {
140
+ MSDOS: number;
141
+ AMIGA: number;
142
+ OPENVMS: number;
143
+ UNIX: number;
144
+ VM_CMS: number;
145
+ ATARI: number;
146
+ OS2: number;
147
+ MAC: number;
148
+ CP_M: number;
149
+ NTFS: number;
150
+ MVS: number;
151
+ VSE: number;
152
+ ACORN: number;
153
+ VFAT: number;
154
+ ALTMVS: number;
155
+ BEOS: number;
156
+ TANDEM: number;
157
+ OS400: number;
158
+ DARWIN: number;
159
+ };
160
+ export declare const DOS_FILE_ATTR: {
161
+ READONLY: number;
162
+ HIDDEN: number;
163
+ SYSTEM: number;
164
+ VOLUME: number;
165
+ DIRECTORY: number;
166
+ ARCHIVE: number;
167
+ };