@@ -102,29 +102,44 @@ export async function biometricsMigration(currentPassword, safeBiometryEnabled)
102
102
const safeBiometry = STORE . getItem ( IS_BIOMETRY_ENABLED_KEY ) ;
103
103
104
104
if ( safeBiometryEnabled ) {
105
+ console . log ( 'Safe biometry enabled.' ) ;
105
106
// Safe biometry mode, need to migrate if old biometry is enabled.
106
107
if ( oldBiometry ) {
108
+ console . log ( 'old biometry' ) ;
107
109
// currentPassword is the pin, we need to generate a new random password
108
110
// and encrypt the pin.
109
111
const password = generateRandomPassword ( ) ;
110
112
const storage = STORE . getStorage ( ) ;
111
113
await changePinOnAccessData ( storage , currentPassword , password ) ;
114
+ console . log ( 'Changed pin on access data.' ) ;
112
115
STORE . enableSafeBiometry ( currentPassword , password ) ;
113
116
STORE . removeItem ( IS_OLD_BIOMETRY_ENABLED_KEY ) ;
117
+
118
+ return password ;
114
119
}
115
120
} else {
121
+ console . log ( 'Safe biometry disabled' ) ;
116
122
// Old biometry mode, need to migrate if safe biometry is enabled.
117
123
// eslint-disable-next-line no-lonely-if
118
124
if ( safeBiometry ) {
125
+ console . log ( 'Will migrate to safe biometry' ) ;
119
126
// currentPassword is the random password, we need to decrypt the pin and
120
127
// toggle the old biometry key
121
128
const pin = STORE . disableSafeBiometry ( currentPassword ) ;
129
+ console . log ( 'got pin' , pin ) ;
122
130
const storage = STORE . getStorage ( ) ;
131
+ console . log ( 'got storage' ) ;
123
132
await changePinOnAccessData ( storage , currentPassword , pin ) ;
133
+ console . log ( 'Changed pin on access data.' ) ;
124
134
STORE . removeItem ( IS_BIOMETRY_ENABLED_KEY ) ;
125
135
STORE . setItem ( IS_OLD_BIOMETRY_ENABLED_KEY , true ) ;
136
+
137
+ return pin ;
126
138
}
127
139
}
140
+
141
+ console . log ( 'Done.' ) ;
142
+ return currentPassword ;
128
143
}
129
144
130
145
/**
0 commit comments