parent
d1098e969a
commit
b9f242aa11
|
@ -341,6 +341,36 @@ public class RNStatusKeycardModule extends ReactContextBaseJavaModule implements
|
|||
}).start();
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void changePairingPassword(final String pin, final String pairingPassword, final Promise promise) {
|
||||
new Thread(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
smartCard.changePairingPassword(pin, pairingPassword);
|
||||
promise.resolve(true);
|
||||
} catch (IOException | APDUException e) {
|
||||
Log.d(TAG, e.getMessage());
|
||||
promise.reject(e);
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void changePUK(final String pin, final String puk, final Promise promise) {
|
||||
new Thread(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
smartCard.changePUK(pin, puk);
|
||||
promise.resolve(true);
|
||||
} catch (IOException | APDUException e) {
|
||||
Log.d(TAG, e.getMessage());
|
||||
promise.reject(e);
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void changePin(final String currentPin, final String newPin, final Promise promise) {
|
||||
new Thread(new Runnable() {
|
||||
|
|
|
@ -405,10 +405,24 @@ public class SmartCard extends BroadcastReceiver implements CardListener {
|
|||
return 3;
|
||||
}
|
||||
|
||||
public void changePairingPassword(final String pin, final String pairingPassword) throws IOException, APDUException {
|
||||
KeycardCommandSet cmdSet = authenticatedCommandSet(pin);
|
||||
|
||||
cmdSet.changePairingPassword(pairingPassword);
|
||||
Log.i(TAG, "pairing password changed");
|
||||
}
|
||||
|
||||
public void changePUK(final String pin, final String puk) throws IOException, APDUException {
|
||||
KeycardCommandSet cmdSet = authenticatedCommandSet(pin);
|
||||
|
||||
cmdSet.changePUK(puk);
|
||||
Log.i(TAG, "puk changed");
|
||||
}
|
||||
|
||||
public void changePin(final String currentPin, final String newPin) throws IOException, APDUException {
|
||||
KeycardCommandSet cmdSet = authenticatedCommandSet(currentPin);
|
||||
|
||||
cmdSet.changePIN(0, newPin);
|
||||
cmdSet.changePIN(newPin);
|
||||
Log.i(TAG, "pin changed");
|
||||
}
|
||||
|
||||
|
|
|
@ -243,6 +243,20 @@ class SmartCard {
|
|||
resolve(3)
|
||||
}
|
||||
|
||||
func changePairingPassword(channel: CardChannel, pin: String, pairingPassword: String, resolve: RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock) throws -> Void {
|
||||
let cmdSet = try authenticatedCommandSet(channel: channel, pin: pin)
|
||||
try cmdSet.changePairingPassword(pairingPassword: pairingPassword).checkOK()
|
||||
os_log("pairing password changed")
|
||||
resolve(true)
|
||||
}
|
||||
|
||||
func changePUK(channel: CardChannel, pin: String, puk: String, resolve: RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock) throws -> Void {
|
||||
let cmdSet = try authenticatedCommandSet(channel: channel, pin: pin)
|
||||
try cmdSet.changePUK(puk: puk).checkOK()
|
||||
os_log("puk changed")
|
||||
resolve(true)
|
||||
}
|
||||
|
||||
func changePin(channel: CardChannel, currentPin: String, newPin: String, resolve: RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock) throws -> Void {
|
||||
let cmdSet = try authenticatedCommandSet(channel: channel, pin: currentPin)
|
||||
try cmdSet.changePIN(pin: newPin).checkOK()
|
||||
|
|
|
@ -23,6 +23,8 @@ RCT_EXTERN_METHOD(signPinless:(NSString *)hash resolve:(RCTPromiseResolveBlock)r
|
|||
RCT_EXTERN_METHOD(installApplet:(RCTPromiseResolveBlock)resolve reject: (RCTPromiseRejectBlock)reject)
|
||||
RCT_EXTERN_METHOD(installAppletAndInitCard:(String *)pin resolve: (RCTPromiseResolveBlock)resolve reject: (RCTPromiseRejectBlock)reject)
|
||||
RCT_EXTERN_METHOD(verifyPin:(NSString *)pin resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
||||
RCT_EXTERN_METHOD(changePairingPassword:(NSString *)pin pairingPassword:(NSString *)pairingPassword resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
||||
RCT_EXTERN_METHOD(changePUK:(NSString *)pin puk:(NSString *)puk resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
||||
RCT_EXTERN_METHOD(changePin:(NSString *)currentPin newPin:(NSString *)newPin resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
||||
RCT_EXTERN_METHOD(unblockPin:(NSString *)puk newPin:(NSString *)newPin resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
||||
RCT_EXTERN_METHOD(unpair:(NSString *)pin resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
||||
|
|
|
@ -118,6 +118,16 @@ class StatusKeycard: RCTEventEmitter {
|
|||
keycardInvokation(reject) { [unowned self] channel in try self.smartCard.verifyPin(channel: channel, pin: pin, resolve: resolve, reject: reject) }
|
||||
}
|
||||
|
||||
@objc
|
||||
func changePairingPassword(_ pin: String, pairingPassword: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) -> Void {
|
||||
keycardInvokation(reject) { [unowned self] channel in try self.smartCard.changePairingPassword(channel: channel, pin: pin, pairingPassword: pairingPassword, resolve: resolve, reject: reject) }
|
||||
}
|
||||
|
||||
@objc
|
||||
func changePUK(_ pin: String, puk: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) -> Void {
|
||||
keycardInvokation(reject) { [unowned self] channel in try self.smartCard.changePUK(channel: channel, pin: pin, puk: puk, resolve: resolve, reject: reject) }
|
||||
}
|
||||
|
||||
@objc
|
||||
func changePin(_ currentPin: String, newPin: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) -> Void {
|
||||
keycardInvokation(reject) { [unowned self] channel in try self.smartCard.changePin(channel: channel, currentPin: currentPin, newPin: newPin, resolve: resolve, reject: reject) }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "react-native-status-keycard",
|
||||
"homepage": "https://keycard.status.im/",
|
||||
"version": "2.5.33",
|
||||
"version": "2.5.34",
|
||||
"description": "React Native library to interact with Status Keycard using NFC connection (Android only)",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
|
Loading…
Reference in New Issue