Skip to content

Commit

Permalink
Non-merklize credential support
Browse files Browse the repository at this point in the history
  • Loading branch information
Kolezhniuk committed Aug 31, 2023
1 parent ae82fb1 commit ff31c01
Show file tree
Hide file tree
Showing 14 changed files with 979 additions and 243 deletions.
150 changes: 39 additions & 111 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
Expand Up @@ -70,7 +70,7 @@
"dependencies": {
"@iden3/js-crypto": "1.0.0",
"@iden3/js-iden3-core": "1.0.1",
"@iden3/js-jsonld-merklization": "1.0.1",
"@iden3/js-jsonld-merklization": "file:../js-jsonld-merklization",
"@iden3/js-jwz": "1.0.1",
"@iden3/js-merkletree": "1.0.0",
"@lumeweb/js-sha3-browser": "^0.8.1",
Expand All @@ -85,7 +85,7 @@
"ethers": "^5.7.2",
"ffjavascript": "^0.2.57",
"idb-keyval": "^6.2.0",
"jsonld": "^8.1.1",
"jsonld": "^8.2.0",
"multiformats": "^9.6.5",
"rfc4648": "^1.5.2",
"snarkjs": "^0.5.0",
Expand Down
10 changes: 3 additions & 7 deletions src/identity/identity-wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -656,13 +656,9 @@ export class IdentityWallet implements IIdentityWallet {
req.type,
opts
);
console.log('credentialType', credentialType);

const coreClaim = await new Parser().parseClaim(
credential,
credentialType,
schemaBytes,
coreClaimOpts
);
const coreClaim = await Parser.parseClaim(credential, coreClaimOpts);

const { hi, hv } = coreClaim.hiHv();

Expand Down Expand Up @@ -732,7 +728,7 @@ export class IdentityWallet implements IIdentityWallet {
const credential = credentials[index];

// credential must have a bjj signature proof
const coreClaim = await credential.getCoreClaimFromProof(ProofType.BJJSignature);
const coreClaim = credential.getCoreClaimFromProof(ProofType.BJJSignature);

if (!coreClaim) {
throw new Error('credential must have coreClaim representation in the signature proof');
Expand Down
8 changes: 7 additions & 1 deletion src/proof/proof-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -760,8 +760,14 @@ export class ProofService implements IProofService {
}

const parsedQuery = await this.parseRequest(query.credentialSubject);
parsedQuery.query.slotIndex = new Parser().getFieldSlotIndex(

if (!query.type) {
throw new Error('query type is not defined');
}

parsedQuery.query.slotIndex = await Parser.getFieldSlotIndex(
parsedQuery.fieldName,
query.type,
byteEncoder.encode(JSON.stringify(schema))
);
const { vp, mzValue, dataType } = await verifiablePresentationFromCred(
Expand Down
Loading

0 comments on commit ff31c01

Please sign in to comment.