Skip to content
This repository has been archived by the owner on Aug 3, 2021. It is now read-only.

Feat: add verifier verify proof in Android #48

Merged
merged 5 commits into from
Apr 18, 2021
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions android/src/main/java/com/reactlibrary/IndySdkModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,27 @@ public void proverCreateProof(
}
}

@ReactMethod
public void verifierVerifyProof(
String proofRequest,
String proof,
String schemas,
String credentialDefs,
String revocRegDefs,
String revocRegs,
Promise promise
) {
try{
Boolean verified = Anoncreds.verifierVerifyProof(proofRequest, proof, schemas, credentialDefs, revocRegDefs, revocRegs).get();

promise.resolve(verified);
}
catch (Exception e) {
IndySdkRejectResponse rejectResponse = new IndySdkRejectResponse(e);
promise.reject(rejectResponse.getCode(), rejectResponse.toJson(), e);
}
}

// blob_storage

@ReactMethod
Expand Down
21 changes: 21 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,27 @@ const indy = {
)
},

async verifierVerifyProof(
proofRequest: IndyProofRequest,
proof: Indy.IndyProof,
schemas: Schemas,
credentialDefs: CredentialDefs,
revRegsDefs: Indy.RevRegsDefs,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @JamesKEbert, thanks for this update. I'm just curious, where do you get the Indy.* types from? I don't see any Indy import or definition in this file 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh whoops. Those types came as a result from referencing code from a previous implementation I had done. I thought I got everything sorted but I missed that somehow. Thanks for catching that--I just pushed a commit revising the types.

revRegs: RevStates
): Promise<boolean> {
if (Platform.OS === 'ios') {
throw new Error(`Unsupported operation! Platform: ${Platform.OS}`)
}
return IndySdk.verifierVerifyProof(
JSON.stringify(proofRequest),
JSON.stringify(proof),
JSON.stringify(schemas),
JSON.stringify(credentialDefs),
JSON.stringify(revRegsDefs),
JSON.stringify(revRegs)
)
},

async appendTxnAuthorAgreementAcceptanceToRequest(
request: LedgerRequest,
text: string,
Expand Down