use of com.fitpay.android.api.models.security.ECCKeyPair in project fitpay-android-sdk by fitpay.
the class KeysManager method updateECCKey.
public void updateECCKey(@KeyType final int type, @NonNull final Runnable successRunnable, final ApiCallback callback) {
try {
ECCKeyPair keyPair = createPairForType(type);
ApiCallback<ECCKeyPair> apiCallback = new ApiCallback<ECCKeyPair>() {
@Override
public void onSuccess(ECCKeyPair result) {
result.setPrivateKey(mKeysMap.get(type).getPrivateKey());
mKeysMap.put(type, result);
if (successRunnable != null) {
successRunnable.run();
}
}
@Override
public void onFailure(@ResultCode.Code int errorCode, String errorMessage) {
if (callback != null) {
callback.onFailure(errorCode, errorMessage);
}
}
};
Call<ECCKeyPair> getKeyCall = ApiManager.getInstance().getClient().createEncryptionKey(keyPair);
getKeyCall.enqueue(new CallbackWrapper<>(apiCallback));
} catch (Exception e) {
FPLog.e(TAG, e);
callback.onFailure(ResultCode.REQUEST_FAILED, e.toString());
}
}
Aggregations