ttlock / Android_TTLock_Demo_Deprecated

19 stars 16 forks source link

No way to generate one time password? #8

Open Doko-Demo-Doa opened 5 years ago

Doko-Demo-Doa commented 5 years ago

Hello,

I have tried to generate one-time password, but it seems that the SDK had the method being private. I tried modifyKeyboardPassword too, but passwordType is not being used:

  public void modifyKeyboardPassword(ExtendedBluetoothDevice extendedBluetoothDevice, int uid, String lockVersion, String adminPs, String unlockKey, int lockFlagPos, int keyboardPwdType, String originalPwd, String newPwd, long startDate, long endDate, String aesKeyStr, long timezoneOffset) {
    byte[] aesKeyArray = DigitUtil.convertAesKeyStrToBytes(aesKeyStr);
    LogUtil.d("uid=" + uid + " lockVersion=" + lockVersion + " adminPs=" + adminPs + " unlockKey" + unlockKey + " lockFlagPos=" + lockFlagPos + " aesKeyArray=" + DigitUtil.byteArrayToHexString(aesKeyArray), DBG);
    TransferData transferData = new TransferData();
    transferData.setAPICommand(23);
    transferData.setmUid(uid);
    transferData.setLockVersion(lockVersion);
    transferData.setAdminPs(adminPs);
    transferData.setUnlockKey(unlockKey);
    transferData.setLockFlagPos(lockFlagPos);
    transferData.setStartDate(startDate);
    transferData.setEndDate(endDate);
    transferData.setOriginalPwd(originalPwd);
    transferData.setNewPwd(newPwd);
    TransferData.setAesKeyArray(aesKeyArray);
    transferData.setTimezoneOffSet(timezoneOffset);
    CommandUtil.A_checkAdmin(transferData);
  }

How can I solve this case?

Doko-Demo-Doa commented 5 years ago

Anyway, I solved private class problem by subclassing TTLockAPI.java.

However the passcode generated can be used TWICE, is there a way to prevent it?