diff --git a/lib/core/configuration.dart b/lib/core/configuration.dart index 0e83d119e..90e32f7b6 100644 --- a/lib/core/configuration.dart +++ b/lib/core/configuration.dart @@ -80,7 +80,7 @@ class Configuration { } String getHttpEndpoint() { - return "https://api.staging.ente.io"; + return "http://192.168.0.100"; } Future setEndpoint(String endpoint) async { diff --git a/lib/file_uploader.dart b/lib/file_uploader.dart index b794e0d20..26939f79a 100644 --- a/lib/file_uploader.dart +++ b/lib/file_uploader.dart @@ -41,8 +41,10 @@ class FileUploader { }); } + // TODO: Remove encryption and decryption time logging Future encryptAndUploadFile(File file) async { _logger.info("Uploading " + file.toString()); + final password = CryptoUtil.getSecureRandomString(length: 32); final iv = CryptoUtil.getSecureRandomBytes(length: 16); final base64EncodedIV = base64.encode(iv); @@ -53,6 +55,10 @@ class FileUploader { final encryptedFileName = file.generatedID.toString() + ".aes"; final tempDirectory = Configuration.instance.getTempDirectory(); final encryptedFilePath = tempDirectory + encryptedFileName; + + _logger.info("File size " + + (await (await file.getAsset()).file).lengthSync().toString()); + final encryptionStartTime = DateTime.now().millisecondsSinceEpoch; if (file.fileType == FileType.image) { await CryptoUtil.encryptDataToFile( await getBytesFromDisk(file), encryptedFilePath, password); @@ -62,6 +68,15 @@ class FileUploader { encryptedFilePath, password); } + final encryptionStopTime = DateTime.now().millisecondsSinceEpoch; + _logger.info("Encryption time: " + + (encryptionStopTime - encryptionStartTime).toString()); + + final decryptionStartTime = DateTime.now().millisecondsSinceEpoch; + await CryptoUtil.decryptFileToData(encryptedFilePath, password); + final decryptionStopTime = DateTime.now().millisecondsSinceEpoch; + _logger.info("Decryption time: " + + (decryptionStopTime - decryptionStartTime).toString()); final fileUploadURL = await getUploadURL(); String fileObjectKey =