mirror of
https://github.com/bitwarden/mobile
synced 2025-12-29 14:43:50 +00:00
Merge branch 'auth/pm-2713/drop-master-key-dependency' into add-bio-key-migration
This commit is contained in:
@@ -157,10 +157,26 @@ namespace Bit.Core.Services
|
||||
if (encUserKey == null)
|
||||
{
|
||||
var userKeyMasterKey = await _stateService.GetMasterKeyEncryptedUserKeyAsync(userId);
|
||||
if (userKeyMasterKey == null)
|
||||
|
||||
if (userKeyMasterKey is null)
|
||||
{
|
||||
throw new Exception("No encrypted user key found");
|
||||
// Migrate old key
|
||||
var oldEncUserKey = await _stateService.GetEncKeyEncryptedAsync(userId);
|
||||
|
||||
if (oldEncUserKey is null)
|
||||
{
|
||||
throw new Exception("No encrypted user key nor old encKeyEncrypted found");
|
||||
}
|
||||
|
||||
var userKey = await DecryptUserKeyWithMasterKeyAsync(
|
||||
masterKey,
|
||||
new EncString(oldEncUserKey),
|
||||
userId
|
||||
);
|
||||
await SetMasterKeyEncryptedUserKeyAsync(oldEncUserKey, userId);
|
||||
return userKey;
|
||||
}
|
||||
|
||||
encUserKey = new EncString(userKeyMasterKey);
|
||||
}
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace Bit.Core.Utilities
|
||||
var passwordGenerationService = new PasswordGenerationService(cryptoService, stateService, cryptoFunctionService, policyService);
|
||||
var totpService = new TotpService(cryptoFunctionService);
|
||||
var authService = new AuthService(cryptoService, cryptoFunctionService, apiService, stateService,
|
||||
tokenService, appIdService, i18nService, platformUtilsService, messagingService, vaultTimeoutService,
|
||||
tokenService, appIdService, i18nService, platformUtilsService, messagingService,
|
||||
keyConnectorService, passwordGenerationService, policyService);
|
||||
var exportService = new ExportService(folderService, cipherService, cryptoService);
|
||||
var auditService = new AuditService(cryptoFunctionService, apiService);
|
||||
|
||||
@@ -121,7 +121,7 @@ namespace Bit.iOS.Core.Controllers
|
||||
&& await _cryptoService.HasEncryptedUserKeyAsync();
|
||||
_biometricIntegrityValid =
|
||||
await _platformUtilsService.IsBiometricIntegrityValidAsync(BiometricIntegritySourceKey);
|
||||
_usesKeyConnector = await _keyConnectorService.GetUsesKeyConnector();
|
||||
_usesKeyConnector = await _keyConnectorService.GetUsesKeyConnectorAsync();
|
||||
_biometricUnlockOnly = _usesKeyConnector && _biometricEnabled && !_pinEnabled;
|
||||
}
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ namespace Bit.iOS.Core.Controllers
|
||||
&& await _cryptoService.HasEncryptedUserKeyAsync();
|
||||
_biometricIntegrityValid =
|
||||
await _platformUtilsService.IsBiometricIntegrityValidAsync(BiometricIntegritySourceKey);
|
||||
_usesKeyConnector = await _keyConnectorService.GetUsesKeyConnector();
|
||||
_usesKeyConnector = await _keyConnectorService.GetUsesKeyConnectorAsync();
|
||||
_biometricUnlockOnly = _usesKeyConnector && _biometricEnabled && !_pinEnabled;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user