importScripts('jquery.js'); importScripts('openpgp.js'); function attachments(files) { var res = ''; if (files) files.forEach(function(file) { if (file.type.match("^image/")) res += ''; }); return res; } addEventListener('message', function(data) { var e = data.e; var key = data.key; var message = openpgp.message.readArmored(e["msg"]); var privkey = privateKey().keys[0]; if (privkey.decrypt(password)) openpgp.decryptAndVerifyMessage(privkey, key.keys, message) .then(function(msg) { var message = JSON.parse(msg.text); // todo: check msg.signatures[0].valid postMessage('