encryptString method
Implementation
@override
Future<String?> encryptString(String txt, String publicKey) async {
try {
publicKey = publicKey
.replaceAll("-----BEGIN PUBLIC KEY-----", "")
.replaceAll("-----END PUBLIC KEY-----", "");
final result = await methodChannel.invokeMethod<String>(
'encrypt', {"txt": txt, "publicKey": publicKey});
return result;
} on PlatformException catch (e) {
throw "Failed to get string encoded: '${e.message}'.";
}
}