mirror of
https://github.com/bitwarden/mobile
synced 2026-01-20 01:13:30 +00:00
use crypto service
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
using Bit.Core.Models.Data;
|
||||
using Bit.Core.Abstractions;
|
||||
using Bit.Core.Models.Data;
|
||||
using Bit.Core.Models.View;
|
||||
using Bit.Core.Utilities;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@@ -37,9 +39,21 @@ namespace Bit.Core.Models.Domain
|
||||
{
|
||||
"FileName"
|
||||
}, orgId);
|
||||
|
||||
// TODO: Decrypt key
|
||||
|
||||
|
||||
if(Key != null)
|
||||
{
|
||||
var cryptoService = ServiceContainer.Resolve<ICryptoService>("cryptoService");
|
||||
try
|
||||
{
|
||||
var orgKey = await cryptoService.GetOrgKeyAsync(orgId);
|
||||
var decValue = await cryptoService.DecryptToBytesAsync(Key, orgKey);
|
||||
view.Key = new SymmetricCryptoKey(decValue);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// TODO: error?
|
||||
}
|
||||
}
|
||||
return view;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user