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

Commit

Permalink
feat: add verifier verify proof in iOS (#54)
Browse files Browse the repository at this point in the history
Signed-off-by: James Ebert <jamesebert.k@gmail.com>
  • Loading branch information
JamesKEbert authored May 25, 2021
1 parent 019c169 commit 38e86ef
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
9 changes: 9 additions & 0 deletions ios/IndySdk.m
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,15 @@ @interface RCT_EXTERN_MODULE(IndySdk, NSObject)
resolver:(RCTPromiseResolveBlock)resolve
rejecter:(RCTPromiseRejectBlock)reject)

RCT_EXTERN_METHOD(verifierVerifyProof: (NSString *)proofReqJSON
proofJSON:(NSString *)proofJSON
schemasJSON:(NSString *)schemasJSON
credentialDefsJSON:(NSString *)credentialDefsJSON
revocRegDefsJSON:(NSString *)revocRegDefsJSON
revocRegsJSON:(NSString *)revocRegsJSON
resolver:(RCTPromiseResolveBlock)resolve
rejecter:(RCTPromiseRejectBlock)reject)

// non_secrets
RCT_EXTERN_METHOD(addWalletRecord: (nonnull NSNumber *)wh
type: (NSString *)type
Expand Down
14 changes: 14 additions & 0 deletions ios/IndySdk.swift
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,20 @@ class IndySdk : NSObject {
)
}

@objc func verifierVerifyProof(_ proofReqJSON: String, proofJSON: String, schemasJSON: String, credentialDefsJSON: String, revocRegDefsJSON: String, revocRegsJSON: String,
resolver resolve: @escaping RCTPromiseResolveBlock,
rejecter reject: @escaping RCTPromiseRejectBlock) -> Void {
IndyAnoncreds.verifierVerifyProofRequest(
proofReqJSON,
proofJSON: proofJSON,
schemasJSON: schemasJSON,
credentialDefsJSON: credentialDefsJSON,
revocRegDefsJSON: revocRegDefsJSON,
revocRegsJSON: revocRegsJSON,
completion: completionWithBool(resolve, reject)
)
}

// non_secret

@objc func addWalletRecord(_ wh: NSNumber, type: String, id: String, value: String, tags: String, resolver resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) -> Void {
Expand Down
4 changes: 0 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -652,10 +652,6 @@ const indy = {
revRegDef: ?RevRegDef,
revStates: RevStates
): Promise<boolean> {
if (Platform.OS === 'ios') {
throw new Error(`Unsupported operation! Platform: ${Platform.OS}`)
}

return IndySdk.verifierVerifyProof(
JSON.stringify(proofRequest),
JSON.stringify(proof),
Expand Down

0 comments on commit 38e86ef

Please sign in to comment.