add install and init method

This commit is contained in:
Dmitry Novotochinov 2018-11-30 13:35:46 +03:00
parent 42e4142b18
commit 647b1ff0fc
No known key found for this signature in database
GPG Key ID: 43D1DAF5AD39C927
2 changed files with 25 additions and 0 deletions

View File

@ -191,4 +191,21 @@ public class RNStatusKeycardModule extends ReactContextBaseJavaModule implements
}
}
@ReactMethod
public void installAppletAndInitCard(Promise promise) {
try {
SmartCardSecrets s = smartCard.installAppletAndInitCard(this.reactContext.getAssets(), "wallet.cap");
WritableMap params = Arguments.createMap();
params.putString("pin", s.getPin());
params.putString("puk", s.getPuk());
params.putString("password", s.getPairingPassword());
promise.resolve(params);
} catch (IOException | APDUException | NoSuchAlgorithmException | InvalidKeySpecException e) {
Log.d(TAG, e.getMessage());
promise.reject(e);
}
}
}

View File

@ -357,4 +357,12 @@ public class SmartCard extends BroadcastReceiver implements CardListener {
Installer installer = new Installer(this.cardChannel, assets, capPath);
installer.start();
}
public SmartCardSecrets installAppletAndInitCard(AssetManager assets, String capPath) throws IOException, APDUException, NoSuchAlgorithmException, InvalidKeySpecException {
Installer installer = new Installer(this.cardChannel, assets, capPath);
installer.start();
return init();
}
}