Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

Commit

Permalink
Android: add generateNonce method. (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
afrisalyp authored Nov 27, 2021
1 parent 36e926a commit 16710fa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
11 changes: 11 additions & 0 deletions android/src/main/java/com/reactlibrary/IndySdkModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -906,6 +906,17 @@ public void verifierVerifyProof(
}
}

@ReactMethod
public void generateNonce(Promise promise) {
try {
String nonce = Anoncreds.generateNonce().get();
promise.resolve(nonce);
} catch (Exception e) {
IndySdkRejectResponse rejectResponse = new IndySdkRejectResponse(e);
promise.reject(rejectResponse.getCode(), rejectResponse.toJson(), e);
}
}

@ReactMethod
public void createRevocationState(
int blobStorageReaderHandle,
Expand Down
3 changes: 0 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -707,9 +707,6 @@ const indy = {
},

async generateNonce() {
if (Platform.OS === 'android') {
throw new Error(`Unsupported operation! Platform: ${Platform.OS}`)
}
return IndySdk.generateNonce();
},

Expand Down

0 comments on commit 16710fa

Please sign in to comment.