mirror of
https://github.com/bitwarden/mobile
synced 2025-12-22 11:13:49 +00:00
[PM-2713] rename ephemeral pin key
This commit is contained in:
@@ -119,7 +119,7 @@ namespace Bit.Core.Models.Domain
|
|||||||
{
|
{
|
||||||
public UserKey UserKey;
|
public UserKey UserKey;
|
||||||
public MasterKey MasterKey;
|
public MasterKey MasterKey;
|
||||||
public EncString UserKeyPinEphemeral;
|
public EncString PinKeyEncryptedUserKeyEphemeral;
|
||||||
public bool? BiometricLocked;
|
public bool? BiometricLocked;
|
||||||
[Obsolete("Jul 6 2023: Key has been deprecated. We will use the User Key in the future. It remains here for migration during app upgrade.")]
|
[Obsolete("Jul 6 2023: Key has been deprecated. We will use the User Key in the future. It remains here for migration during app upgrade.")]
|
||||||
public SymmetricCryptoKey Key;
|
public SymmetricCryptoKey Key;
|
||||||
|
|||||||
@@ -673,7 +673,7 @@ namespace Bit.Core.Services
|
|||||||
// Refresh, set, or clear the pin key
|
// Refresh, set, or clear the pin key
|
||||||
if (await _stateService.GetProtectedPinAsync(userId) != null)
|
if (await _stateService.GetProtectedPinAsync(userId) != null)
|
||||||
{
|
{
|
||||||
await UpdateUserKeyPinAsync(userKey, userId);
|
await UpdatePinKeyAsync(userKey, userId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -692,7 +692,7 @@ namespace Bit.Core.Services
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task UpdateUserKeyPinAsync(UserKey userKey, string userId = null)
|
private async Task UpdatePinKeyAsync(UserKey userKey, string userId = null)
|
||||||
{
|
{
|
||||||
var pin = await DecryptToUtf8Async(new EncString(await _stateService.GetProtectedPinAsync(userId)));
|
var pin = await DecryptToUtf8Async(new EncString(await _stateService.GetProtectedPinAsync(userId)));
|
||||||
var pinKey = await MakePinKeyAsync(
|
var pinKey = await MakePinKeyAsync(
|
||||||
|
|||||||
@@ -428,7 +428,7 @@ namespace Bit.Core.Services
|
|||||||
{
|
{
|
||||||
return (await GetAccountAsync(
|
return (await GetAccountAsync(
|
||||||
ReconcileOptions(new StorageOptions { UserId = userId }, await GetDefaultInMemoryOptionsAsync())
|
ReconcileOptions(new StorageOptions { UserId = userId }, await GetDefaultInMemoryOptionsAsync())
|
||||||
))?.VolatileData?.UserKeyPinEphemeral;
|
))?.VolatileData?.PinKeyEncryptedUserKeyEphemeral;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task SetPinKeyEncryptedUserKeyEphemeralAsync(EncString value, string userId = null)
|
public async Task SetPinKeyEncryptedUserKeyEphemeralAsync(EncString value, string userId = null)
|
||||||
@@ -436,7 +436,7 @@ namespace Bit.Core.Services
|
|||||||
var reconciledOptions = ReconcileOptions(new StorageOptions { UserId = userId },
|
var reconciledOptions = ReconcileOptions(new StorageOptions { UserId = userId },
|
||||||
await GetDefaultInMemoryOptionsAsync());
|
await GetDefaultInMemoryOptionsAsync());
|
||||||
var account = await GetAccountAsync(reconciledOptions);
|
var account = await GetAccountAsync(reconciledOptions);
|
||||||
account.VolatileData.UserKeyPinEphemeral = value;
|
account.VolatileData.PinKeyEncryptedUserKeyEphemeral = value;
|
||||||
await SaveAccountAsync(account, reconciledOptions);
|
await SaveAccountAsync(account, reconciledOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user