Remove unused AESCrypt library
This commit is contained in:
parent
04e2edd4e7
commit
a089fd1e3b
3 changed files with 0 additions and 96 deletions
|
@ -1,19 +1,16 @@
|
|||
import 'dart:typed_data';
|
||||
|
||||
import 'dart:io' as io;
|
||||
import 'package:aes_crypt/aes_crypt.dart';
|
||||
import 'package:computer/computer.dart';
|
||||
import 'package:encrypt/encrypt.dart';
|
||||
import 'package:encrypt/encrypt.dart' as e;
|
||||
import 'package:flutter_sodium/flutter_sodium.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
|
||||
import 'package:photos/core/configuration.dart';
|
||||
import 'package:photos/models/encrypted_data_attributes.dart';
|
||||
import 'package:photos/models/encrypted_file_attributes.dart';
|
||||
import 'package:photos/models/encryption_attribute.dart';
|
||||
import 'package:steel_crypt/steel_crypt.dart' as steel;
|
||||
import 'package:uuid/uuid.dart';
|
||||
|
||||
final int encryptionChunkSize = 4 * 1024 * 1024;
|
||||
final int decryptionChunkSize =
|
||||
|
@ -185,89 +182,4 @@ class CryptoUtil {
|
|||
iv: IV(iv),
|
||||
);
|
||||
}
|
||||
|
||||
static Future<String> encryptFileToFile(
|
||||
String sourcePath, String destinationPath, String password) async {
|
||||
final args = Map<String, dynamic>();
|
||||
args["password"] = password;
|
||||
args["source"] = sourcePath;
|
||||
args["destination"] = destinationPath;
|
||||
return Computer().compute(runEncryptFileToFile, param: args);
|
||||
}
|
||||
|
||||
static Future<String> encryptDataToFile(
|
||||
Uint8List source, String destinationPath, String password) async {
|
||||
final args = Map<String, dynamic>();
|
||||
args["password"] = password;
|
||||
args["source"] = source;
|
||||
args["destination"] = destinationPath;
|
||||
return Computer().compute(runEncryptDataToFile, param: args);
|
||||
}
|
||||
|
||||
static Future<Uint8List> encryptDataToData(
|
||||
Uint8List source, String password) async {
|
||||
final destinationPath =
|
||||
Configuration.instance.getTempDirectory() + Uuid().v4();
|
||||
return encryptDataToFile(source, destinationPath, password).then((value) {
|
||||
final file = io.File(destinationPath);
|
||||
final data = file.readAsBytesSync();
|
||||
file.deleteSync();
|
||||
return data;
|
||||
});
|
||||
}
|
||||
|
||||
static Future<void> decryptFileToFile(
|
||||
String sourcePath, String destinationPath, String password) async {
|
||||
final args = Map<String, dynamic>();
|
||||
args["password"] = password;
|
||||
args["source"] = sourcePath;
|
||||
args["destination"] = destinationPath;
|
||||
return Computer().compute(runDecryptFileToFile, param: args);
|
||||
}
|
||||
|
||||
static Future<Uint8List> decryptFileToData(
|
||||
String sourcePath, String password) {
|
||||
final args = Map<String, dynamic>();
|
||||
args["password"] = password;
|
||||
args["source"] = sourcePath;
|
||||
return Computer().compute(runDecryptFileToData, param: args);
|
||||
}
|
||||
|
||||
static Future<Uint8List> decryptDataToData(
|
||||
Uint8List source, String password) {
|
||||
final sourcePath = Configuration.instance.getTempDirectory() + Uuid().v4();
|
||||
final file = io.File(sourcePath);
|
||||
file.writeAsBytesSync(source);
|
||||
return decryptFileToData(sourcePath, password).then((value) {
|
||||
file.deleteSync();
|
||||
return value;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Future<String> runEncryptFileToFile(Map<String, dynamic> args) {
|
||||
final encrypter = getEncrypter(args["password"]);
|
||||
return encrypter.encryptFile(args["source"], args["destination"]);
|
||||
}
|
||||
|
||||
Future<String> runEncryptDataToFile(Map<String, dynamic> args) {
|
||||
final encrypter = getEncrypter(args["password"]);
|
||||
return encrypter.encryptDataToFile(args["source"], args["destination"]);
|
||||
}
|
||||
|
||||
Future<String> runDecryptFileToFile(Map<String, dynamic> args) async {
|
||||
final encrypter = getEncrypter(args["password"]);
|
||||
return encrypter.decryptFile(args["source"], args["destination"]);
|
||||
}
|
||||
|
||||
Future<Uint8List> runDecryptFileToData(Map<String, dynamic> args) async {
|
||||
final encrypter = getEncrypter(args["password"]);
|
||||
return encrypter.decryptDataFromFile(args["source"]);
|
||||
}
|
||||
|
||||
AesCrypt getEncrypter(String password) {
|
||||
final encrypter = AesCrypt(password);
|
||||
encrypter.aesSetMode(AesMode.cbc);
|
||||
encrypter.setOverwriteMode(AesCryptOwMode.on);
|
||||
return encrypter;
|
||||
}
|
||||
|
|
|
@ -1,13 +1,6 @@
|
|||
# Generated by pub
|
||||
# See https://dart.dev/tools/pub/glossary#lockfile
|
||||
packages:
|
||||
aes_crypt:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: aes_crypt
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.1.1"
|
||||
animate_do:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
|
|
@ -23,7 +23,6 @@ dependencies:
|
|||
# The following adds the Cupertino Icons font to your application.
|
||||
# Use with the CupertinoIcons class for iOS style icons.
|
||||
encrypt: ^4.0.2
|
||||
aes_crypt: ^0.1.1
|
||||
cupertino_icons: ^0.1.2
|
||||
photo_manager: ^0.5.8
|
||||
provider: ^3.1.0
|
||||
|
|
Loading…
Add table
Reference in a new issue