1
0
mirror of https://github.com/bitwarden/mobile synced 2026-01-20 01:13:30 +00:00

use crypto service

This commit is contained in:
Kyle Spearrin
2019-04-15 07:56:46 -04:00
parent f228758fb7
commit 4aa5ba2754
2 changed files with 36 additions and 10 deletions

View File

@@ -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;
}