include other key arrays
This commit is contained in:
parent
1fd2c0f6f4
commit
4bca02e635
|
@ -59,6 +59,10 @@ function initWorker(path) {
|
||||||
* @static
|
* @static
|
||||||
*/
|
*/
|
||||||
function encryptMessage(keys, text, callback) {
|
function encryptMessage(keys, text, callback) {
|
||||||
|
if (typeof keys === 'string') {
|
||||||
|
keys = [keys];
|
||||||
|
}
|
||||||
|
|
||||||
if (useWorker(callback)) {
|
if (useWorker(callback)) {
|
||||||
asyncProxy.encryptMessage(keys, text, callback);
|
asyncProxy.encryptMessage(keys, text, callback);
|
||||||
return;
|
return;
|
||||||
|
@ -165,6 +169,10 @@ function decryptAndVerifyMessage(privateKey, publicKeys, msg, callback) {
|
||||||
* @static
|
* @static
|
||||||
*/
|
*/
|
||||||
function signClearMessage(privateKeys, text, callback) {
|
function signClearMessage(privateKeys, text, callback) {
|
||||||
|
if (typeof privateKeys === 'string') {
|
||||||
|
privateKeys = [privateKeys];
|
||||||
|
}
|
||||||
|
|
||||||
if (useWorker(callback)) {
|
if (useWorker(callback)) {
|
||||||
asyncProxy.signClearMessage(privateKeys, text, callback);
|
asyncProxy.signClearMessage(privateKeys, text, callback);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -101,6 +101,9 @@ AsyncProxy.prototype.terminate = function() {
|
||||||
* @param {Function} callback receives encrypted ASCII armored message
|
* @param {Function} callback receives encrypted ASCII armored message
|
||||||
*/
|
*/
|
||||||
AsyncProxy.prototype.encryptMessage = function(keys, text, callback) {
|
AsyncProxy.prototype.encryptMessage = function(keys, text, callback) {
|
||||||
|
if (typeof keys === 'string') {
|
||||||
|
keys = [keys];
|
||||||
|
}
|
||||||
keys = keys.map(function(key) {
|
keys = keys.map(function(key) {
|
||||||
return key.toPacketlist();
|
return key.toPacketlist();
|
||||||
});
|
});
|
||||||
|
@ -193,6 +196,9 @@ AsyncProxy.prototype.decryptAndVerifyMessage = function(privateKey, publicKeys,
|
||||||
* @param {Function} callback receives ASCII armored message
|
* @param {Function} callback receives ASCII armored message
|
||||||
*/
|
*/
|
||||||
AsyncProxy.prototype.signClearMessage = function(privateKeys, text, callback) {
|
AsyncProxy.prototype.signClearMessage = function(privateKeys, text, callback) {
|
||||||
|
if (typeof privateKeys === 'string') {
|
||||||
|
privateKeys = [privateKeys];
|
||||||
|
}
|
||||||
privateKeys = privateKeys.map(function(key) {
|
privateKeys = privateKeys.map(function(key) {
|
||||||
return key.toPacketlist();
|
return key.toPacketlist();
|
||||||
});
|
});
|
||||||
|
|
|
@ -38,6 +38,9 @@ onmessage = function (event) {
|
||||||
break;
|
break;
|
||||||
case 'encrypt-message':
|
case 'encrypt-message':
|
||||||
try {
|
try {
|
||||||
|
if (typeof msg.keys === 'string') {
|
||||||
|
msg.keys = [msg.keys];
|
||||||
|
}
|
||||||
msg.keys = msg.keys.map(packetlistCloneToKey);
|
msg.keys = msg.keys.map(packetlistCloneToKey);
|
||||||
data = window.openpgp.encryptMessage(msg.keys, msg.text);
|
data = window.openpgp.encryptMessage(msg.keys, msg.text);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user