mirror of
https://github.com/bitwarden/mobile
synced 2026-01-10 12:33:28 +00:00
Use type to ensure transmitted data is encrypted (#1422)
This commit is contained in:
@@ -4,7 +4,7 @@ using Bit.Core.Models.Response;
|
||||
|
||||
namespace Bit.Core.Abstractions {
|
||||
public interface IFileUploadService {
|
||||
Task UploadCipherAttachmentFileAsync(AttachmentUploadDataResponse uploadData, string fileName, EncByteArray encryptedFileData);
|
||||
Task UploadCipherAttachmentFileAsync(AttachmentUploadDataResponse uploadData, EncString fileName, EncByteArray encryptedFileData);
|
||||
Task UploadSendFileAsync(SendFileUploadDataResponse uploadData, EncString fileName, EncByteArray encryptedFileData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -574,7 +574,7 @@ namespace Bit.Core.Services
|
||||
|
||||
var uploadDataResponse = await _apiService.PostCipherAttachmentAsync(cipher.Id, request);
|
||||
response = uploadDataResponse.CipherResponse;
|
||||
await _fileUploadService.UploadCipherAttachmentFileAsync(uploadDataResponse, encFileName.EncryptedString, encFileData);
|
||||
await _fileUploadService.UploadCipherAttachmentFileAsync(uploadDataResponse, encFileName, encFileData);
|
||||
}
|
||||
catch (ApiException e) when (e.Error.StatusCode == System.Net.HttpStatusCode.NotFound || e.Error.StatusCode == System.Net.HttpStatusCode.MethodNotAllowed)
|
||||
{
|
||||
|
||||
@@ -20,14 +20,14 @@ namespace Bit.Core.Services {
|
||||
private readonly ApiService _apiService;
|
||||
|
||||
public async Task UploadCipherAttachmentFileAsync(AttachmentUploadDataResponse uploadData,
|
||||
string encryptedFileName, EncByteArray encryptedFileData)
|
||||
EncString encryptedFileName, EncByteArray encryptedFileData)
|
||||
{
|
||||
try
|
||||
{
|
||||
switch (uploadData.FileUploadType)
|
||||
{
|
||||
case FileUploadType.Direct:
|
||||
await _bitwardenFileUploadService.Upload(encryptedFileName, encryptedFileData,
|
||||
await _bitwardenFileUploadService.Upload(encryptedFileName.EncryptedString, encryptedFileData,
|
||||
fd => _apiService.PostAttachmentFileAsync(uploadData.CipherResponse.Id, uploadData.AttachmentId, fd));
|
||||
break;
|
||||
case FileUploadType.Azure:
|
||||
|
||||
Reference in New Issue
Block a user