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

Commit

Permalink
feat: wallet import and export (#36)
Browse files Browse the repository at this point in the history
Signed-off-by: Timo Glastra <[email protected]>

Co-authored-by: TimovanDijk <[email protected]>
  • Loading branch information
TimoGlastra and TimovanDijk authored Mar 23, 2022
1 parent 23a4b70 commit 9b76d86
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
23 changes: 23 additions & 0 deletions android/src/main/java/com/reactlibrary/IndySdkModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,29 @@ public void deleteWallet(String configJson, String credentialsJson, Promise prom
}
}

@ReactMethod
public void exportWallet(int walletHandle, String exportConfig, Promise promise) {
try {
Wallet wallet = walletMap.get(walletHandle);
Wallet.exportWallet(wallet, exportConfig).get();
promise.resolve(null);
} catch (Exception e) {
IndySdkRejectResponse rejectResponse = new IndySdkRejectResponse(e);
promise.reject(rejectResponse.getCode(), rejectResponse.toJson(), e);
}
}

@ReactMethod
public void importWallet(String config, String credentials, String importConfig, Promise promise) {
try {
Wallet.importWallet(config, credentials ,importConfig).get();
promise.resolve(null);
} catch (Exception e) {
IndySdkRejectResponse rejectResponse = new IndySdkRejectResponse(e);
promise.reject(rejectResponse.getCode(), rejectResponse.toJson(), e);
}
}

// did

@ReactMethod
Expand Down
8 changes: 8 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,14 @@ const indy = {
return IndySdk.deleteWallet(JSON.stringify(config), JSON.stringify(credentials))
},

exportWallet(wh: WalletHandle, exportConfig: Object): Promise<void> {
return IndySdk.exportWallet(wh, JSON.stringify(exportConfig))
},

importWallet(config: Object, credentials: Object, importConfig: Object): Promise<void> {
return IndySdk.importWallet(JSON.stringify(config), JSON.stringify(credentials), JSON.stringify(importConfig))
},

// did

/**
Expand Down

0 comments on commit 9b76d86

Please sign in to comment.