I'm using a custom cordova plugin (https://github.com/VJAI/simple-crypto), not available in ionic native.
I'm using Ionic 2 and have installed the plugin using the command:
cordova plugin add https://github.com/VJAI/simple-crypto
The interface is like this:
var rncryptor = cordova.require("com.disusered.simplecrypto.SimpleCrypto");
rncryptor.encrypt(key, data, successCallback, failureCallback)
rncryptor.decrypt(key, data, successCallback, failureCallback)`
Method 1:
I have tried to invoke the plugin using
window.plugins.SimpleCrypto.encrypt(...)
But when I run ionic serve
, i get the error:
TypeError: Cannot read property 'SimpleCrypto' of undefined
Method 2:
Another way i tried was
cordova.plugins.SimpleCrypto.encrypt(...)
The error i got was
ReferenceError: cordova is not defined
Is there any way to go around doing this?