File tree Expand file tree Collapse file tree 1 file changed +12
-12
lines changed
BitwardenShared/Core/Auth/Repositories Expand file tree Collapse file tree 1 file changed +12
-12
lines changed Original file line number Diff line number Diff line change @@ -1207,8 +1207,16 @@ extension DefaultAuthRepository: AuthRepository {
12071207 case . authRequest,
12081208 . deviceKey,
12091209 . keyConnector,
1210- . pinEnvelope:
1211- break
1210+ . pin:
1211+ // If the user has a legacy pin, migrate to a pin protected user key envelope.
1212+ guard let encryptedPin = try await stateService. getEncryptedPin ( ) else { break }
1213+ let enrollPinResponse = try await clientService. crypto ( ) . enrollPinWithEncryptedPin (
1214+ encryptedPin: encryptedPin
1215+ )
1216+ try await stateService. setPinKeys (
1217+ enrollPinResponse: enrollPinResponse,
1218+ requirePasswordAfterRestart: stateService. pinUnlockRequiresPasswordAfterRestart ( )
1219+ )
12121220 case . decryptedKey,
12131221 . password:
12141222 // If the user has a pin, but requires master password after restart, set the pin
@@ -1218,16 +1226,8 @@ extension DefaultAuthRepository: AuthRepository {
12181226 encryptedPin: encryptedPin
12191227 )
12201228 try await stateService. setPinProtectedUserKeyToMemory ( enrollPinResponse. pinProtectedUserKeyEnvelope)
1221- case . pin:
1222- // If the user has legacy pin, migrate to a pin protected user key envelope.
1223- guard let encryptedPin = try await stateService. getEncryptedPin ( ) else { break }
1224- let enrollPinResponse = try await clientService. crypto ( ) . enrollPinWithEncryptedPin (
1225- encryptedPin: encryptedPin
1226- )
1227- try await stateService. setPinKeys (
1228- enrollPinResponse: enrollPinResponse,
1229- requirePasswordAfterRestart: stateService. pinUnlockRequiresPasswordAfterRestart ( )
1230- )
1229+ case . pinEnvelope:
1230+ break
12311231 }
12321232 }
12331233}
You can’t perform that action at this time.
0 commit comments