Skip to content

Commit

Permalink
use mtentry instead of mtvalue (#51)
Browse files Browse the repository at this point in the history
use mtentry instead of mtvalue
  • Loading branch information
ilya-korotya authored Mar 2, 2023
1 parent 4cd5b66 commit 79117f3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 15 deletions.
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@iden3/js-iden3-auth",
"version": "1.0.0-beta.3",
"version": "1.0.0-beta.4",
"description": "iden3-auth implementation in JavaScript",
"main": "dist/cjs/index.js",
"module": "dist/cjs/index.js",
Expand Down Expand Up @@ -30,7 +30,7 @@
},
"dependencies": {
"@iden3/js-iden3-core": "1.0.0-beta.0",
"@iden3/js-jsonld-merklization": "^1.0.0-beta.3",
"@iden3/js-jsonld-merklization": "^1.0.0-beta.4",
"@iden3/js-jwz": "1.0.0-beta.1",
"@iden3/js-merkletree": "1.0.0-beta.0",
"axios": "^0.27.2",
Expand Down
9 changes: 5 additions & 4 deletions src/circuits/query.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ISchemaLoader, SchemaLoadResult } from '@lib/loaders/schema';
import nestedProperty from 'nested-property';
import { Id, SchemaHash, DID } from '@iden3/js-iden3-core';
import { Merklizer, Path } from '@iden3/js-jsonld-merklization';
import { Merklizer, Path, Value } from '@iden3/js-jsonld-merklization';
import keccak256 from 'keccak256';

const operators: Map<string, number> = new Map([
Expand Down Expand Up @@ -179,16 +179,17 @@ async function validateDisclosure(
throw new Error(`can't build path to '${cq.fieldName}' key`);
}

let valueByPath: any;
let valueByPath: Value;
try {
valueByPath = mz.rawValue(merkalizedPath);
} catch (e) {
throw new Error(`can't get value by path '${cq.fieldName}'`);
}

const mvValue = mz.mkValue(valueByPath);
const mtValue = mz.mkValue(valueByPath);
const bi = await mtValue.mtEntry();

if (mvValue.toString() !== outputs.value[0].toString(10)) {
if (bi !== outputs.value[0]) {
throw new Error(`value that was used is not equal to requested in query`);
}

Expand Down

0 comments on commit 79117f3

Please sign in to comment.