@dcl/content-validator 7.1.6-24943341641.commit-69601e0 → 7.2.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 +201 -0
- package/README.md +225 -18
- package/dist/image-metadata.d.ts +50 -0
- package/dist/image-metadata.d.ts.map +1 -0
- package/dist/image-metadata.js +407 -0
- package/dist/image-metadata.js.map +1 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +34 -45
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utils.d.ts +13 -14
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +4 -5
- package/dist/utils.js.map +1 -1
- package/dist/validations/ADR45.d.ts +1 -1
- package/dist/validations/ADR45.d.ts.map +1 -1
- package/dist/validations/ADR45.js +2 -3
- package/dist/validations/ADR45.js.map +1 -1
- package/dist/validations/ADR51.d.ts +4 -3
- package/dist/validations/ADR51.d.ts.map +1 -1
- package/dist/validations/ADR51.js.map +1 -1
- package/dist/validations/access/common/items.d.ts +3 -3
- package/dist/validations/access/common/items.d.ts.map +1 -1
- package/dist/validations/access/common/items.js +6 -5
- package/dist/validations/access/common/items.js.map +1 -1
- package/dist/validations/access/common/outfits.d.ts +1 -1
- package/dist/validations/access/common/outfits.d.ts.map +1 -1
- package/dist/validations/access/common/outfits.js +2 -3
- package/dist/validations/access/common/outfits.js.map +1 -1
- package/dist/validations/access/common/profile.d.ts +1 -1
- package/dist/validations/access/common/profile.d.ts.map +1 -1
- package/dist/validations/access/common/profile.js +4 -5
- package/dist/validations/access/common/profile.js.map +1 -1
- package/dist/validations/access/common/stores.d.ts +1 -1
- package/dist/validations/access/common/stores.d.ts.map +1 -1
- package/dist/validations/access/common/stores.js +5 -3
- package/dist/validations/access/common/stores.js.map +1 -1
- package/dist/validations/access/index.d.ts +1 -1
- package/dist/validations/access/index.d.ts.map +1 -1
- package/dist/validations/access/index.js +1 -2
- package/dist/validations/access/index.js.map +1 -1
- package/dist/validations/access/on-chain/client.d.ts +3 -3
- package/dist/validations/access/on-chain/client.d.ts.map +1 -1
- package/dist/validations/access/on-chain/client.js +4 -4
- package/dist/validations/access/on-chain/client.js.map +1 -1
- package/dist/validations/access/on-chain/collection-asset.d.ts +1 -1
- package/dist/validations/access/on-chain/collection-asset.d.ts.map +1 -1
- package/dist/validations/access/on-chain/collection-asset.js +7 -4
- package/dist/validations/access/on-chain/collection-asset.js.map +1 -1
- package/dist/validations/access/on-chain/index.d.ts +1 -1
- package/dist/validations/access/on-chain/index.d.ts.map +1 -1
- package/dist/validations/access/on-chain/index.js +3 -4
- package/dist/validations/access/on-chain/index.js.map +1 -1
- package/dist/validations/access/on-chain/outfits.d.ts +2 -2
- package/dist/validations/access/on-chain/outfits.d.ts.map +1 -1
- package/dist/validations/access/on-chain/outfits.js +1 -2
- package/dist/validations/access/on-chain/outfits.js.map +1 -1
- package/dist/validations/access/on-chain/profiles.d.ts +2 -2
- package/dist/validations/access/on-chain/profiles.d.ts.map +1 -1
- package/dist/validations/access/on-chain/profiles.js +1 -2
- package/dist/validations/access/on-chain/profiles.js.map +1 -1
- package/dist/validations/access/on-chain/scenes.d.ts +2 -2
- package/dist/validations/access/on-chain/scenes.d.ts.map +1 -1
- package/dist/validations/access/on-chain/scenes.js +2 -3
- package/dist/validations/access/on-chain/scenes.js.map +1 -1
- package/dist/validations/access/on-chain/third-party-asset.d.ts +1 -1
- package/dist/validations/access/on-chain/third-party-asset.d.ts.map +1 -1
- package/dist/validations/access/on-chain/third-party-asset.js +2 -3
- package/dist/validations/access/on-chain/third-party-asset.js.map +1 -1
- package/dist/validations/access/subgraph/collection-asset.d.ts +5 -5
- package/dist/validations/access/subgraph/collection-asset.d.ts.map +1 -1
- package/dist/validations/access/subgraph/collection-asset.js +5 -3
- package/dist/validations/access/subgraph/collection-asset.js.map +1 -1
- package/dist/validations/access/subgraph/index.d.ts +1 -1
- package/dist/validations/access/subgraph/index.d.ts.map +1 -1
- package/dist/validations/access/subgraph/index.js +3 -4
- package/dist/validations/access/subgraph/index.js.map +1 -1
- package/dist/validations/access/subgraph/outfits.d.ts +2 -2
- package/dist/validations/access/subgraph/outfits.d.ts.map +1 -1
- package/dist/validations/access/subgraph/outfits.js +1 -2
- package/dist/validations/access/subgraph/outfits.js.map +1 -1
- package/dist/validations/access/subgraph/profiles.d.ts +2 -2
- package/dist/validations/access/subgraph/profiles.d.ts.map +1 -1
- package/dist/validations/access/subgraph/profiles.js +1 -2
- package/dist/validations/access/subgraph/profiles.js.map +1 -1
- package/dist/validations/access/subgraph/scenes.d.ts +2 -2
- package/dist/validations/access/subgraph/scenes.d.ts.map +1 -1
- package/dist/validations/access/subgraph/scenes.js +4 -5
- package/dist/validations/access/subgraph/scenes.js.map +1 -1
- package/dist/validations/access/subgraph/the-graph-client.d.ts +4 -4
- package/dist/validations/access/subgraph/the-graph-client.d.ts.map +1 -1
- package/dist/validations/access/subgraph/the-graph-client.js +4 -4
- package/dist/validations/access/subgraph/the-graph-client.js.map +1 -1
- package/dist/validations/access/subgraph/third-party-asset.d.ts +1 -1
- package/dist/validations/access/subgraph/third-party-asset.d.ts.map +1 -1
- package/dist/validations/access/subgraph/third-party-asset.js +2 -3
- package/dist/validations/access/subgraph/third-party-asset.js.map +1 -1
- package/dist/validations/content.d.ts +1 -1
- package/dist/validations/content.d.ts.map +1 -1
- package/dist/validations/content.js +4 -5
- package/dist/validations/content.js.map +1 -1
- package/dist/validations/entity-structure.d.ts +1 -1
- package/dist/validations/entity-structure.d.ts.map +1 -1
- package/dist/validations/entity-structure.js +1 -2
- package/dist/validations/entity-structure.js.map +1 -1
- package/dist/validations/index.d.ts +1 -1
- package/dist/validations/index.d.ts.map +1 -1
- package/dist/validations/index.js +2 -3
- package/dist/validations/index.js.map +1 -1
- package/dist/validations/ipfs-hashing.d.ts.map +1 -1
- package/dist/validations/ipfs-hashing.js +1 -1
- package/dist/validations/ipfs-hashing.js.map +1 -1
- package/dist/validations/items/emotes.d.ts +1 -1
- package/dist/validations/items/emotes.d.ts.map +1 -1
- package/dist/validations/items/emotes.js +4 -4
- package/dist/validations/items/emotes.js.map +1 -1
- package/dist/validations/items/items.d.ts +1 -1
- package/dist/validations/items/items.d.ts.map +1 -1
- package/dist/validations/items/items.js +8 -14
- package/dist/validations/items/items.js.map +1 -1
- package/dist/validations/items/wearables.d.ts +2 -2
- package/dist/validations/items/wearables.d.ts.map +1 -1
- package/dist/validations/items/wearables.js +3 -3
- package/dist/validations/items/wearables.js.map +1 -1
- package/dist/validations/metadata-schema.d.ts +1 -1
- package/dist/validations/metadata-schema.d.ts.map +1 -1
- package/dist/validations/metadata-schema.js +1 -1
- package/dist/validations/metadata-schema.js.map +1 -1
- package/dist/validations/outfits.d.ts +1 -1
- package/dist/validations/outfits.d.ts.map +1 -1
- package/dist/validations/outfits.js +7 -7
- package/dist/validations/outfits.js.map +1 -1
- package/dist/validations/profile.d.ts +1 -1
- package/dist/validations/profile.d.ts.map +1 -1
- package/dist/validations/profile.js +22 -25
- package/dist/validations/profile.js.map +1 -1
- package/dist/validations/scene.d.ts.map +1 -1
- package/dist/validations/scene.js +1 -1
- package/dist/validations/scene.js.map +1 -1
- package/dist/validations/signature.d.ts +1 -1
- package/dist/validations/signature.d.ts.map +1 -1
- package/dist/validations/signature.js +1 -2
- package/dist/validations/signature.js.map +1 -1
- package/dist/validations/size.d.ts +1 -1
- package/dist/validations/size.d.ts.map +1 -1
- package/dist/validations/size.js +3 -4
- package/dist/validations/size.js.map +1 -1
- package/dist/validations/validations.d.ts +2 -2
- package/dist/validations/validations.d.ts.map +1 -1
- package/dist/validations/validations.js +13 -14
- package/dist/validations/validations.js.map +1 -1
- package/package.json +35 -40
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Minimal image-metadata reader used by thumbnail validations.
|
|
4
|
+
*
|
|
5
|
+
* The library only needs to know the format ("png" vs anything else) and the
|
|
6
|
+
* pixel dimensions to enforce the catalyst thumbnail rules. We deliberately
|
|
7
|
+
* avoid pulling in `sharp` for that — a full image pipeline with native
|
|
8
|
+
* bindings is overkill for a header read, and ships a multi-MB libvips that
|
|
9
|
+
* needs an extra system dependency on every CI runner.
|
|
10
|
+
*
|
|
11
|
+
* Beyond reading dimensions, the reader applies structural sanity checks per
|
|
12
|
+
* format: PNG chunk-chain integrity (single IHDR, terminating IEND, no
|
|
13
|
+
* trailing data, spec-allowed bit-depth/color-type combination), JPEG
|
|
14
|
+
* EOI termination, WebP RIFF chunk-size match, and a uniform "non-zero,
|
|
15
|
+
* non-negative dimensions" contract on the returned width/height.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.readImageMetadata = readImageMetadata;
|
|
19
|
+
const PNG_SIGNATURE = Buffer.from([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]);
|
|
20
|
+
const PNG_IHDR_BYTES = Buffer.from('IHDR', 'ascii');
|
|
21
|
+
const PNG_IEND_BYTES = Buffer.from('IEND', 'ascii');
|
|
22
|
+
const PNG_IHDR_CHUNK_LENGTH = 13;
|
|
23
|
+
const PNG_FIRST_CHUNK_END = 33; // 8 (signature) + 4 (length) + 4 (type) + 13 (IHDR data) + 4 (CRC)
|
|
24
|
+
const PNG_CHUNK_OVERHEAD = 12; // length(4) + type(4) + crc(4)
|
|
25
|
+
// PNG spec (ISO/IEC 15948 §5.3): chunk lengths shall not exceed 2^31-1 bytes
|
|
26
|
+
// even though the wire field is 4 bytes. Anything above that is a parser
|
|
27
|
+
// differential — some readers reject, some accept the high bit silently.
|
|
28
|
+
const PNG_MAX_CHUNK_LENGTH = 0x7fffffff;
|
|
29
|
+
// Spec-permitted bit-depth + color-type combinations (PNG, ISO/IEC 15948, §11.2.2).
|
|
30
|
+
const PNG_VALID_BIT_DEPTHS_BY_COLOR_TYPE = {
|
|
31
|
+
0: [1, 2, 4, 8, 16], // Grayscale
|
|
32
|
+
2: [8, 16], // Truecolor (RGB)
|
|
33
|
+
3: [1, 2, 4, 8], // Indexed-colour (Palette)
|
|
34
|
+
4: [8, 16], // Greyscale + Alpha
|
|
35
|
+
6: [8, 16] // Truecolor + Alpha (RGBA)
|
|
36
|
+
};
|
|
37
|
+
const WEBP_RIFF_BYTES = Buffer.from('RIFF', 'ascii');
|
|
38
|
+
const WEBP_WEBP_BYTES = Buffer.from('WEBP', 'ascii');
|
|
39
|
+
const WEBP_VP8_BYTES = Buffer.from('VP8 ', 'ascii');
|
|
40
|
+
const WEBP_VP8L_BYTES = Buffer.from('VP8L', 'ascii');
|
|
41
|
+
const WEBP_VP8X_BYTES = Buffer.from('VP8X', 'ascii');
|
|
42
|
+
const GIF87A_BYTES = Buffer.from('GIF87a', 'ascii');
|
|
43
|
+
const GIF89A_BYTES = Buffer.from('GIF89a', 'ascii');
|
|
44
|
+
const JPEG_EOI_BYTE_1 = 0xff;
|
|
45
|
+
const JPEG_EOI_BYTE_2 = 0xd9;
|
|
46
|
+
/**
|
|
47
|
+
* Compare a slice of `buffer` to `expected` using byte-exact equality.
|
|
48
|
+
*
|
|
49
|
+
* Buffer.toString('ascii') masks the high bit of each byte before decoding,
|
|
50
|
+
* so a chunk type stored as e.g. [0x49, 0x48, 0xC4, 0x52] would otherwise
|
|
51
|
+
* decode as "IHDR" — a parser differential vs. real PNG/WebP/GIF readers.
|
|
52
|
+
* This helper is used everywhere a magic byte sequence or chunk identifier
|
|
53
|
+
* needs to be compared.
|
|
54
|
+
*/
|
|
55
|
+
function bufferEqualsAt(buffer, offset, expected) {
|
|
56
|
+
if (offset < 0 || offset + expected.length > buffer.length)
|
|
57
|
+
return false;
|
|
58
|
+
return buffer.subarray(offset, offset + expected.length).equals(expected);
|
|
59
|
+
}
|
|
60
|
+
// Display names used in user-facing error messages, matching the casing
|
|
61
|
+
// produced by the format-specific validators (e.g. "Malformed PNG", "Malformed WebP").
|
|
62
|
+
const FORMAT_DISPLAY_NAME = {
|
|
63
|
+
png: 'PNG',
|
|
64
|
+
jpeg: 'JPEG',
|
|
65
|
+
webp: 'WebP',
|
|
66
|
+
gif: 'GIF',
|
|
67
|
+
bmp: 'BMP'
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Reads the format and pixel dimensions of a recognised image buffer.
|
|
71
|
+
*
|
|
72
|
+
* Recognises PNG, JPEG, WebP, GIF, and BMP by their magic bytes. The library
|
|
73
|
+
* only enforces a PNG-format check on top of this, but recognising the other
|
|
74
|
+
* common formats means a user uploading a JPEG/WebP/GIF/BMP thumbnail gets
|
|
75
|
+
* the precise "Invalid format" error instead of a generic parse failure.
|
|
76
|
+
*
|
|
77
|
+
* Throws if the buffer is not a recognised, structurally-valid image with
|
|
78
|
+
* non-zero, non-negative dimensions. Callers are expected to wrap calls in
|
|
79
|
+
* try/catch to translate the throw into a "couldn't parse" validation error.
|
|
80
|
+
* @public
|
|
81
|
+
*/
|
|
82
|
+
function readImageMetadata(input) {
|
|
83
|
+
// Reject SharedArrayBuffer-backed inputs: a concurrent writer could race the
|
|
84
|
+
// parser between length checks and reads (TOCTOU). The reader operates on
|
|
85
|
+
// bytes only; callers who need shared memory must copy into a regular
|
|
86
|
+
// ArrayBuffer first.
|
|
87
|
+
if (typeof SharedArrayBuffer !== 'undefined' && input.buffer instanceof SharedArrayBuffer) {
|
|
88
|
+
throw new Error('Image input must not be backed by a SharedArrayBuffer');
|
|
89
|
+
}
|
|
90
|
+
// Wrap as Buffer to access readUInt*BE / equals / toString without copying.
|
|
91
|
+
const buffer = Buffer.isBuffer(input) ? input : Buffer.from(input.buffer, input.byteOffset, input.byteLength);
|
|
92
|
+
let metadata;
|
|
93
|
+
if (isPng(buffer))
|
|
94
|
+
metadata = readPngMetadata(buffer);
|
|
95
|
+
else if (isJpeg(buffer))
|
|
96
|
+
metadata = readJpegMetadata(buffer);
|
|
97
|
+
else if (isWebp(buffer))
|
|
98
|
+
metadata = readWebpMetadata(buffer);
|
|
99
|
+
else if (isGif(buffer))
|
|
100
|
+
metadata = readGifMetadata(buffer);
|
|
101
|
+
else if (isBmp(buffer))
|
|
102
|
+
metadata = readBmpMetadata(buffer);
|
|
103
|
+
else
|
|
104
|
+
throw new Error('Unsupported image format');
|
|
105
|
+
assertPositiveDimensions(metadata);
|
|
106
|
+
return metadata;
|
|
107
|
+
}
|
|
108
|
+
function assertPositiveDimensions(metadata) {
|
|
109
|
+
const name = FORMAT_DISPLAY_NAME[metadata.format];
|
|
110
|
+
if (!Number.isInteger(metadata.width) || metadata.width <= 0) {
|
|
111
|
+
throw new Error(`Malformed ${name}: non-positive width ${metadata.width}`);
|
|
112
|
+
}
|
|
113
|
+
if (!Number.isInteger(metadata.height) || metadata.height <= 0) {
|
|
114
|
+
throw new Error(`Malformed ${name}: non-positive height ${metadata.height}`);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
function isPng(buffer) {
|
|
118
|
+
// Require the full IHDR chunk (signature + 25-byte IHDR) to be present so
|
|
119
|
+
// readPngMetadata can safely read every IHDR field, including bit depth at
|
|
120
|
+
// byte 24 and color type at byte 25. A shorter buffer with the PNG signature
|
|
121
|
+
// is treated as unrecognised rather than as a truncated PNG.
|
|
122
|
+
return buffer.length >= PNG_FIRST_CHUNK_END && buffer.subarray(0, 8).equals(PNG_SIGNATURE);
|
|
123
|
+
}
|
|
124
|
+
function readPngMetadata(buffer) {
|
|
125
|
+
if (buffer.readUInt32BE(8) !== PNG_IHDR_CHUNK_LENGTH) {
|
|
126
|
+
throw new Error('Malformed PNG: IHDR chunk length is not 13');
|
|
127
|
+
}
|
|
128
|
+
if (!bufferEqualsAt(buffer, 12, PNG_IHDR_BYTES)) {
|
|
129
|
+
throw new Error('Malformed PNG: missing IHDR chunk');
|
|
130
|
+
}
|
|
131
|
+
const width = buffer.readUInt32BE(16);
|
|
132
|
+
const height = buffer.readUInt32BE(20);
|
|
133
|
+
validatePngBitDepthAndColorType(buffer.readUInt8(24), buffer.readUInt8(25));
|
|
134
|
+
validatePngIhdrMethods(buffer.readUInt8(26), buffer.readUInt8(27), buffer.readUInt8(28));
|
|
135
|
+
validatePngChunkChain(buffer);
|
|
136
|
+
return { format: 'png', width, height };
|
|
137
|
+
}
|
|
138
|
+
function validatePngBitDepthAndColorType(bitDepth, colorType) {
|
|
139
|
+
const allowed = PNG_VALID_BIT_DEPTHS_BY_COLOR_TYPE[colorType];
|
|
140
|
+
if (!allowed) {
|
|
141
|
+
throw new Error(`Malformed PNG: invalid color type ${colorType}`);
|
|
142
|
+
}
|
|
143
|
+
if (!allowed.includes(bitDepth)) {
|
|
144
|
+
throw new Error(`Malformed PNG: invalid bit depth ${bitDepth} for color type ${colorType}`);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
function validatePngIhdrMethods(compression, filter, interlace) {
|
|
148
|
+
// Per PNG spec (ISO/IEC 15948 §11.2.2), only deflate (0) compression and
|
|
149
|
+
// filter method 0 are defined. Interlace must be 0 (none) or 1 (Adam7).
|
|
150
|
+
if (compression !== 0) {
|
|
151
|
+
throw new Error(`Malformed PNG: invalid compression method ${compression}`);
|
|
152
|
+
}
|
|
153
|
+
if (filter !== 0) {
|
|
154
|
+
throw new Error(`Malformed PNG: invalid filter method ${filter}`);
|
|
155
|
+
}
|
|
156
|
+
if (interlace !== 0 && interlace !== 1) {
|
|
157
|
+
throw new Error(`Malformed PNG: invalid interlace method ${interlace}`);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
function validatePngChunkChain(buffer) {
|
|
161
|
+
// First chunk after the signature is IHDR (already validated by the caller).
|
|
162
|
+
// Walk subsequent chunks, requiring exactly one IEND that terminates the
|
|
163
|
+
// buffer. Reject duplicate IHDR chunks.
|
|
164
|
+
let i = PNG_FIRST_CHUNK_END;
|
|
165
|
+
while (i + PNG_CHUNK_OVERHEAD <= buffer.length) {
|
|
166
|
+
const chunkDataLength = buffer.readUInt32BE(i);
|
|
167
|
+
if (chunkDataLength > PNG_MAX_CHUNK_LENGTH) {
|
|
168
|
+
throw new Error('Malformed PNG: chunk length exceeds 2^31-1');
|
|
169
|
+
}
|
|
170
|
+
if (bufferEqualsAt(buffer, i + 4, PNG_IHDR_BYTES)) {
|
|
171
|
+
throw new Error('Malformed PNG: duplicate IHDR chunk');
|
|
172
|
+
}
|
|
173
|
+
if (bufferEqualsAt(buffer, i + 4, PNG_IEND_BYTES)) {
|
|
174
|
+
// IEND has zero-length data per ISO/IEC 15948. Validate both the
|
|
175
|
+
// declared length AND the chunk footprint: a file that declares a
|
|
176
|
+
// non-zero IEND length but only contains the 12-byte footprint would
|
|
177
|
+
// otherwise pass us while strict readers reject (they expect more
|
|
178
|
+
// bytes for IEND data + CRC).
|
|
179
|
+
if (chunkDataLength !== 0) {
|
|
180
|
+
throw new Error('Malformed PNG: IEND chunk must have zero length');
|
|
181
|
+
}
|
|
182
|
+
if (i + PNG_CHUNK_OVERHEAD !== buffer.length) {
|
|
183
|
+
throw new Error('Malformed PNG: data after IEND chunk');
|
|
184
|
+
}
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
// Advance past this chunk: length(4) + type(4) + data(N) + crc(4).
|
|
188
|
+
i += PNG_CHUNK_OVERHEAD + chunkDataLength;
|
|
189
|
+
}
|
|
190
|
+
throw new Error('Malformed PNG: missing IEND chunk');
|
|
191
|
+
}
|
|
192
|
+
function isJpeg(buffer) {
|
|
193
|
+
return buffer.length >= 4 && buffer[0] === 0xff && buffer[1] === 0xd8 && buffer[2] === 0xff;
|
|
194
|
+
}
|
|
195
|
+
function readJpegMetadata(buffer) {
|
|
196
|
+
// The buffer must be terminated by an EOI marker (FF D9). This rejects
|
|
197
|
+
// truncated JPEGs and trailing-data polyglots.
|
|
198
|
+
if (buffer.length < 4 ||
|
|
199
|
+
buffer[buffer.length - 2] !== JPEG_EOI_BYTE_1 ||
|
|
200
|
+
buffer[buffer.length - 1] !== JPEG_EOI_BYTE_2) {
|
|
201
|
+
throw new Error('Malformed JPEG: missing EOI marker');
|
|
202
|
+
}
|
|
203
|
+
// JPEG is a chain of 0xFF-prefixed segments. Dimensions live in any of the
|
|
204
|
+
// SOFn (Start Of Frame) segments — markers 0xC0..0xCF except 0xC4 (DHT),
|
|
205
|
+
// 0xC8 (JPG, reserved), and 0xCC (DAC). The SOFn payload reads up to
|
|
206
|
+
// buffer[i + 8], so we need `i + 8 < buffer.length`.
|
|
207
|
+
let i = 2;
|
|
208
|
+
while (i < buffer.length - 8) {
|
|
209
|
+
if (buffer[i] !== 0xff) {
|
|
210
|
+
i++;
|
|
211
|
+
continue;
|
|
212
|
+
}
|
|
213
|
+
const marker = buffer[i + 1];
|
|
214
|
+
// Skip fill bytes (0xFF padding before a real marker).
|
|
215
|
+
if (marker === 0x00 || marker === 0xff) {
|
|
216
|
+
i++;
|
|
217
|
+
continue;
|
|
218
|
+
}
|
|
219
|
+
// Standalone markers have no length field. Advance past the marker only
|
|
220
|
+
// so we don't read the next two bytes as a bogus segment length and
|
|
221
|
+
// desynchronise the parser. TEM=0x01, RST0..7=0xD0..0xD7, SOI=0xD8,
|
|
222
|
+
// EOI=0xD9.
|
|
223
|
+
if (marker === 0x01 || (marker >= 0xd0 && marker <= 0xd9)) {
|
|
224
|
+
i += 2;
|
|
225
|
+
continue;
|
|
226
|
+
}
|
|
227
|
+
// SOS (Start Of Scan) marks the boundary between marker stream and
|
|
228
|
+
// entropy-coded image data. SOFn must appear before SOS in any valid
|
|
229
|
+
// JPEG; if we hit SOS without one, stop scanning rather than walk
|
|
230
|
+
// entropy data hunting for a 0xFF marker (which would be a false
|
|
231
|
+
// positive on improperly stuffed bytes).
|
|
232
|
+
if (marker === 0xda) {
|
|
233
|
+
break;
|
|
234
|
+
}
|
|
235
|
+
const isStartOfFrame = marker >= 0xc0 && marker <= 0xcf && marker !== 0xc4 && marker !== 0xc8 && marker !== 0xcc;
|
|
236
|
+
if (isStartOfFrame) {
|
|
237
|
+
// SOFn payload: [length:2][precision:1][height:2][width:2][...]
|
|
238
|
+
return {
|
|
239
|
+
format: 'jpeg',
|
|
240
|
+
height: buffer.readUInt16BE(i + 5),
|
|
241
|
+
width: buffer.readUInt16BE(i + 7)
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
// Loop invariant `i < buffer.length - 8` guarantees i+3 is in bounds,
|
|
245
|
+
// so the segment-length read below is always safe.
|
|
246
|
+
const segmentLength = buffer.readUInt16BE(i + 2);
|
|
247
|
+
if (segmentLength < 2)
|
|
248
|
+
break;
|
|
249
|
+
i += 2 + segmentLength;
|
|
250
|
+
}
|
|
251
|
+
throw new Error('Malformed JPEG: no SOFn marker found');
|
|
252
|
+
}
|
|
253
|
+
function isWebp(buffer) {
|
|
254
|
+
// RIFF[4 bytes file size]WEBP[4 bytes variant identifier]
|
|
255
|
+
return buffer.length >= 16 && bufferEqualsAt(buffer, 0, WEBP_RIFF_BYTES) && bufferEqualsAt(buffer, 8, WEBP_WEBP_BYTES);
|
|
256
|
+
}
|
|
257
|
+
function readWebpMetadata(buffer) {
|
|
258
|
+
// The RIFF chunk size at bytes 4-7 covers everything after the size field
|
|
259
|
+
// itself, i.e. exactly `buffer.length - 8` for a well-formed file. A
|
|
260
|
+
// mismatch indicates truncation or trailing data injection.
|
|
261
|
+
const declaredRiffSize = buffer.readUInt32LE(4);
|
|
262
|
+
if (declaredRiffSize !== buffer.length - 8) {
|
|
263
|
+
throw new Error('Malformed WebP: RIFF chunk size does not match buffer length');
|
|
264
|
+
}
|
|
265
|
+
// After "WEBP" comes a sub-chunk identifier ("VP8 ", "VP8L", or "VP8X")
|
|
266
|
+
// and dimensions are encoded slightly differently per variant.
|
|
267
|
+
if (bufferEqualsAt(buffer, 12, WEBP_VP8_BYTES)) {
|
|
268
|
+
// Lossy: width/height are at bytes 26-29 as 14-bit little-endian values,
|
|
269
|
+
// preceded by the mandatory 3-byte VP8 keyframe sync code at bytes 23-25.
|
|
270
|
+
if (buffer.length < 30) {
|
|
271
|
+
throw new Error('Malformed WebP: VP8 chunk truncated');
|
|
272
|
+
}
|
|
273
|
+
assertWebpSimpleSubChunkSize(buffer, 'VP8');
|
|
274
|
+
if (buffer[23] !== 0x9d || buffer[24] !== 0x01 || buffer[25] !== 0x2a) {
|
|
275
|
+
throw new Error('Malformed WebP: invalid VP8 keyframe sync code');
|
|
276
|
+
}
|
|
277
|
+
return {
|
|
278
|
+
format: 'webp',
|
|
279
|
+
width: buffer.readUInt16LE(26) & 0x3fff,
|
|
280
|
+
height: buffer.readUInt16LE(28) & 0x3fff
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
if (bufferEqualsAt(buffer, 12, WEBP_VP8L_BYTES)) {
|
|
284
|
+
// Lossless: width-1 and height-1 are packed into bytes 21-24.
|
|
285
|
+
if (buffer.length < 25) {
|
|
286
|
+
throw new Error('Malformed WebP: VP8L chunk truncated');
|
|
287
|
+
}
|
|
288
|
+
assertWebpSimpleSubChunkSize(buffer, 'VP8L');
|
|
289
|
+
// VP8L spec mandates a 1-byte signature (0x2F) immediately after the
|
|
290
|
+
// 8-byte chunk header, before the packed dimensions.
|
|
291
|
+
if (buffer[20] !== 0x2f) {
|
|
292
|
+
throw new Error('Malformed WebP: invalid VP8L signature byte');
|
|
293
|
+
}
|
|
294
|
+
const b0 = buffer[21];
|
|
295
|
+
const b1 = buffer[22];
|
|
296
|
+
const b2 = buffer[23];
|
|
297
|
+
const b3 = buffer[24];
|
|
298
|
+
return {
|
|
299
|
+
format: 'webp',
|
|
300
|
+
width: 1 + ((b0 | (b1 << 8)) & 0x3fff),
|
|
301
|
+
height: 1 + (((b1 >> 6) | (b2 << 2) | (b3 << 10)) & 0x3fff)
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
if (bufferEqualsAt(buffer, 12, WEBP_VP8X_BYTES)) {
|
|
305
|
+
// Extended: width-1 and height-1 as 24-bit little-endian at bytes 24-29.
|
|
306
|
+
if (buffer.length < 30) {
|
|
307
|
+
throw new Error('Malformed WebP: VP8X chunk truncated');
|
|
308
|
+
}
|
|
309
|
+
// VP8X canvas info is always exactly 10 bytes; trailing chunks (ICCP,
|
|
310
|
+
// ANIM, …) are accounted for by the outer RIFF size only.
|
|
311
|
+
if (buffer.readUInt32LE(16) !== 10) {
|
|
312
|
+
throw new Error('Malformed WebP: VP8X chunk size must be 10');
|
|
313
|
+
}
|
|
314
|
+
return {
|
|
315
|
+
format: 'webp',
|
|
316
|
+
width: 1 + buffer.readUIntLE(24, 3),
|
|
317
|
+
height: 1 + buffer.readUIntLE(27, 3)
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
// Read the variant bytes for the error message via latin1 (preserves all
|
|
321
|
+
// byte values 0x00-0xFF) and then sanitise non-printable characters so we
|
|
322
|
+
// can't smuggle log lines through high-bit or control bytes.
|
|
323
|
+
throw new Error(`Malformed WebP: unknown variant '${sanitiseForLog(buffer.toString('latin1', 12, 16))}'`);
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* For Simple File Format WebP (VP8 / VP8L), the inner chunk's declared payload
|
|
327
|
+
* size at offset 16 must — together with the 8-byte chunk header and an
|
|
328
|
+
* optional 1-byte RIFF pad for odd-length payloads — account for everything
|
|
329
|
+
* after the 12-byte RIFF/WEBP preamble. Catches parser-differential attacks
|
|
330
|
+
* where a tampered chunk size is silently accepted by readers that work off
|
|
331
|
+
* fixed offsets.
|
|
332
|
+
*/
|
|
333
|
+
function assertWebpSimpleSubChunkSize(buffer, label) {
|
|
334
|
+
const declared = buffer.readUInt32LE(16);
|
|
335
|
+
const expectedPayload = buffer.length - 20;
|
|
336
|
+
const expectedPayloadWithoutPad = buffer.length - 21;
|
|
337
|
+
if (declared !== expectedPayload && declared !== expectedPayloadWithoutPad) {
|
|
338
|
+
throw new Error(`Malformed WebP: ${label} chunk size does not match buffer length`);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* Replace control characters and non-printable bytes in a user-controlled
|
|
343
|
+
* string before interpolating it into an error message. PNG/JPEG/WebP type
|
|
344
|
+
* fields are 7-bit ASCII per spec, but a malicious buffer can put any
|
|
345
|
+
* 0x00-0x7F byte there — including newline / carriage return / NUL — which
|
|
346
|
+
* could otherwise smuggle log lines through downstream consumers.
|
|
347
|
+
*/
|
|
348
|
+
function sanitiseForLog(value) {
|
|
349
|
+
return value.replace(/[^\x20-\x7e]/g, '?');
|
|
350
|
+
}
|
|
351
|
+
function isGif(buffer) {
|
|
352
|
+
// Minimum legal GIF89a is signature(6) + LSD(7) + trailer(1) = 14 bytes.
|
|
353
|
+
return buffer.length >= 14 && (bufferEqualsAt(buffer, 0, GIF87A_BYTES) || bufferEqualsAt(buffer, 0, GIF89A_BYTES));
|
|
354
|
+
}
|
|
355
|
+
function readGifMetadata(buffer) {
|
|
356
|
+
// Per the GIF89a spec the file must end with a 0x3B trailer byte. Rejecting
|
|
357
|
+
// missing trailers brings GIF in line with the PNG (IEND) and JPEG (EOI)
|
|
358
|
+
// termination checks and catches truncated / trailing-data polyglots.
|
|
359
|
+
if (buffer[buffer.length - 1] !== 0x3b) {
|
|
360
|
+
throw new Error('Malformed GIF: missing trailer byte');
|
|
361
|
+
}
|
|
362
|
+
// Logical screen descriptor: width at bytes 6-7, height at 8-9, little-endian.
|
|
363
|
+
return {
|
|
364
|
+
format: 'gif',
|
|
365
|
+
width: buffer.readUInt16LE(6),
|
|
366
|
+
height: buffer.readUInt16LE(8)
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
const BMP_BITMAPCOREHEADER_SIZE = 12;
|
|
370
|
+
function isBmp(buffer) {
|
|
371
|
+
// 14-byte BITMAPFILEHEADER + at least the 4-byte DIB header size field, plus
|
|
372
|
+
// enough room to read the smallest DIB header's width/height (BITMAPCOREHEADER
|
|
373
|
+
// ends at byte 21; everything else extends to 25).
|
|
374
|
+
return buffer.length >= 22 && buffer[0] === 0x42 && buffer[1] === 0x4d;
|
|
375
|
+
}
|
|
376
|
+
function readBmpMetadata(buffer) {
|
|
377
|
+
// BITMAPFILEHEADER bytes 2-5 store the total file size in bytes, including
|
|
378
|
+
// the headers. A mismatch indicates truncation or trailing data injection.
|
|
379
|
+
const declaredFileSize = buffer.readUInt32LE(2);
|
|
380
|
+
if (declaredFileSize !== buffer.length) {
|
|
381
|
+
throw new Error('Malformed BMP: file size header does not match buffer length');
|
|
382
|
+
}
|
|
383
|
+
const dibHeaderSize = buffer.readUInt32LE(14);
|
|
384
|
+
if (dibHeaderSize === BMP_BITMAPCOREHEADER_SIZE) {
|
|
385
|
+
// BITMAPCOREHEADER (OS/2 v1): 16-bit width and height at offsets 18-19 and
|
|
386
|
+
// 20-21. Negative heights are not defined for this header.
|
|
387
|
+
return {
|
|
388
|
+
format: 'bmp',
|
|
389
|
+
width: buffer.readUInt16LE(18),
|
|
390
|
+
height: buffer.readUInt16LE(20)
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
// BITMAPINFOHEADER and its extended variants (40, 52, 56, 108, 124 bytes).
|
|
394
|
+
// Width is signed int32 LE at 18-21, height is signed int32 LE at 22-25.
|
|
395
|
+
// A negative height encodes a top-down DIB; absolute value is the pixel
|
|
396
|
+
// height. A negative width is illegal per spec — assertPositiveDimensions
|
|
397
|
+
// enforces that on the way out.
|
|
398
|
+
if (buffer.length < 26) {
|
|
399
|
+
throw new Error('Malformed BMP: BITMAPINFOHEADER truncated');
|
|
400
|
+
}
|
|
401
|
+
return {
|
|
402
|
+
format: 'bmp',
|
|
403
|
+
width: buffer.readInt32LE(18),
|
|
404
|
+
height: Math.abs(buffer.readInt32LE(22))
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
//# sourceMappingURL=image-metadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image-metadata.js","sourceRoot":"","sources":["../src/image-metadata.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;AA4FH,8CAmBC;AA7GD,MAAM,aAAa,GAAG,MAAM,CAAC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C,CAAA;IACH,CAAC;IACD,2EAA2E;IAC3E,yEAAyE;IACzE,wEAAwE;IACxE,0EAA0E;IAC1E,gCAAgC;IAChC,IAAI,MAAM,CAAC,MAAM,GAAG,EAAE,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAA;IAC9D,CAAC;IACD,OAAO;QACL,MAAM,EAAE,KAAK;QACb,KAAK,EAAE,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC;QAC7B,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;KACzC,CAAA;AACH,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { ContentValidatorComponents, ValidateFn } from './types';
|
|
1
|
+
import type { ContentValidatorComponents, ValidateFn } from './types';
|
|
2
2
|
export * from './types';
|
|
3
3
|
export * from './validations';
|
|
4
|
+
export { readImageMetadata } from './image-metadata';
|
|
5
|
+
export type { ImageFormat, ImageMetadata } from './image-metadata';
|
|
4
6
|
/**
|
|
5
7
|
* Creates a validator instance with given external calls.
|
|
6
8
|
* @public
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,0BAA0B,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAErE,cAAc,SAAS,CAAA;AACvB,cAAc,eAAe,CAAA;AAC7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AACpD,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAElE;;;GAGG;AACH,eAAO,MAAM,eAAe,GAAI,YAAY,0BAA0B,KAAG,UAaxE,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -14,11 +14,13 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.createValidator = void 0;
|
|
17
|
+
exports.createValidator = exports.readImageMetadata = void 0;
|
|
18
18
|
const types_1 = require("./types");
|
|
19
19
|
const validations_1 = require("./validations");
|
|
20
20
|
__exportStar(require("./types"), exports);
|
|
21
21
|
__exportStar(require("./validations"), exports);
|
|
22
|
+
var image_metadata_1 = require("./image-metadata");
|
|
23
|
+
Object.defineProperty(exports, "readImageMetadata", { enumerable: true, get: function () { return image_metadata_1.readImageMetadata; } });
|
|
22
24
|
/**
|
|
23
25
|
* Creates a validator instance with given external calls.
|
|
24
26
|
* @public
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,mCAA4B;AAC5B,+CAAiD;AAGjD,0CAAuB;AACvB,gDAA6B;AAC7B,mDAAoD;AAA3C,mHAAA,iBAAiB,OAAA;AAG1B;;;GAGG;AACI,MAAM,eAAe,GAAG,CAAC,UAAsC,EAAc,EAAE;IACpF,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,kBAAkB,CAAC,CAAA;IAC1D,MAAM,WAAW,GAAG,CAAC,GAAG,IAAA,+BAAiB,EAAC,UAAU,CAAC,EAAE,UAAU,CAAC,gBAAgB,CAAC,CAAA;IACnF,OAAO,KAAK,UAAU,UAAU,CAAC,UAAU;QACzC,KAAK,MAAM,QAAQ,IAAI,WAAW,EAAE,CAAC;YACnC,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,UAAU,CAAC,CAAA;YACzC,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;gBACf,IAAI,CAAC,KAAK,CAAC,uBAAuB,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;gBAC9D,OAAO,MAAM,CAAA;YACf,CAAC;QACH,CAAC;QACD,OAAO,UAAE,CAAA;IACX,CAAC,CAAA;AACH,CAAC,CAAA;AAbY,QAAA,eAAe,mBAa3B"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { BlockSearch } from '@dcl/block-indexer';
|
|
4
|
-
import { AuthChain, Entity, EthAddress } from '@dcl/schemas';
|
|
5
|
-
import {
|
|
6
|
-
import { ILoggerComponent } from '@well-known-components/interfaces';
|
|
7
|
-
import { ISubgraphComponent } from '@well-known-components/thegraph-component';
|
|
8
|
-
import { PermissionResult } from './validations/access/subgraph/the-graph-client';
|
|
1
|
+
import type { ILoggerComponent } from '@well-known-components/interfaces';
|
|
2
|
+
import type { ISubgraphComponent } from '@well-known-components/thegraph-component';
|
|
3
|
+
import type { BlockSearch } from '@dcl/block-indexer';
|
|
4
|
+
import type { AuthChain, Entity, EthAddress } from '@dcl/schemas';
|
|
5
|
+
import type { PermissionResult } from './validations/access/subgraph/the-graph-client';
|
|
9
6
|
export declare const L1_NETWORKS: string[];
|
|
10
7
|
export declare const L2_NETWORKS: string[];
|
|
11
8
|
/**
|
|
12
9
|
* @public
|
|
13
10
|
*/
|
|
14
|
-
export
|
|
11
|
+
export interface LocalDeploymentAuditInfo {
|
|
15
12
|
authChain: AuthChain;
|
|
16
|
-
}
|
|
13
|
+
}
|
|
17
14
|
/**
|
|
18
15
|
* @public
|
|
19
16
|
*/
|
|
@@ -32,16 +29,16 @@ export type EntityWithEthAddress = Entity & {
|
|
|
32
29
|
* Deployment object to be validated by the validator.
|
|
33
30
|
* @public
|
|
34
31
|
*/
|
|
35
|
-
export
|
|
32
|
+
export interface DeploymentToValidate {
|
|
36
33
|
entity: Entity;
|
|
37
34
|
files: Map<string, Uint8Array>;
|
|
38
35
|
auditInfo: LocalDeploymentAuditInfo;
|
|
39
|
-
}
|
|
36
|
+
}
|
|
40
37
|
/**
|
|
41
38
|
* External calls interface to be provided by the servers.
|
|
42
39
|
* @public
|
|
43
40
|
*/
|
|
44
|
-
export
|
|
41
|
+
export interface ExternalCalls {
|
|
45
42
|
isContentStoredAlready: (hashes: string[]) => Promise<Map<string, boolean>>;
|
|
46
43
|
fetchContentFileSize: (hash: string) => Promise<number | undefined>;
|
|
47
44
|
validateSignature: (entityId: string, auditInfo: LocalDeploymentAuditInfo, timestamp: number) => Promise<{
|
|
@@ -54,14 +51,14 @@ export type ExternalCalls = {
|
|
|
54
51
|
calculatedHash: string;
|
|
55
52
|
buffer: Uint8Array;
|
|
56
53
|
}>>;
|
|
57
|
-
}
|
|
54
|
+
}
|
|
58
55
|
/**
|
|
59
56
|
* @public
|
|
60
57
|
*/
|
|
61
|
-
export
|
|
58
|
+
export interface ValidationResponse {
|
|
62
59
|
ok: boolean;
|
|
63
60
|
errors?: Errors;
|
|
64
|
-
}
|
|
61
|
+
}
|
|
65
62
|
/**
|
|
66
63
|
* @public
|
|
67
64
|
*/
|
|
@@ -81,34 +78,34 @@ export declare const fromErrors: (...errors: Errors) => ValidationResponse;
|
|
|
81
78
|
/**
|
|
82
79
|
* @public
|
|
83
80
|
*/
|
|
84
|
-
export
|
|
85
|
-
checkLAND(ethAddress: string, parcels: [number, number]
|
|
81
|
+
export interface L1Checker {
|
|
82
|
+
checkLAND(ethAddress: string, parcels: Array<[number, number]>, block: number): Promise<boolean[]>;
|
|
86
83
|
checkNames(ethAddress: string, names: string[], block: number): Promise<boolean[]>;
|
|
87
|
-
}
|
|
84
|
+
}
|
|
88
85
|
/**
|
|
89
86
|
* @public
|
|
90
87
|
*/
|
|
91
|
-
export
|
|
88
|
+
export interface L2Checker {
|
|
92
89
|
validateWearables(ethAddress: string, contractAddress: string, assetId: string, hashes: string[], block: number): Promise<boolean>;
|
|
93
90
|
validateThirdParty(tpId: string, root: Buffer, block: number): Promise<boolean>;
|
|
94
|
-
}
|
|
91
|
+
}
|
|
95
92
|
/**
|
|
96
93
|
* @public
|
|
97
94
|
*/
|
|
98
|
-
export
|
|
95
|
+
export interface ItemChecker {
|
|
99
96
|
checkItems(ethAddress: string, items: string[], block: number): Promise<boolean[]>;
|
|
100
|
-
}
|
|
97
|
+
}
|
|
101
98
|
/**
|
|
102
99
|
* @alpha
|
|
103
100
|
*/
|
|
104
|
-
export
|
|
101
|
+
export interface ThirdPartyItemChecker {
|
|
105
102
|
checkThirdPartyItems(ethAddress: string, itemUrns: string[], block: number): Promise<boolean[]>;
|
|
106
|
-
}
|
|
103
|
+
}
|
|
107
104
|
/**
|
|
108
105
|
* A list with all sub-graphs used for validations.
|
|
109
106
|
* @public
|
|
110
107
|
*/
|
|
111
|
-
export
|
|
108
|
+
export interface SubGraphs {
|
|
112
109
|
L1: {
|
|
113
110
|
landManager: ISubgraphComponent;
|
|
114
111
|
blocks: ISubgraphComponent;
|
|
@@ -120,13 +117,13 @@ export type SubGraphs = {
|
|
|
120
117
|
collections: ISubgraphComponent;
|
|
121
118
|
thirdPartyRegistry: ISubgraphComponent;
|
|
122
119
|
};
|
|
123
|
-
}
|
|
124
|
-
export
|
|
120
|
+
}
|
|
121
|
+
export interface NamesOwnership {
|
|
125
122
|
ownsNamesAtTimestamp: (ethAddress: EthAddress, namesToCheck: string[], timestamp: number) => Promise<PermissionResult>;
|
|
126
|
-
}
|
|
127
|
-
export
|
|
123
|
+
}
|
|
124
|
+
export interface ItemsOwnership {
|
|
128
125
|
ownsItemsAtTimestamp: (ethAddress: EthAddress, urnsToCheck: string[], timestamp: number) => Promise<PermissionResult>;
|
|
129
|
-
}
|
|
126
|
+
}
|
|
130
127
|
/**
|
|
131
128
|
* @public
|
|
132
129
|
*/
|
|
@@ -142,19 +139,19 @@ export type OnChainClient = NamesOwnership & ItemsOwnership & {
|
|
|
142
139
|
/**
|
|
143
140
|
* @public
|
|
144
141
|
*/
|
|
145
|
-
export
|
|
142
|
+
export interface BlockInformation {
|
|
146
143
|
blockNumberAtDeployment: number | undefined;
|
|
147
144
|
blockNumberFiveMinBeforeDeployment: number | undefined;
|
|
148
|
-
}
|
|
145
|
+
}
|
|
149
146
|
/**
|
|
150
147
|
* Components that can be used to validate deployments.
|
|
151
148
|
* @public
|
|
152
149
|
*/
|
|
153
|
-
export
|
|
150
|
+
export interface ContentValidatorComponents {
|
|
154
151
|
logs: ILoggerComponent;
|
|
155
152
|
externalCalls: ExternalCalls;
|
|
156
153
|
accessValidateFn: ValidateFn;
|
|
157
|
-
}
|
|
154
|
+
}
|
|
158
155
|
/**
|
|
159
156
|
* @public
|
|
160
157
|
*/
|
|
@@ -167,10 +164,10 @@ export type SubgraphAccessCheckerComponents = Pick<ContentValidatorComponents, '
|
|
|
167
164
|
* Required Smart Contract addresses.
|
|
168
165
|
* @public
|
|
169
166
|
*/
|
|
170
|
-
export
|
|
167
|
+
export interface TokenAddresses {
|
|
171
168
|
estate: EthAddress;
|
|
172
169
|
land: EthAddress;
|
|
173
|
-
}
|
|
170
|
+
}
|
|
174
171
|
/**
|
|
175
172
|
* @public
|
|
176
173
|
*/
|
|
@@ -189,12 +186,4 @@ export type OnChainAccessCheckerComponents = Pick<ContentValidatorComponents, 'l
|
|
|
189
186
|
blockSearch: BlockSearch;
|
|
190
187
|
};
|
|
191
188
|
};
|
|
192
|
-
/**
|
|
193
|
-
* @internal
|
|
194
|
-
*/
|
|
195
|
-
export type V1andV2collectionAssetValidateFn = (asset: BlockchainCollectionV1Asset | BlockchainCollectionV2Asset, deployment: DeploymentToValidate) => Promise<ValidationResponse>;
|
|
196
|
-
/**
|
|
197
|
-
* @internal
|
|
198
|
-
*/
|
|
199
|
-
export type ThirdPartyAssetValidateFn = (asset: BlockchainCollectionThirdParty, deployment: DeploymentToValidate) => Promise<ValidationResponse>;
|
|
200
189
|
//# sourceMappingURL=types.d.ts.map
|