From 4c471c71f10327d4f5669059270fba16df6fce2c Mon Sep 17 00:00:00 2001 From: jakubkoci Date: Thu, 13 Feb 2020 22:34:34 +0100 Subject: [PATCH] Rename IndyBridge to IndySdk --- .../java/com/reactlibrary/IndySdkModule.java | 88 ++++++------ src/index.js | 132 +++++++++--------- 2 files changed, 110 insertions(+), 110 deletions(-) diff --git a/android/src/main/java/com/reactlibrary/IndySdkModule.java b/android/src/main/java/com/reactlibrary/IndySdkModule.java index 7e87f94..a659525 100644 --- a/android/src/main/java/com/reactlibrary/IndySdkModule.java +++ b/android/src/main/java/com/reactlibrary/IndySdkModule.java @@ -66,7 +66,7 @@ public IndySdkModule(ReactApplicationContext reactContext) { @Override public String getName() { - return "IndyBridge"; + return "IndySdk"; } // wallet @@ -77,7 +77,7 @@ public void createWallet(String configJson, String credentialsJson, Promise prom Wallet.createWallet(configJson, credentialsJson).get(); promise.resolve(null); } catch (Exception e) { - IndyBridgeRejectResponse rejectResponse = new IndyBridgeRejectResponse(e); + IndySdkRejectResponse rejectResponse = new IndySdkRejectResponse(e); promise.reject(rejectResponse.getCode(), rejectResponse.toJson(), e); } } @@ -89,7 +89,7 @@ public void openWallet(String configJson, String credentialsJson, Promise promis walletMap.put(wallet.getWalletHandle(), wallet); promise.resolve(wallet.getWalletHandle()); } catch (Exception e) { - IndyBridgeRejectResponse rejectResponse = new IndyBridgeRejectResponse(e); + IndySdkRejectResponse rejectResponse = new IndySdkRejectResponse(e); promise.reject(rejectResponse.getCode(), rejectResponse.toJson(), e); } } @@ -102,7 +102,7 @@ public void closeWallet(int walletHandle, Promise promise) { walletMap.remove(walletHandle); promise.resolve(null); } catch (Exception e) { - IndyBridgeRejectResponse rejectResponse = new IndyBridgeRejectResponse(e); + IndySdkRejectResponse rejectResponse = new IndySdkRejectResponse(e); promise.reject(rejectResponse.getCode(), rejectResponse.toJson(), e); } } @@ -113,7 +113,7 @@ public void deleteWallet(String configJson, String credentialsJson, Promise prom Wallet.deleteWallet(configJson, credentialsJson).get(); promise.resolve(null); } catch (Exception e) { - IndyBridgeRejectResponse rejectResponse = new IndyBridgeRejectResponse(e); + IndySdkRejectResponse rejectResponse = new IndySdkRejectResponse(e); promise.reject(rejectResponse.getCode(), rejectResponse.toJson(), e); } } @@ -132,7 +132,7 @@ public void createAndStoreMyDid(int walletHandle, String didJson, Promise promis response.pushString(myVerkey); promise.resolve(response); } catch (Exception e) { - IndyBridgeRejectResponse rejectResponse = new IndyBridgeRejectResponse(e); + IndySdkRejectResponse rejectResponse = new IndySdkRejectResponse(e); promise.reject(rejectResponse.getCode(), rejectResponse.toJson(), e); } } @@ -145,7 +145,7 @@ public void keyForDid(int poolHandle, int walletHandle, String did, Promise prom String receivedKey = Did.keyForDid(pool, wallet, did).get(); promise.resolve(receivedKey); } catch (Exception e) { - IndyBridgeRejectResponse rejectResponse = new IndyBridgeRejectResponse(e); + IndySdkRejectResponse rejectResponse = new IndySdkRejectResponse(e); promise.reject(rejectResponse.getCode(), rejectResponse.toJson(), e); } } @@ -157,7 +157,7 @@ public void keyForLocalDid(int walletHandle, String did, Promise promise) { String receivedKey = Did.keyForLocalDid(wallet, did).get(); promise.resolve(receivedKey); } catch (Exception e) { - IndyBridgeRejectResponse rejectResponse = new IndyBridgeRejectResponse(e); + IndySdkRejectResponse rejectResponse = new IndySdkRejectResponse(e); promise.reject(rejectResponse.getCode(), rejectResponse.toJson(), e); } } @@ -170,7 +170,7 @@ public void createPairwise(int walletHandle, String theirDid, String myDid, Stri Pairwise.createPairwise(wallet, theirDid, myDid, metadata).get(); promise.resolve(null); } catch (Exception e) { - IndyBridgeRejectResponse rejectResponse = new IndyBridgeRejectResponse(e); + IndySdkRejectResponse rejectResponse = new IndySdkRejectResponse(e); promise.reject(rejectResponse.getCode(), rejectResponse.toJson(), e); } } @@ -182,7 +182,7 @@ public void getPairwise(int walletHandle, String theirDid, Promise promise) { String receivedKey = Pairwise.getPairwise(wallet, theirDid).get(); promise.resolve(receivedKey); } catch (Exception e) { - IndyBridgeRejectResponse rejectResponse = new IndyBridgeRejectResponse(e); + IndySdkRejectResponse rejectResponse = new IndySdkRejectResponse(e); promise.reject(rejectResponse.getCode(), rejectResponse.toJson(), e); } } @@ -208,7 +208,7 @@ public void cryptoAnonCrypt(String theirKey, ReadableArray message, Promise prom } promise.resolve(result); } catch (Exception e) { - IndyBridgeRejectResponse rejectResponse = new IndyBridgeRejectResponse(e); + IndySdkRejectResponse rejectResponse = new IndySdkRejectResponse(e); promise.reject(rejectResponse.getCode(), rejectResponse.toJson(), e); } } @@ -221,7 +221,7 @@ public void cryptoAnonDecrypt(int walletHandle, String recipientVk, ReadableArra byte[] decryptedData = Crypto.anonDecrypt(wallet, recipientVk, encryptedMessageBytes).get(); promise.resolve(decryptedData); } catch (Exception e) { - IndyBridgeRejectResponse rejectResponse = new IndyBridgeRejectResponse(e); + IndySdkRejectResponse rejectResponse = new IndySdkRejectResponse(e); promise.reject(rejectResponse.getCode(), rejectResponse.toJson(), e); } } @@ -239,7 +239,7 @@ public void cryptoAuthCrypt(int walletHandle, String senderVk, String recipientV } promise.resolve(result); } catch (Exception e) { - IndyBridgeRejectResponse rejectResponse = new IndyBridgeRejectResponse(e); + IndySdkRejectResponse rejectResponse = new IndySdkRejectResponse(e); promise.reject(rejectResponse.getCode(), rejectResponse.toJson(), e); } } @@ -263,7 +263,7 @@ public void cryptoAuthDecrypt(int walletHandle, String recipientVk, ReadableArra response.pushArray(decryptedData); promise.resolve(response); } catch (Exception e) { - IndyBridgeRejectResponse rejectResponse = new IndyBridgeRejectResponse(e); + IndySdkRejectResponse rejectResponse = new IndySdkRejectResponse(e); promise.reject(rejectResponse.getCode(), rejectResponse.toJson(), e); } } @@ -280,7 +280,7 @@ public void cryptoSign(int walletHandle, String signerVk, ReadableArray messageR } promise.resolve(result); } catch (Exception e) { - IndyBridgeRejectResponse rejectResponse = new IndyBridgeRejectResponse(e); + IndySdkRejectResponse rejectResponse = new IndySdkRejectResponse(e); promise.reject(rejectResponse.getCode(), rejectResponse.toJson(), e); } } @@ -294,7 +294,7 @@ public void cryptoVerify(String signerVk, ReadableArray messageRaw, ReadableArra promise.resolve(valid); } catch (Exception e) { - IndyBridgeRejectResponse rejectResponse = new IndyBridgeRejectResponse(e); + IndySdkRejectResponse rejectResponse = new IndySdkRejectResponse(e); promise.reject(rejectResponse.getCode(), rejectResponse.toJson(), e); } } @@ -320,7 +320,7 @@ public void packMessage(int walletHandle, ReadableArray message, ReadableArray r } promise.resolve(result); } catch (Exception e) { - IndyBridgeRejectResponse rejectResponse = new IndyBridgeRejectResponse(e); + IndySdkRejectResponse rejectResponse = new IndySdkRejectResponse(e); promise.reject(rejectResponse.getCode(), rejectResponse.toJson(), e); } } @@ -338,7 +338,7 @@ public void unpackMessage(int walletHandle, ReadableArray jwe, Promise promise) } promise.resolve(result); } catch (Exception e) { - IndyBridgeRejectResponse rejectResponse = new IndyBridgeRejectResponse(e); + IndySdkRejectResponse rejectResponse = new IndySdkRejectResponse(e); promise.reject(rejectResponse.getCode(), rejectResponse.toJson(), e); } } @@ -351,7 +351,7 @@ public void setProtocolVersion(int protocolVersion, Promise promise) { Pool.setProtocolVersion(protocolVersion).get(); promise.resolve(null); } catch (Exception e) { - IndyBridgeRejectResponse rejectResponse = new IndyBridgeRejectResponse(e); + IndySdkRejectResponse rejectResponse = new IndySdkRejectResponse(e); promise.reject(rejectResponse.getCode(), rejectResponse.toJson(), e); } } @@ -362,7 +362,7 @@ public void createPoolLedgerConfig(String configName, String poolConfig, Promise Pool.createPoolLedgerConfig(configName, poolConfig).get(); promise.resolve(null); } catch (Exception e) { - IndyBridgeRejectResponse rejectResponse = new IndyBridgeRejectResponse(e); + IndySdkRejectResponse rejectResponse = new IndySdkRejectResponse(e); promise.reject(rejectResponse.getCode(), rejectResponse.toJson(), e); } } @@ -374,7 +374,7 @@ public void openPoolLedger(String configName, String poolConfig, Promise promise poolMap.put(pool.getPoolHandle(), pool); promise.resolve(pool.getPoolHandle()); } catch (Exception e) { - IndyBridgeRejectResponse rejectResponse = new IndyBridgeRejectResponse(e); + IndySdkRejectResponse rejectResponse = new IndySdkRejectResponse(e); promise.reject(rejectResponse.getCode(), rejectResponse.toJson(), e); } } @@ -387,7 +387,7 @@ public void closePoolLedger(int handle, Promise promise) { poolMap.remove(handle); promise.resolve(null); } catch (Exception e) { - IndyBridgeRejectResponse rejectResponse = new IndyBridgeRejectResponse(e); + IndySdkRejectResponse rejectResponse = new IndySdkRejectResponse(e); promise.reject(rejectResponse.getCode(), rejectResponse.toJson(), e); } } @@ -401,7 +401,7 @@ public void submitRequest(int poolHandle, String requestJson, Promise promise) { String response = Ledger.submitRequest(pool, requestJson).get(); promise.resolve(response); } catch (Exception e) { - IndyBridgeRejectResponse rejectResponse = new IndyBridgeRejectResponse(e); + IndySdkRejectResponse rejectResponse = new IndySdkRejectResponse(e); promise.reject(rejectResponse.getCode(), rejectResponse.toJson(), e); } } @@ -412,7 +412,7 @@ public void buildGetSchemaRequest(String submitterDid, String id, Promise promis String request = Ledger.buildGetSchemaRequest(submitterDid, id).get(); promise.resolve(request); } catch (Exception e) { - IndyBridgeRejectResponse rejectResponse = new IndyBridgeRejectResponse(e); + IndySdkRejectResponse rejectResponse = new IndySdkRejectResponse(e); promise.reject(rejectResponse.getCode(), rejectResponse.toJson(), e); } } @@ -426,7 +426,7 @@ public void parseGetSchemaResponse(String getSchemaResponse, Promise promise) { result.pushString(ledgerResult.getObjectJson()); promise.resolve(result); } catch (Exception e) { - IndyBridgeRejectResponse rejectResponse = new IndyBridgeRejectResponse(e); + IndySdkRejectResponse rejectResponse = new IndySdkRejectResponse(e); promise.reject(rejectResponse.getCode(), rejectResponse.toJson(), e); } } @@ -437,7 +437,7 @@ public void buildGetCredDefRequest(String submitterDid, String id, Promise promi String request = Ledger.buildGetCredDefRequest(submitterDid, id).get(); promise.resolve(request); } catch (Exception e) { - IndyBridgeRejectResponse rejectResponse = new IndyBridgeRejectResponse(e); + IndySdkRejectResponse rejectResponse = new IndySdkRejectResponse(e); promise.reject(rejectResponse.getCode(), rejectResponse.toJson(), e); } } @@ -451,7 +451,7 @@ public void parseGetCredDefResponse(String getCredDefResponse, Promise promise) result.pushString(ledgerResult.getObjectJson()); promise.resolve(result); } catch (Exception e) { - IndyBridgeRejectResponse rejectResponse = new IndyBridgeRejectResponse(e); + IndySdkRejectResponse rejectResponse = new IndySdkRejectResponse(e); promise.reject(rejectResponse.getCode(), rejectResponse.toJson(), e); } } @@ -465,7 +465,7 @@ public void proverCreateMasterSecret(int walletHandle, String masterSecretId, Pr String outputMasterSecretId = Anoncreds.proverCreateMasterSecret(wallet, masterSecretId).get(); promise.resolve(outputMasterSecretId); } catch (Exception e) { - IndyBridgeRejectResponse rejectResponse = new IndyBridgeRejectResponse(e); + IndySdkRejectResponse rejectResponse = new IndySdkRejectResponse(e); promise.reject(rejectResponse.getCode(), rejectResponse.toJson(), e); } } @@ -480,7 +480,7 @@ public void proverCreateCredentialReq(int walletHandle, String proverDid, String response.pushString(credentialRequestResult.getCredentialRequestMetadataJson()); promise.resolve(response); } catch (Exception e) { - IndyBridgeRejectResponse rejectResponse = new IndyBridgeRejectResponse(e); + IndySdkRejectResponse rejectResponse = new IndySdkRejectResponse(e); promise.reject(rejectResponse.getCode(), rejectResponse.toJson(), e); } } @@ -492,7 +492,7 @@ public void proverStoreCredential(int walletHandle, String credId, String credRe String newCredId = Anoncreds.proverStoreCredential(wallet, credId, credReqMetadataJson, credJson, credDefJson, revRegDefJson).get(); promise.resolve(newCredId); } catch (Exception e) { - IndyBridgeRejectResponse rejectResponse = new IndyBridgeRejectResponse(e); + IndySdkRejectResponse rejectResponse = new IndySdkRejectResponse(e); promise.reject(rejectResponse.getCode(), rejectResponse.toJson(), e); } } @@ -504,7 +504,7 @@ public void proverGetCredential(int walletHandle, String credId, Promise promise String credential = Anoncreds.proverGetCredential(wallet, credId).get(); promise.resolve(credential); } catch (Exception e) { - IndyBridgeRejectResponse rejectResponse = new IndyBridgeRejectResponse(e); + IndySdkRejectResponse rejectResponse = new IndySdkRejectResponse(e); promise.reject(rejectResponse.getCode(), rejectResponse.toJson(), e); } } @@ -516,7 +516,7 @@ public void proverGetCredentials(int walletHandle, String filter, Promise promis String credentials = Anoncreds.proverGetCredentials(wallet, filter).get(); promise.resolve(credentials); } catch (Exception e) { - IndyBridgeRejectResponse rejectResponse = new IndyBridgeRejectResponse(e); + IndySdkRejectResponse rejectResponse = new IndySdkRejectResponse(e); promise.reject(rejectResponse.getCode(), rejectResponse.toJson(), e); } } @@ -530,7 +530,7 @@ public void addWalletRecord(int walletHandle, String type, String id, String val WalletRecord.add(wallet, type, id, value, tagsJson).get(); promise.resolve(null); } catch (Exception e) { - IndyBridgeRejectResponse rejectResponse = new IndyBridgeRejectResponse(e); + IndySdkRejectResponse rejectResponse = new IndySdkRejectResponse(e); promise.reject(rejectResponse.getCode(), rejectResponse.toJson(), e); } } @@ -542,7 +542,7 @@ public void updateWalletRecordValue(int walletHandle, String type, String id, St WalletRecord.updateValue(wallet, type, id, value).get(); promise.resolve(null); } catch (Exception e) { - IndyBridgeRejectResponse rejectResponse = new IndyBridgeRejectResponse(e); + IndySdkRejectResponse rejectResponse = new IndySdkRejectResponse(e); promise.reject(rejectResponse.getCode(), rejectResponse.toJson(), e); } } @@ -554,7 +554,7 @@ public void updateWalletRecordTags(int walletHandle, String type, String id, Str WalletRecord.updateTags(wallet, type, id, tagsJson).get(); promise.resolve(null); } catch (Exception e) { - IndyBridgeRejectResponse rejectResponse = new IndyBridgeRejectResponse(e); + IndySdkRejectResponse rejectResponse = new IndySdkRejectResponse(e); promise.reject(rejectResponse.getCode(), rejectResponse.toJson(), e); } } @@ -566,7 +566,7 @@ public void addWalletRecordTags(int walletHandle, String type, String id, String WalletRecord.addTags(wallet, type, id, tagsJson).get(); promise.resolve(null); } catch (Exception e) { - IndyBridgeRejectResponse rejectResponse = new IndyBridgeRejectResponse(e); + IndySdkRejectResponse rejectResponse = new IndySdkRejectResponse(e); promise.reject(rejectResponse.getCode(), rejectResponse.toJson(), e); } } @@ -578,7 +578,7 @@ public void deleteWalletRecordTags(int walletHandle, String type, String id, Str WalletRecord.deleteTags(wallet, type, id, tagNamesJson).get(); promise.resolve(null); } catch (Exception e) { - IndyBridgeRejectResponse rejectResponse = new IndyBridgeRejectResponse(e); + IndySdkRejectResponse rejectResponse = new IndySdkRejectResponse(e); promise.reject(rejectResponse.getCode(), rejectResponse.toJson(), e); } } @@ -590,7 +590,7 @@ public void deleteWalletRecord(int walletHandle, String type, String id, Promise WalletRecord.delete(wallet, type, id).get(); promise.resolve(null); } catch (Exception e) { - IndyBridgeRejectResponse rejectResponse = new IndyBridgeRejectResponse(e); + IndySdkRejectResponse rejectResponse = new IndySdkRejectResponse(e); promise.reject(rejectResponse.getCode(), rejectResponse.toJson(), e); } } @@ -602,7 +602,7 @@ public void getWalletRecord(int walletHandle, String type, String id, String opt String record = WalletRecord.get(wallet, type, id, optionsJson).get(); promise.resolve(record); } catch (Exception e) { - IndyBridgeRejectResponse rejectResponse = new IndyBridgeRejectResponse(e); + IndySdkRejectResponse rejectResponse = new IndySdkRejectResponse(e); promise.reject(rejectResponse.getCode(), rejectResponse.toJson(), e); } } @@ -615,7 +615,7 @@ public void openWalletSearch(int walletHandle, String type, String queryJson, St searchMap.put(search.getSearchHandle(), search); promise.resolve(search.getSearchHandle()); } catch (Exception e) { - IndyBridgeRejectResponse rejectResponse = new IndyBridgeRejectResponse(e); + IndySdkRejectResponse rejectResponse = new IndySdkRejectResponse(e); promise.reject(rejectResponse.getCode(), rejectResponse.toJson(), e); } } @@ -628,7 +628,7 @@ public void fetchWalletSearchNextRecords(int walletHandle, int walletSearchHandl String recordsJson = WalletSearch.searchFetchNextRecords(wallet, search, count).get(); promise.resolve(recordsJson); } catch (Exception e) { - IndyBridgeRejectResponse rejectResponse = new IndyBridgeRejectResponse(e); + IndySdkRejectResponse rejectResponse = new IndySdkRejectResponse(e); promise.reject(rejectResponse.getCode(), rejectResponse.toJson(), e); } } @@ -641,16 +641,16 @@ public void closeWalletSearch(int walletSearchHandle, Promise promise) { searchMap.remove(walletSearchHandle); promise.resolve(null); } catch (Exception e) { - IndyBridgeRejectResponse rejectResponse = new IndyBridgeRejectResponse(e); + IndySdkRejectResponse rejectResponse = new IndySdkRejectResponse(e); promise.reject(rejectResponse.getCode(), rejectResponse.toJson(), e); } } - class IndyBridgeRejectResponse { + class IndySdkRejectResponse { private String code; private String message; - private IndyBridgeRejectResponse(Throwable e) { + private IndySdkRejectResponse(Throwable e) { // Indy bridge exposed API should return consistently only numeric code // When we don't get IndyException and Indy SDK error code we return zero as default String code = "0"; diff --git a/src/index.js b/src/index.js index 6f66ef6..426f849 100644 --- a/src/index.js +++ b/src/index.js @@ -237,28 +237,28 @@ export type WalletRecrods = { records?: WalletRecord[], } -const { IndyBridge } = NativeModules +const { IndySdk } = NativeModules export default { // wallet createWallet(config: Object, credentials: Object): Promise { - return IndyBridge.createWallet(JSON.stringify(config), JSON.stringify(credentials)) + return IndySdk.createWallet(JSON.stringify(config), JSON.stringify(credentials)) }, openWallet(config: Object, credentials: Object): Promise { - return IndyBridge.openWallet(JSON.stringify(config), JSON.stringify(credentials)) + return IndySdk.openWallet(JSON.stringify(config), JSON.stringify(credentials)) }, closeWallet(wh: WalletHandle): Promise { if (Platform.OS === 'ios') { - return IndyBridge.closeWallet(wh.callSomething()) + return IndySdk.closeWallet(wh.callSomething()) } - return IndyBridge.closeWallet(wh) + return IndySdk.closeWallet(wh) }, deleteWallet(config: Object, credentials: Object): Promise { - return IndyBridge.deleteWallet(JSON.stringify(config), JSON.stringify(credentials)) + return IndySdk.deleteWallet(JSON.stringify(config), JSON.stringify(credentials)) }, // did @@ -269,28 +269,28 @@ export default { */ createAndStoreMyDid(wh: WalletHandle, did: Object): Promise<[Did, Verkey]> { if (Platform.OS === 'ios') { - return IndyBridge.createAndStoreMyDid(JSON.stringify(did), wh) + return IndySdk.createAndStoreMyDid(JSON.stringify(did), wh) } - return IndyBridge.createAndStoreMyDid(wh, JSON.stringify(did)) + return IndySdk.createAndStoreMyDid(wh, JSON.stringify(did)) }, keyForDid(poolHandle: PoolHandle, wh: WalletHandle, did: Did): Promise { if (Platform.OS === 'ios') { - return IndyBridge.keyForDid(did, poolHandle, wh) + return IndySdk.keyForDid(did, poolHandle, wh) } - return IndyBridge.keyForDid(poolHandle, wh, did) + return IndySdk.keyForDid(poolHandle, wh, did) }, keyForLocalDid(wh: WalletHandle, did: Did): Promise { if (Platform.OS === 'ios') { - return IndyBridge.keyForLocalDid(did, wh) + return IndySdk.keyForLocalDid(did, wh) } - return IndyBridge.keyForLocalDid(wh, did) + return IndySdk.keyForLocalDid(wh, did) }, storeTheirDid(wh: WalletHandle, identity: {}) { if (Platform.OS === 'ios') { - return IndyBridge.storeTheirDid(JSON.stringify(identity), wh) + return IndySdk.storeTheirDid(JSON.stringify(identity), wh) } throw new Error(`Unsupported operation! Platform: ${Platform.OS}`) }, @@ -299,40 +299,40 @@ export default { createPairwise(wh: WalletHandle, theirDid: Did, myDid: Did, metadata: string = ''): Promise { if (Platform.OS === 'ios') { - return IndyBridge.createPairwise(theirDid, myDid, metadata, wh) + return IndySdk.createPairwise(theirDid, myDid, metadata, wh) } - return IndyBridge.createPairwise(wh, theirDid, myDid, metadata) + return IndySdk.createPairwise(wh, theirDid, myDid, metadata) }, async getPairwise(wh: WalletHandle, theirDid: Did): Promise { if (Platform.OS === 'ios') { - return JSON.parse(await IndyBridge.getPairwise(theirDid, wh)) + return JSON.parse(await IndySdk.getPairwise(theirDid, wh)) } - return JSON.parse(await IndyBridge.getPairwise(wh, theirDid)) + return JSON.parse(await IndySdk.getPairwise(wh, theirDid)) }, // crypto async cryptoAnonCrypt(recipientVk: Verkey, messageRaw: Buffer): Promise { if (Platform.OS === 'ios') { - return IndyBridge.cryptoAnonCrypt(messageRaw, recipientVk) + return IndySdk.cryptoAnonCrypt(messageRaw, recipientVk) } - return Buffer.from(await IndyBridge.cryptoAnonCrypt(recipientVk, Array.from(messageRaw))) + return Buffer.from(await IndySdk.cryptoAnonCrypt(recipientVk, Array.from(messageRaw))) }, async cryptoAnonDecrypt(wh: WalletHandle, recipientVk: Verkey, encryptedMsg: Buffer): Promise { if (Platform.OS === 'ios') { - return IndyBridge.cryptoAnonDecrypt(encryptedMsg, recipientVk, wh) + return IndySdk.cryptoAnonDecrypt(encryptedMsg, recipientVk, wh) } - return Buffer.from(await IndyBridge.cryptoAnonDecrypt(wh, recipientVk, Array.from(encryptedMsg))) + return Buffer.from(await IndySdk.cryptoAnonDecrypt(wh, recipientVk, Array.from(encryptedMsg))) }, async cryptoAuthCrypt(wh: WalletHandle, senderVk: Verkey, recipientVk: Verkey, messageRaw: Buffer): Promise { if (Platform.OS === 'ios') { - return IndyBridge.cryptoAuthCrypt(messageRaw, senderVk, recipientVk, wh) + return IndySdk.cryptoAuthCrypt(messageRaw, senderVk, recipientVk, wh) } - return Buffer.from(await IndyBridge.cryptoAuthCrypt(wh, senderVk, recipientVk, Array.from(messageRaw))) + return Buffer.from(await IndySdk.cryptoAuthCrypt(wh, senderVk, recipientVk, Array.from(messageRaw))) }, async cryptoAuthDecrypt( @@ -341,9 +341,9 @@ export default { encryptedMsgRaw: Buffer ): Promise<[Verkey, Buffer]> { if (Platform.OS === 'ios') { - return IndyBridge.cryptoAuthDecrypt(encryptedMsgRaw, recipientVk, wh) + return IndySdk.cryptoAuthDecrypt(encryptedMsgRaw, recipientVk, wh) } - const [verkey, msg] = await IndyBridge.cryptoAuthDecrypt(recipientVk, Array.from(encryptedMsgRaw)) + const [verkey, msg] = await IndySdk.cryptoAuthDecrypt(recipientVk, Array.from(encryptedMsgRaw)) return [verkey, Buffer.from(msg)] }, @@ -351,93 +351,93 @@ export default { if (Platform.OS == 'ios') { throw new Error(`Unsupported operation! Platform: ${Platform.OS}`) } - return Buffer.from(await IndyBridge.cryptoSign(wh, signerVk, Array.from(message))) + return Buffer.from(await IndySdk.cryptoSign(wh, signerVk, Array.from(message))) }, cryptoVerify(signerVk: string, message: Buffer, signature: Buffer) { if (Platform.OS == 'ios') { throw new Error(`Unsupported operation! Platform: ${Platform.OS}`) } - return IndyBridge.cryptoVerify(signerVk, Array.from(message), Array.from(signature)) + return IndySdk.cryptoVerify(signerVk, Array.from(message), Array.from(signature)) }, async packMessage(wh: WalletHandle, message: Buffer, receiverKeys: Verkey[], senderVk: string): Promise { if (Platform.OS == 'ios') { throw new Error(`Unsupported operation! Platform: ${Platform.OS}`) } - return Buffer.from(await IndyBridge.packMessage(wh, Array.from(message), receiverKeys, senderVk)) + return Buffer.from(await IndySdk.packMessage(wh, Array.from(message), receiverKeys, senderVk)) }, async unpackMessage(wh: WalletHandle, jwe: Buffer): Promise { if (Platform.OS == 'ios') { throw new Error(`Unsupported operation! Platform: ${Platform.OS}`) } - return Buffer.from(await IndyBridge.unpackMessage(wh, Array.from(jwe))) + return Buffer.from(await IndySdk.unpackMessage(wh, Array.from(jwe))) }, // pool createPoolLedgerConfig(poolName: string, poolConfig: string): Promise { - return IndyBridge.createPoolLedgerConfig(poolName, poolConfig) + return IndySdk.createPoolLedgerConfig(poolName, poolConfig) }, openPoolLedger(poolName: string, poolConfig: string): Promise { if (Platform.OS === 'ios') { - return IndyBridge.openLedger(poolName, poolConfig) + return IndySdk.openLedger(poolName, poolConfig) } - return IndyBridge.openPoolLedger(poolName, poolConfig) + return IndySdk.openPoolLedger(poolName, poolConfig) }, setProtocolVersion(protocolVersion: number): Promise { - return IndyBridge.setProtocolVersion(protocolVersion) + return IndySdk.setProtocolVersion(protocolVersion) }, closePoolLedger(ph: PoolHandle): Promise { - return IndyBridge.closePoolLedger(ph) + return IndySdk.closePoolLedger(ph) }, async submitRequest(poolHandle: PoolHandle, request: LedgerRequest): Promise { if (Platform.OS === 'ios') { - return JSON.parse(await IndyBridge.submitRequest(request, poolHandle)) + return JSON.parse(await IndySdk.submitRequest(request, poolHandle)) } - return JSON.parse(await IndyBridge.submitRequest(ph, JSON.stringify(request))) + return JSON.parse(await IndySdk.submitRequest(ph, JSON.stringify(request))) }, async buildGetSchemaRequest(submitterDid: Did, id: string): Promise { if (Platform.OS === 'ios') { - return IndyBridge.buildGetSchemaRequest(submitterDid, id) + return IndySdk.buildGetSchemaRequest(submitterDid, id) } - return JSON.parse(await IndyBridge.buildGetSchemaRequest(submitterDid, id)) + return JSON.parse(await IndySdk.buildGetSchemaRequest(submitterDid, id)) }, async parseGetSchemaResponse(getSchemaResponse: LedgerRequestResult): Promise<[SchemaId, Schema]> { if (Platform.OS === 'ios') { - return IndyBridge.parseGetSchemaResponse(JSON.stringify(getSchemaResponse)) + return IndySdk.parseGetSchemaResponse(JSON.stringify(getSchemaResponse)) } - const [id, schema ] = await IndyBridge.parseGetSchemaResponse(JSON.stringify(getSchemaResponse)) + const [id, schema ] = await IndySdk.parseGetSchemaResponse(JSON.stringify(getSchemaResponse)) return [id, JSON.parse(schema)] }, async buildGetCredDefRequest(submitterDid: Did, id: string): Promise { if (Platform.OS === 'ios') { - return IndyBridge.buildGetCredDefRequest(submitterDid, id) + return IndySdk.buildGetCredDefRequest(submitterDid, id) } - return JSON.parse(await IndyBridge.buildGetCredDefRequest(submitterDid, id)) + return JSON.parse(await IndySdk.buildGetCredDefRequest(submitterDid, id)) }, async parseGetCredDefResponse(getCredDefResponse: LedgerRequestResult): Promise<[CredDefId, CredDef]> { if (Platform.OS === 'ios') { - return IndyBridge.parseGetCredDefResponse(JSON.stringify(getCredDefResponse)) + return IndySdk.parseGetCredDefResponse(JSON.stringify(getCredDefResponse)) } - const [credDefId, credDef ] = await IndyBridge.parseGetCredDefResponse(JSON.stringify(getCredDefResponse)) + const [credDefId, credDef ] = await IndySdk.parseGetCredDefResponse(JSON.stringify(getCredDefResponse)) return [credDefId, JSON.parse(credDef)] }, proverCreateMasterSecret(wh: WalletHandle, masterSecretId: ?MasterSecretId): Promise { if (Platform.OS === 'ios') { - return IndyBridge.proverCreateMasterSecret(masterSecretId, wh) + return IndySdk.proverCreateMasterSecret(masterSecretId, wh) } - return IndyBridge.proverCreateMasterSecret(wh, masterSecretId) + return IndySdk.proverCreateMasterSecret(wh, masterSecretId) }, async proverCreateCredentialReq( @@ -448,7 +448,7 @@ export default { masterSecretId: MasterSecretId ): Promise<[CredReq, CredReqMetadata]> { if (Platform.OS === 'ios') { - return IndyBridge.proverCreateCredentialReq( + return IndySdk.proverCreateCredentialReq( JSON.stringify(credOffer), JSON.stringify(credDef), proverDid, @@ -456,7 +456,7 @@ export default { wh ) } - const [credReq, credReqMetadata ] = await IndyBridge.proverCreateCredentialReq( + const [credReq, credReqMetadata ] = await IndySdk.proverCreateCredentialReq( wh, proverDid, JSON.stringify(credOffer), @@ -475,7 +475,7 @@ export default { revRegDef: ?RevRegDef ): Promise { if (Platform.OS === 'ios') { - return IndyBridge.proverStoreCredential( + return IndySdk.proverStoreCredential( JSON.stringify(cred), credId, JSON.stringify(credReqMetadata), @@ -484,7 +484,7 @@ export default { wh ) } - return IndyBridge.proverStoreCredential( + return IndySdk.proverStoreCredential( wh, credId, JSON.stringify(credReqMetadata), @@ -496,23 +496,23 @@ export default { async proverGetCredentials(wh: WalletHandle, filter: {} = {}): Promise { if (Platform.OS === 'ios') { - return JSON.parse(await IndyBridge.proverGetCredentials(JSON.stringify(filter), wh)) + return JSON.parse(await IndySdk.proverGetCredentials(JSON.stringify(filter), wh)) } - return JSON.parse(await IndyBridge.proverGetCredentials(wh, JSON.stringify(filter))) + return JSON.parse(await IndySdk.proverGetCredentials(wh, JSON.stringify(filter))) }, async proverGetCredential(wh: WalletHandle, credId: CredId): Promise { if (Platform.OS === 'ios') { - return JSON.parse(await IndyBridge.proverGetCredential(credId, wh)) + return JSON.parse(await IndySdk.proverGetCredential(credId, wh)) } - return JSON.parse(await IndyBridge.proverGetCredential(credId)) + return JSON.parse(await IndySdk.proverGetCredential(credId)) }, // TODO Add return flow type. // It needs little investigation, because is doesn't seem to be same format as Credential stored in wallet. async proverGetCredentialsForProofReq(wh: WalletHandle, proofRequest: ProofRequest) { if (Platform.OS == 'ios') { - return JSON.parse(await IndyBridge.proverGetCredentialsForProofReq(JSON.stringify(proofRequest), wh)) + return JSON.parse(await IndySdk.proverGetCredentialsForProofReq(JSON.stringify(proofRequest), wh)) } throw new Error(`Not implemented for platfrom: ${Platform.OS}`) }, @@ -528,7 +528,7 @@ export default { ): Promise { if (Platform.OS == 'ios') { return JSON.parse( - await IndyBridge.proverCreateProofForRequest( + await IndySdk.proverCreateProofForRequest( JSON.stringify(proofReq), JSON.stringify(requestedCredentials), masterSecretName, @@ -548,70 +548,70 @@ export default { if (Platform.OS == 'ios') { throw new Error(`Unsupported platform! ${Platform.OS}`) } - return IndyBridge.addWalletRecord(wh, type, id, value, JSON.stringify(tags)); + return IndySdk.addWalletRecord(wh, type, id, value, JSON.stringify(tags)); }, async updateWalletRecordValue(wh: WalletHandle, type: string, id: string, value: string): Promise { if (Platform.OS == 'ios') { throw new Error(`Unsupported platform! ${Platform.OS}`) } - return IndyBridge.updateWalletRecordValue(wh, type, id, value); + return IndySdk.updateWalletRecordValue(wh, type, id, value); }, async updateWalletRecordTags(wh: WalletHandle, type: string, id: string, tags: {}): Promise { if (Platform.OS == 'ios') { throw new Error(`Unsupported platform! ${Platform.OS}`) } - return IndyBridge.updateWalletRecordTags(wh, type, id, JSON.stringify(tags)) + return IndySdk.updateWalletRecordTags(wh, type, id, JSON.stringify(tags)) }, async addWalletRecordTags(wh: WalletHandle, type: string, id: string, tags: {}): Promise { if (Platform.OS == 'ios') { throw new Error(`Unsupported platform! ${Platform.OS}`) } - return IndyBridge.addWalletRecordTags(wh, type, id, JSON.stringify(tags)) + return IndySdk.addWalletRecordTags(wh, type, id, JSON.stringify(tags)) }, async deleteWalletRecordTags(wh: WalletHandle, type: string, id: string, tagNames: []): Promise { if (Platform.OS == 'ios') { throw new Error(`Unsupported platform! ${Platform.OS}`) } - return IndyBridge.deleteWalletRecordTags(wh, type, id, JSON.stringify(tagNames)) + return IndySdk.deleteWalletRecordTags(wh, type, id, JSON.stringify(tagNames)) }, async deleteWalletRecord(wh: WalletHandle, type: string, id: string): Promise { if (Platform.OS == 'ios') { throw new Error(`Unsupported platform! ${Platform.OS}`) } - return IndyBridge.deleteWalletRecord(wh, type, id) + return IndySdk.deleteWalletRecord(wh, type, id) }, async getWalletRecord(wh: WalletHandle, type: string, id: string): Promise { if (Platform.OS == 'ios') { throw new Error(`Unsupported platform! ${Platform.OS}`) } - return JSON.parse(await IndyBridge.getWalletRecord(wh, type, id)) + return JSON.parse(await IndySdk.getWalletRecord(wh, type, id)) }, async openWalletSearch(wh: WalletHandle, type: string, query: {}, options: {}): Promise { if (Platform.OS == 'ios') { throw new Error(`Unsupported platform! ${Platform.OS}`) } - return IndyBridge.openWalletSearch(wh, type, JSON.stringify(query), JSON.stringify(options)) + return IndySdk.openWalletSearch(wh, type, JSON.stringify(query), JSON.stringify(options)) }, async fetchWalletSearchNextRecords(wh: WalletHandle, sh: WalletSearchHandle, count: number): Promise { if (Platform.OS == 'ios') { throw new Error(`Unsupported platform! ${Platform.OS}`) } - return JSON.parse(await IndyBridge.fetchWalletSearchNextRecords(wh, sh, count)) + return JSON.parse(await IndySdk.fetchWalletSearchNextRecords(wh, sh, count)) }, async closeWalletSearch(sh: WalletSearchHandle): Promise { if (Platform.OS == 'ios') { throw new Error(`Unsupported platform! ${Platform.OS}`) } - return IndyBridge.closeWalletSearch(sh) + return IndySdk.closeWalletSearch(sh) }, }