You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			28 lines
		
	
	
		
			845 B
		
	
	
	
		
			Dart
		
	
			
		
		
	
	
			28 lines
		
	
	
		
			845 B
		
	
	
	
		
			Dart
		
	
import 'dart:convert';
 | 
						|
import 'dart:typed_data';
 | 
						|
 | 
						|
import 'package:flutter/services.dart';
 | 
						|
 | 
						|
class EmailImageEncryption {
 | 
						|
  static final EmailImageEncryption _instance = EmailImageEncryption._internal();
 | 
						|
  static const MethodChannel _channel = MethodChannel('flutter_des');
 | 
						|
  static const key = "PeShVmYp";
 | 
						|
  static const iv = "j70IbWYn";
 | 
						|
 | 
						|
  EmailImageEncryption._internal();
 | 
						|
 | 
						|
  factory EmailImageEncryption() => _instance;
 | 
						|
 | 
						|
  Future<String> encrypt({required String val}) async {
 | 
						|
    Uint8List? crypt = await _channel.invokeMethod('encrypt', [val, key, iv]);
 | 
						|
    String enc = base64Encode(crypt!.toList());
 | 
						|
    return enc;
 | 
						|
  }
 | 
						|
 | 
						|
  Future<String> decrypt({required String encodedVal}) async {
 | 
						|
    Uint8List deco = base64Decode(encodedVal);
 | 
						|
    String? decCrypt = await _channel.invokeMethod('decrypt', [deco, key, iv]);
 | 
						|
    return decCrypt!;
 | 
						|
  }
 | 
						|
}
 |