|
|
|
|
@ -2,27 +2,25 @@ import 'dart:convert';
|
|
|
|
|
|
|
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
|
|
|
|
|
|
class Encryption {
|
|
|
|
|
static final Encryption _instance = Encryption._internal();
|
|
|
|
|
class EmailImageEncryption {
|
|
|
|
|
static final EmailImageEncryption _instance = EmailImageEncryption._internal();
|
|
|
|
|
static const MethodChannel _channel = MethodChannel('flutter_des');
|
|
|
|
|
static const key = "PeShVmYp";
|
|
|
|
|
static const iv = "j70IbWYn";
|
|
|
|
|
|
|
|
|
|
Encryption._internal();
|
|
|
|
|
EmailImageEncryption._internal();
|
|
|
|
|
|
|
|
|
|
factory Encryption() => _instance;
|
|
|
|
|
factory EmailImageEncryption() => _instance;
|
|
|
|
|
|
|
|
|
|
Future<String> encrypt({required String val}) async {
|
|
|
|
|
Uint8List? crypt = await _channel.invokeMethod('encrypt', [val, key, iv]);
|
|
|
|
|
String data = base64Encode(crypt!.toList());
|
|
|
|
|
print("Base64Enc: " + data);
|
|
|
|
|
return data;
|
|
|
|
|
String enc = base64Encode(crypt!.toList());
|
|
|
|
|
return enc;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<String> decrypt({required String encodedVal}) async {
|
|
|
|
|
var deco = base64Decode(encodedVal);
|
|
|
|
|
Uint8List deco = base64Decode(encodedVal);
|
|
|
|
|
String? decCrypt = await _channel.invokeMethod('decrypt', [deco, key, iv]);
|
|
|
|
|
print("Base64ToStringDec: " + decCrypt!);
|
|
|
|
|
return decCrypt!;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|