code refactor

This commit is contained in:
MaysWind
2020-11-22 13:47:19 +08:00
parent a02d2e8160
commit 815f6718cc
3 changed files with 12 additions and 7 deletions
+2 -1
View File
@@ -13,7 +13,8 @@ const tokenSessionStorageKey = 'lab_user_session_token';
const appLockSecretSessionStorageKey = 'lab_user_app_lock_secret';
function getAppLockSecret(pinCode) {
return CryptoJS.SHA256(APP_LOCK_SECRET_BASE_STRING_PREFIX + pinCode).toString();
const hashedPinCode = CryptoJS.SHA256(APP_LOCK_SECRET_BASE_STRING_PREFIX + pinCode).toString();
return hashedPinCode.substr(0, 24); // put secret into user id of webauthn (user id total length must less 64 bytes)
}
function getEncryptedToken(token, secret) {