I'm using an openPgpJs library in my app, created with Apache Cordova.
Here's the part of the code:
var publicKey = openpgp.key.readArmored(_publicKey);
openpgp.encryptMessage(publicKey.keys, text).then(function (pgpMessage) {
// success
callback(pgpMessage);
}).catch(function (error) {
// failure
console.error(error);
});
It works fine but not on WP8. If fails, 'cause openpgp
var is undefined. In that library source there's such code at the very beginning:
!function (e) {
"object" == typeof exports ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : "undefined" != typeof window ? window.openpgp = e() : "undefined" != typeof global ? global.openpgp = e() : "undefined" != typeof self && (self.openpgp = e())
}
so openpgp
should be defined. How can I make it work?
UPDATE
I've added var openpgp = window.openpgp;
and the error disappeared. Now it joust fails to encrypt message - and it's hard to debug, cause the library code is minified