@dcl/content-validator 7.1.1-24416246435.commit-8f3a8e7 → 7.1.2-24417370826.commit-29a7a52
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"third-party-asset.d.ts","sourceRoot":"","sources":["../../../../src/validations/access/on-chain/third-party-asset.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"third-party-asset.d.ts","sourceRoot":"","sources":["../../../../src/validations/access/on-chain/third-party-asset.ts"],"names":[],"mappings":"AAIA,OAAO,EAGL,8BAA8B,EAC9B,yBAAyB,EAE1B,MAAM,gBAAgB,CAAA;AA6DvB,wBAAgB,+BAA+B,CAC7C,UAAU,EAAE,IAAI,CAAC,8BAA8B,EAAE,eAAe,GAAG,MAAM,GAAG,QAAQ,GAAG,IAAI,CAAC,GAC3F,yBAAyB,CAU3B"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createThirdPartyAssetValidateFn = void 0;
|
|
4
4
|
const content_hash_tree_1 = require("@dcl/content-hash-tree");
|
|
5
|
+
const hashing_1 = require("@dcl/hashing");
|
|
5
6
|
const schemas_1 = require("@dcl/schemas");
|
|
6
7
|
const types_1 = require("../../../types");
|
|
7
8
|
const utils_1 = require("../../../utils");
|
|
@@ -11,6 +12,20 @@ async function verifyMerkleProofedEntity(components, asset, deployment, logger)
|
|
|
11
12
|
if ((0, schemas_1.isThirdParty)(deployment.entity.metadata)) {
|
|
12
13
|
const metadata = deployment.entity.metadata;
|
|
13
14
|
const merkleProof = metadata.merkleProof;
|
|
15
|
+
if (!schemas_1.MerkleProof.validate(merkleProof)) {
|
|
16
|
+
logger.debug('Merkle proof is not valid', {
|
|
17
|
+
merkleProof: merkleProof
|
|
18
|
+
});
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
const generatedHash = (0, hashing_1.keccak256Hash)(metadata, merkleProof.hashingKeys);
|
|
22
|
+
if (merkleProof.entityHash !== generatedHash) {
|
|
23
|
+
logger.debug(`The hash provided in the merkleProof doesn't match the one generated by the validator`, {
|
|
24
|
+
generatedHash,
|
|
25
|
+
entityHash: merkleProof.entityHash
|
|
26
|
+
});
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
14
29
|
const thirdPartyId = (0, utils_1.getThirdPartyId)(asset);
|
|
15
30
|
const bufferedProofs = merkleProof.proof.map((value) => (0, utils_1.toHexBuffer)(value));
|
|
16
31
|
const root = (0, content_hash_tree_1.generateRoot)(merkleProof.index, merkleProof.entityHash, bufferedProofs);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"third-party-asset.js","sourceRoot":"","sources":["../../../../src/validations/access/on-chain/third-party-asset.ts"],"names":[],"mappings":";;;AAAA,8DAAqD;AACrD,
|
|
1
|
+
{"version":3,"file":"third-party-asset.js","sourceRoot":"","sources":["../../../../src/validations/access/on-chain/third-party-asset.ts"],"names":[],"mappings":";;;AAAA,8DAAqD;AACrD,0CAA4C;AAC5C,0CAAyE;AAEzE,0CAMuB;AAEvB,0CAA6D;AAE7D,KAAK,UAAU,yBAAyB,CACtC,UAA4F,EAC5F,KAAqC,EACrC,UAAgC,EAChC,MAAgC;IAEhC,MAAM,EAAE,SAAS,EAAE,GAAG,UAAU,CAAC,MAAM,CAAA;IACvC,IAAI,QAAQ,GAAG,KAAK,CAAA;IAEpB,IAAI,IAAA,sBAAY,EAAC,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE;QAC5C,MAAM,QAAQ,GAAG,UAAU,CAAC,MAAM,CAAC,QAA2B,CAAA;QAC9D,MAAM,WAAW,GAAG,QAAQ,CAAC,WAAW,CAAA;QAExC,IAAI,CAAC,qBAAW,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE;YACtC,MAAM,CAAC,KAAK,CAAC,2BAA2B,EAAE;gBACxC,WAAW,EAAE,WAAW;a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AQ,GAAG,MAAM,kBAAkB,CAAC,kCAAkC,CAAC,CAAA;SACxE;KACF;IAED,OAAO,QAAQ,CAAA;AACjB,CAAC;AAED,SAAgB,+BAA+B,CAC7C,UAA4F;IAE5F,OAAO,KAAK,UAAU,UAAU,CAAC,KAAqC,EAAE,UAAgC;QACtG,MAAM,MAAM,GAAG,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,yCAAyC,CAAC,CAAA;QAEnF,MAAM,QAAQ,GAAG,MAAM,yBAAyB,CAAC,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,CAAC,CAAA;QACvF,IAAI,CAAC,QAAQ,EAAE;YACb,OAAO,IAAA,wBAAgB,EAAC,gEAAgE,CAAC,CAAA;SAC1F;QACD,OAAO,UAAE,CAAA;IACX,CAAC,CAAA;AACH,CAAC;AAZD,0EAYC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcl/content-validator",
|
|
3
|
-
"version": "7.1.
|
|
3
|
+
"version": "7.1.2-24417370826.commit-29a7a52",
|
|
4
4
|
"description": "Catalyst content validations",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"files": [
|
|
54
54
|
"dist"
|
|
55
55
|
],
|
|
56
|
-
"commit": "
|
|
56
|
+
"commit": "29a7a52b2e2b0ee4f39c8805f995a0d3a33f00de"
|
|
57
57
|
}
|