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:
26
src/Core/Services/BitwardenFileUploadService.cs
Normal file
26
src/Core/Services/BitwardenFileUploadService.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user