set private key on login
This commit is contained in:
parent
51ae3fc62f
commit
458de2d2e0
|
@ -9,7 +9,7 @@ namespace Bit.App.Abstractions
|
||||||
CryptoKey Key { get; set; }
|
CryptoKey Key { get; set; }
|
||||||
CryptoKey PreviousKey { get; }
|
CryptoKey PreviousKey { get; }
|
||||||
bool KeyChanged { get; }
|
bool KeyChanged { get; }
|
||||||
byte[] PrivateKey { get; set; }
|
byte[] PrivateKey { get; }
|
||||||
IDictionary<Guid, CryptoKey> OrgKeys { get; set; }
|
IDictionary<Guid, CryptoKey> OrgKeys { get; set; }
|
||||||
|
|
||||||
void SetPrivateKey(CipherString privateKeyEnc, CryptoKey key);
|
void SetPrivateKey(CipherString privateKeyEnc, CryptoKey key);
|
||||||
|
|
|
@ -11,7 +11,7 @@ namespace Bit.App.Models
|
||||||
|
|
||||||
public CipherString(string encryptedString)
|
public CipherString(string encryptedString)
|
||||||
{
|
{
|
||||||
if(string.IsNullOrWhiteSpace(encryptedString) || !encryptedString.Contains("|"))
|
if(string.IsNullOrWhiteSpace(encryptedString))
|
||||||
{
|
{
|
||||||
throw new ArgumentException(nameof(encryptedString));
|
throw new ArgumentException(nameof(encryptedString));
|
||||||
}
|
}
|
||||||
|
|
|
@ -263,6 +263,11 @@ namespace Bit.App.Services
|
||||||
|
|
||||||
private void ProcessLoginSuccess(CryptoKey key, TokenResponse response)
|
private void ProcessLoginSuccess(CryptoKey key, TokenResponse response)
|
||||||
{
|
{
|
||||||
|
if(response.PrivateKey != null)
|
||||||
|
{
|
||||||
|
_cryptoService.SetPrivateKey(new CipherString(response.PrivateKey), key);
|
||||||
|
}
|
||||||
|
|
||||||
_cryptoService.Key = key;
|
_cryptoService.Key = key;
|
||||||
_tokenService.Token = response.AccessToken;
|
_tokenService.Token = response.AccessToken;
|
||||||
_tokenService.RefreshToken = response.RefreshToken;
|
_tokenService.RefreshToken = response.RefreshToken;
|
||||||
|
|
|
@ -112,7 +112,7 @@ namespace Bit.App.Services
|
||||||
|
|
||||||
return _privateKey;
|
return _privateKey;
|
||||||
}
|
}
|
||||||
set
|
private set
|
||||||
{
|
{
|
||||||
if(value != null)
|
if(value != null)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue