1
0
mirror of https://github.com/bitwarden/mobile synced 2026-02-28 18:33:46 +00:00

[PM-2297] Fix trust device bug/typo

This commit is contained in:
André Bispo
2023-07-24 09:28:10 +01:00
parent 2465a28667
commit f12cc69b60
2 changed files with 4 additions and 4 deletions

View File

@@ -10,7 +10,7 @@ namespace Bit.Core.Abstractions
Task<DeviceResponse> TrustDeviceIfNeededAsync();
Task<bool> GetShouldTrustDeviceAsync();
Task SetShouldTrustDeviceAsync(bool value);
Task<SymmetricCryptoKey> DecryptUserKeyWithDeviceKeyAsync(string encryptedDevicePrivateKey, string encryptedUserKey);
Task<UserKey> DecryptUserKeyWithDeviceKeyAsync(string encryptedDevicePrivateKey, string encryptedUserKey);
Task<bool> IsDeviceTrustedAsync();
}
}

View File

@@ -59,7 +59,7 @@ namespace Bit.Core.Services
var deviceIdentifier = await _appIdService.GetAppIdAsync();
var deviceRequest = new TrustedDeviceKeysRequest
{
EncryptedUserKey = (await _cryptoService.RsaEncryptAsync(userKey.EncKey, devicePublicKey)).EncryptedString,
EncryptedUserKey = (await _cryptoService.RsaEncryptAsync(userKey.Key, devicePublicKey)).EncryptedString,
EncryptedPublicKey = (await _cryptoService.EncryptAsync(devicePublicKey, userKey)).EncryptedString,
EncryptedPrivateKey = (await _cryptoService.EncryptAsync(devicePrivateKey, deviceKey)).EncryptedString,
};
@@ -106,7 +106,7 @@ namespace Bit.Core.Services
return existingDeviceKey != null;
}
public async Task<SymmetricCryptoKey> DecryptUserKeyWithDeviceKeyAsync(string encryptedDevicePrivateKey, string encryptedUserKey)
public async Task<UserKey> DecryptUserKeyWithDeviceKeyAsync(string encryptedDevicePrivateKey, string encryptedUserKey)
{
// Get device key
var existingDeviceKey = await GetDeviceKeyAsync();
@@ -125,7 +125,7 @@ namespace Bit.Core.Services
// Attempt to decrypt encryptedUserDataKey with devicePrivateKey
var userKey = await _cryptoService.RsaDecryptAsync(encryptedUserKey, devicePrivateKey);
return new SymmetricCryptoKey(userKey);
return new UserKey(userKey);
}
}
}