mirror of
https://github.com/openpgpjs/openpgpjs.git
synced 2025-03-30 15:08:32 +00:00
Merge 36ac801111a77a2fab364de635ca41ba119d2d66 into 9ee587ad4f39b1ace166ca3f9ddc5510ce0b8431
This commit is contained in:
commit
d618462a08
@ -4,11 +4,15 @@
|
||||
require.config({
|
||||
baseUrl: './',
|
||||
paths: {
|
||||
openpgp: '../../resources/openpgp'
|
||||
openpgp: '../../resources/openpgp',
|
||||
jquery: '../../resources/jquery.min'
|
||||
},
|
||||
shim: {
|
||||
openpgp: {
|
||||
exports: 'window'
|
||||
},
|
||||
jquery: {
|
||||
exports: 'window'
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -22,4 +26,4 @@ require(
|
||||
// require modules loaded -> run tests
|
||||
mocha.run();
|
||||
}
|
||||
);
|
||||
);
|
||||
|
@ -1,11 +1,15 @@
|
||||
/**
|
||||
* High level crypto api that handles all calls to OpenPGP.js
|
||||
*/
|
||||
function showMessages(str) {
|
||||
};
|
||||
|
||||
define(function(require) {
|
||||
'use strict';
|
||||
|
||||
var openpgp = require('openpgp').openpgp,
|
||||
util = require('openpgp').util;
|
||||
util = require('openpgp').util,
|
||||
jquery = require('jquery').jquery;
|
||||
|
||||
var PGP = function() {
|
||||
openpgp.init();
|
||||
@ -131,7 +135,8 @@ define(function(require) {
|
||||
*/
|
||||
PGP.prototype.decrypt = function(ciphertext, senderKey, callback) {
|
||||
var privateKey = openpgp.keyring.exportPrivateKey(0).obj;
|
||||
senderKey = openpgp.read_publicKey(senderKey)[0];
|
||||
var publicKey = openpgp.read_publicKey(senderKey)[0];
|
||||
var pubKeys = [{armored: senderKey, obj: publicKey, keyId: publicKey.getKeyId()}];
|
||||
|
||||
var msg = openpgp.read_message(ciphertext)[0];
|
||||
var keymat = null;
|
||||
@ -159,7 +164,7 @@ define(function(require) {
|
||||
}
|
||||
}
|
||||
if (keymat !== null) {
|
||||
var decrypted = msg.decryptAndVerifySignature(keymat, sesskey, senderKey);
|
||||
var decrypted = msg.decryptAndVerifySignature(keymat, sesskey, pubKeys);
|
||||
callback(null, decrypted);
|
||||
|
||||
} else {
|
||||
@ -170,4 +175,4 @@ define(function(require) {
|
||||
};
|
||||
|
||||
return PGP;
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user