https://www.npmjs.com/package/cordova-plugin-antitampering
有没有人在他们的项目中实现了这个插件?我已经实现了插件,但是调用了这个函数:
window.cordova.plugins.AntiTampering.verify(
function (success) {
console.info(success);
// {“assets”: {“count”: x}} - where x is the number of assets checked
},
function (error) {
console.error(error);
// gives you the file on which tampering was detected
}
);问题是,函数在成功块中,但计数为0,这意味着插件实际上不会扫描任何文件。我想知道出了什么问题。
提到我所遵循的步骤:
第一步:使用cmd进行安装。命令是: cordova plugin add cordova-plugin-antitampering -variable ENABLE_CORDOVA_CALLBACK=true --save
第二步:使用以下代码调用app.component.ts中的方法:
declare var window: any;
constructor(){
this.checkTampering();
}
checkTampering(){
alert(“Inside Check Tampering”);
try {
alert("Inside Try: ");
window.cordova.plugins.AntiTampering.verify(
function (success) {
alert(JSON.stringify(success));
// {“assets”: {“count”: x}} - where x is the number of assets checked
},
function (error) {
alert(JSON.stringify(error));
// gives you the file on which tampering was detected
}
);
} catch (e) {
alert("Caught some exception when implementing Integrity check: " + JSON.stringify(e));
}
}步骤3:使用以下命令在设备上运行: ionic cordova Run android
发布于 2020-03-02 20:31:48
很抱歉,我没有在找到解决方案后立即更新此问题。一百多的浏览量意味着你们中的许多人都面临着这个问题。基本上,在应用此插件后,您不必直接运行应用程序。你需要做的就是为Android构建一个APK文件,然后在你的手机上安装APK。这就是成功处理程序返回对象成功的时候:{ "assets“:{ " count”:135 }}(在我的例子中,计数是135取决于你得到的文件数量)这基本上是我的错,我尝试直接运行应用程序,而不是首先构建APK,然后在测试设备上安装它。
发布于 2019-03-15 14:10:51
你有没有尝试过这个的Angular实现?
var app = angular.module('myApproximatelySecureApp', ['duddu.antitampering']);
app.run(['$antitampering', function ($antitampering) {
$antitampering.verify().then(function (success) {
console.info(success);
}, function (error) {
console.error(error);
});
}]);试一试,看看成功的结果是什么。
https://stackoverflow.com/questions/55176207
复制相似问题