1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-10 13:23:39 +00:00

[PM-2713] rename PrivateKey methods to UserPrivateKey on crypto service

This commit is contained in:
Jacob Fink
2023-07-27 16:24:31 -04:00
parent 7562c688c5
commit ba6d260565
5 changed files with 9 additions and 9 deletions

View File

@@ -199,7 +199,7 @@ namespace Bit.App.Pages
await _cryptoService.SetMasterKeyAsync(newMasterKey); await _cryptoService.SetMasterKeyAsync(newMasterKey);
await _cryptoService.SetMasterKeyHashAsync(localMasterPasswordHash); await _cryptoService.SetMasterKeyHashAsync(localMasterPasswordHash);
await _cryptoService.SetMasterKeyEncryptedUserKeyAsync(newProtectedUserKey.EncryptedString); await _cryptoService.SetMasterKeyEncryptedUserKeyAsync(newProtectedUserKey.EncryptedString);
await _cryptoService.SetPrivateKeyAsync(newProtectedPrivateKey.EncryptedString); await _cryptoService.SetUserPrivateKeyAsync(newProtectedPrivateKey.EncryptedString);
if (ResetPasswordAutoEnroll) if (ResetPasswordAutoEnroll)
{ {

View File

@@ -37,8 +37,8 @@ namespace Bit.Core.Abstractions
Task<Dictionary<string, OrgKey>> GetOrgKeysAsync(); Task<Dictionary<string, OrgKey>> GetOrgKeysAsync();
Task ClearOrgKeysAsync(bool memoryOnly = false, string userId = null); Task ClearOrgKeysAsync(bool memoryOnly = false, string userId = null);
Task<byte[]> GetPublicKeyAsync(); Task<byte[]> GetPublicKeyAsync();
Task SetPrivateKeyAsync(string encPrivateKey); Task SetUserPrivateKeyAsync(string encPrivateKey);
Task<byte[]> GetPrivateKeyAsync(); Task<byte[]> GetUserPrivateKeyAsync();
Task<List<string>> GetFingerprintAsync(string userId, byte[] publicKey = null); Task<List<string>> GetFingerprintAsync(string userId, byte[] publicKey = null);
Task<Tuple<string, EncString>> MakeKeyPairAsync(SymmetricCryptoKey key = null); Task<Tuple<string, EncString>> MakeKeyPairAsync(SymmetricCryptoKey key = null);
Task ClearKeyPairAsync(bool memoryOnly = false, string userId = null); Task ClearKeyPairAsync(bool memoryOnly = false, string userId = null);

View File

@@ -508,7 +508,7 @@ namespace Bit.Core.Services
catch { } catch { }
} }
await _cryptoService.SetPrivateKeyAsync(tokenResponse.PrivateKey); await _cryptoService.SetUserPrivateKeyAsync(tokenResponse.PrivateKey);
} }
else if (tokenResponse.KeyConnectorUrl != null) else if (tokenResponse.KeyConnectorUrl != null)
{ {

View File

@@ -354,7 +354,7 @@ namespace Bit.Core.Services
{ {
return _publicKey; return _publicKey;
} }
var privateKey = await GetPrivateKeyAsync(); var privateKey = await GetUserPrivateKeyAsync();
if (privateKey == null) if (privateKey == null)
{ {
return null; return null;
@@ -363,7 +363,7 @@ namespace Bit.Core.Services
return _publicKey; return _publicKey;
} }
public async Task SetPrivateKeyAsync(string encPrivateKey) public async Task SetUserPrivateKeyAsync(string encPrivateKey)
{ {
if (encPrivateKey == null) if (encPrivateKey == null)
{ {
@@ -373,7 +373,7 @@ namespace Bit.Core.Services
_privateKey = null; _privateKey = null;
} }
public async Task<byte[]> GetPrivateKeyAsync() public async Task<byte[]> GetUserPrivateKeyAsync()
{ {
if (_privateKey != null) if (_privateKey != null)
{ {
@@ -519,7 +519,7 @@ namespace Bit.Core.Services
if (privateKey is null) if (privateKey is null)
{ {
privateKey = await GetPrivateKeyAsync(); privateKey = await GetUserPrivateKeyAsync();
} }
if (privateKey == null) if (privateKey == null)

View File

@@ -328,7 +328,7 @@ namespace Bit.Core.Services
return; return;
} }
await _cryptoService.SetMasterKeyEncryptedUserKeyAsync(response.Key); await _cryptoService.SetMasterKeyEncryptedUserKeyAsync(response.Key);
await _cryptoService.SetPrivateKeyAsync(response.PrivateKey); await _cryptoService.SetUserPrivateKeyAsync(response.PrivateKey);
await _cryptoService.SetOrgKeysAsync(response.Organizations); await _cryptoService.SetOrgKeysAsync(response.Organizations);
await _stateService.SetSecurityStampAsync(response.SecurityStamp); await _stateService.SetSecurityStampAsync(response.SecurityStamp);
var organizations = response.Organizations.ToDictionary(o => o.Id, o => new OrganizationData(o)); var organizations = response.Organizations.ToDictionary(o => o.Id, o => new OrganizationData(o));