add install and init method
This commit is contained in:
parent
42e4142b18
commit
647b1ff0fc
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -357,4 +357,12 @@ public class SmartCard extends BroadcastReceiver implements CardListener {
|
||||||
Installer installer = new Installer(this.cardChannel, assets, capPath);
|
Installer installer = new Installer(this.cardChannel, assets, capPath);
|
||||||
installer.start();
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue