code refactor

This commit is contained in:
MaysWind
2020-11-22 16:01:34 +08:00
parent 5a57eb3c5d
commit 349ea1775a
2 changed files with 6 additions and 6 deletions
+2 -2
View File
@@ -3,7 +3,7 @@ import CryptoJS from 'crypto-js';
import settings from './settings.js';
import utils from './utils.js';
const APP_LOCK_SECRET_BASE_STRING_PREFIX = 'LAB_LOCK_SECRET_';
const appLockSecretBaseStringPrefix = 'LAB_LOCK_SECRET_';
const tokenLocalStorageKey = 'lab_user_token';
const webauthnConfigLocalStorageKey = 'lab_user_webauthn_config';
@@ -13,7 +13,7 @@ const tokenSessionStorageKey = 'lab_user_session_token';
const appLockSecretSessionStorageKey = 'lab_user_app_lock_secret';
function getAppLockSecret(pinCode) {
const hashedPinCode = CryptoJS.SHA256(APP_LOCK_SECRET_BASE_STRING_PREFIX + pinCode).toString();
const hashedPinCode = CryptoJS.SHA256(appLockSecretBaseStringPrefix + pinCode).toString();
return hashedPinCode.substr(0, 24); // put secret into user id of webauthn (user id total length must less 64 bytes)
}