1
0
mirror of https://github.com/bitwarden/mobile synced 2026-01-10 04:23:21 +00:00

[PM-2297] fix TrustedDeviceOption and DeviceResponse model. Change StateService device key get set to have default user id

This commit is contained in:
André Bispo
2023-07-18 18:01:42 +01:00
parent 5e1229f943
commit 0e450904c5
3 changed files with 11 additions and 7 deletions

View File

@@ -11,10 +11,10 @@ namespace Bit.Core.Models.Domain
public class TrustedDeviceOption
{
public bool HasAdminApproval { get; set; }
public bool HasLoginApprovingDevice { get; }
public bool HasManageResetPasswordPermission { get; }
public string EncryptedPrivateKey { get; }
public string EncryptedUserKey { get; }
public bool HasLoginApprovingDevice { get; set; }
public bool HasManageResetPasswordPermission { get; set; }
public string EncryptedPrivateKey { get; set; }
public string EncryptedUserKey { get; set; }
}
public class KeyConnectorOption

View File

@@ -3,7 +3,7 @@
public class DeviceResponse
{
public string Id { get; set; }
public int Name { get; set; }
public string Name { get; set; }
public string Identifier { get; set; }
public DeviceType Type { get; set; }
public string CreationDate { get; set; }

View File

@@ -484,13 +484,17 @@ namespace Bit.Core.Services
public async Task<SymmetricCryptoKey> GetDeviceKeyAsync(string userId = null)
{
var deviceKeyB64 = await _storageMediatorService.GetAsync<string>(Constants.DeviceKeyKey(userId), true);
var reconciledOptions = ReconcileOptions(new StorageOptions { UserId = userId },
await GetDefaultStorageOptionsAsync());
var deviceKeyB64 = await _storageMediatorService.GetAsync<string>(Constants.DeviceKeyKey(reconciledOptions.UserId), true);
return new SymmetricCryptoKey(Convert.FromBase64String(deviceKeyB64));
}
public async Task SetDeviceKeyAsync(SymmetricCryptoKey value, string userId = null)
{
await _storageMediatorService.SaveAsync(Constants.DeviceKeyKey(userId), value.KeyB64, true);
var reconciledOptions = ReconcileOptions(new StorageOptions { UserId = userId },
await GetDefaultStorageOptionsAsync());
await _storageMediatorService.SaveAsync(Constants.DeviceKeyKey(reconciledOptions.UserId), value.KeyB64, true);
}
public async Task<List<string>> GetAutofillBlacklistedUrisAsync(string userId = null)