1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-10-01 04:27:39 +02:00
bitwarden-mobile/src/Core/Services/BitwardenFileUploadService.cs
Matt Gibson a3b4ede8f3
Use CipherByteArray to signify encrypted byte[] (#1366)
* Use CipherByteArray to signify encrypted  byte[]

* Rename CipherString and CipherByteArray to EncString and EncByteArray
2021-04-21 15:27:14 -05:00

28 lines
772 B
C#

using System;
using System.Net.Http;
using System.Threading.Tasks;
using Bit.Core.Models.Domain;
namespace Bit.Core.Services
{
public class BitwardenFileUploadService
{
public BitwardenFileUploadService(ApiService apiService)
{
_apiService = apiService;
}
private readonly ApiService _apiService;
public async Task Upload(string encryptedFileName, EncByteArray encryptedFileData, Func<MultipartFormDataContent, Task> apiCall)
{
var fd = new MultipartFormDataContent($"--BWMobileFormBoundary{DateTime.UtcNow.Ticks}")
{
{ new ByteArrayContent(encryptedFileData.Buffer), "data", encryptedFileName }
};
await apiCall(fd);
}
}
}