1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-19 01:33:22 +00:00

Send azure upload (#1334)

* Add direct upload api endpoints

* Create azure upload service

* Update max file size

* Update send file upload test

* Move internationalization string to correct document

* Allow for one shot blob uploads

* Remove unused helper

* Use FileUploadService

Fallback to legacy method on old server implementations.
This commit is contained in:
Matt Gibson
2021-03-29 09:45:04 -05:00
committed by GitHub
parent ab04759b0e
commit 13ffbe911a
16 changed files with 400 additions and 40 deletions

View File

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