问题描述
我正在申请,并且正在使用付款网关,特别是MercadoPago SDK。这个SDK需要一系列键才能正确操作,但是我在保存在Strings中的以下类中使用它们,以便在应用程序中使用它们:
这是我的globals.dart
library my_prj.globals;
String mpTESTPublicKey = "TEST-ABCDEFG";
String mpTESTAccesstoken = "TEST-HIJKLM";
String mpPublicKey = "APP_USR-123456";
String mpAccesstoken = "APP_USR-78910";
String mpClientID = "1234566789";
String mpClientSecret = "A1B2C3D4E5";
我发现自己在应用程序中使用这些键的方式如下:
Future<Map<String,dynamic>> buildPreference() async {
var email = common.email;
var name = common.displayName;
var mp = MP(globals.mpClientID,globals.mpClientSecret); //Client secret ID
var preference = {
"items": [
{
'title': common.title,'quantity': 1,'currency_id': 'cop','unit_price': common.price
}
],'payer': {'name': name,'email': email},};
var result = await mp.createPreference(preference);
return result;
}
Future<void> executeMercadoPago() async {
buildPreference().then((result) {
if (result != null) {
var preferenceId = result['response']['id'];
try {
const channelMercadoPago =
const MethodChannel("example.com/mercadoPago");
final response = channelMercadoPago.invokeMethod(
'mercadoPago',<String,dynamic>{
"publicKey": globals.mpTESTPublicKey,//Public test key
"preferenceId": preferenceId
});
print(response);
} on PlatformException catch (e) {
print(e.message);
}
}
});
}
但是,研究发现,在发布应用程序时,人们可以访问这些键的代码和信息,为此,我想知道是否有任何方法可以在应用程序内使用此信息具有完全的安全性。
我已经考虑过对这些字符串进行加密,但是,我不知道是否可以访问此加密,然后它们就可以轻松地对其进行解密。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)