1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-05 23:53:33 +00:00

PM-4739 Add try catch and log exception

This commit is contained in:
Carlos Gonçalves
2023-12-12 15:48:14 +00:00
parent 0eea17831b
commit 0e40102de5

View File

@@ -19,6 +19,7 @@ namespace Bit.Core.Services
private readonly IStateService _stateService;
private readonly ICryptoFunctionService _cryptoFunctionService;
private readonly ILogger _logger;
private SymmetricCryptoKey _legacyEtmKey;
private string _masterKeyHash;
@@ -29,10 +30,12 @@ namespace Bit.Core.Services
public CryptoService(
IStateService stateService,
ICryptoFunctionService cryptoFunctionService)
ICryptoFunctionService cryptoFunctionService,
ILogger logger)
{
_stateService = stateService;
_cryptoFunctionService = cryptoFunctionService;
_logger = logger;
}
public void ClearCache()
@@ -737,6 +740,8 @@ namespace Bit.Core.Services
}
public async Task<bool> ValidateUriChecksumAsync(EncString remoteUriChecksum, string rawUri, string orgId, SymmetricCryptoKey key)
{
try
{
if (remoteUriChecksum == null)
{
@@ -748,6 +753,12 @@ namespace Bit.Core.Services
var remoteChecksum = await remoteUriChecksum.DecryptAsync(orgId, key);
return remoteChecksum == localChecksum;
}
catch (Exception ex)
{
_logger.Exception(ex);
return false;
}
}
// --HELPER METHODS--