small fixes

This commit is contained in:
Sanjana Rajan 2017-03-07 19:10:33 -08:00
parent 465d4643a8
commit da9e3c6264
2 changed files with 10 additions and 6 deletions

View File

@ -189,7 +189,7 @@ export function encrypt({ data, publicKeys, privateKeys, passwords, filename, ar
checkData(data); publicKeys = toArray(publicKeys); privateKeys = toArray(privateKeys); passwords = toArray(passwords);
if (!nativeAEAD() && asyncProxy) { // use web worker if web crypto apis are not supported
return asyncProxy.delegate('encrypt', { data, publicKeys, privateKeys, passwords, filename, armor });
return asyncProxy.delegate('encrypt', { data, publicKeys, privateKeys, passwords, filename, armor, detached });
}
var result = {};
return Promise.resolve().then(() => {
@ -237,7 +237,7 @@ export function decrypt({ message, privateKey, publicKeys, sessionKey, password,
checkMessage(message); publicKeys = toArray(publicKeys);
if (!nativeAEAD() && asyncProxy) { // use web worker if web crypto apis are not supported
return asyncProxy.delegate('decrypt', { message, privateKey, publicKeys, sessionKey, password, format });
return asyncProxy.delegate('decrypt', { message, privateKey, publicKeys, sessionKey, password, format, signature });
}
return message.decrypt(privateKey, sessionKey, password).then(message => {
@ -279,7 +279,7 @@ export function sign({ data, privateKeys, armor=true, detached=false}) {
privateKeys = toArray(privateKeys);
if (asyncProxy) { // use web worker if available
return asyncProxy.delegate('sign', { data, privateKeys, armor });
return asyncProxy.delegate('sign', { data, privateKeys, armor, detached });
}
var result = {};
@ -322,7 +322,7 @@ export function verify({ message, publicKeys, signature=null }) {
publicKeys = toArray(publicKeys);
if (asyncProxy) { // use web worker if available
return asyncProxy.delegate('verify', { message, publicKeys });
return asyncProxy.delegate('verify', { message, publicKeys, signature });
}
var result = {};

View File

@ -60,11 +60,11 @@ export function clonePackets(options) {
//could be either a Message or CleartextMessage object
if (options.message instanceof message.Message) {
options.message = options.message.packets;
} else {
} else if (options.message instanceof cleartext.CleartextMessage) {
options.message.signature = options.message.signature.packets;
}
}
if (options.signature) {
if (options.signature && (options.signature instanceof signature.Signature)) {
options.signature = options.signature.packets;
}
return options;
@ -133,6 +133,10 @@ function packetlistCloneToSignatures(clone) {
}
function packetlistCloneToSignature(clone) {
if (typeof clone === "string") {
//signature is armored
return clone;
}
var packetlist = Packetlist.fromStructuredClone(clone);
return new signature.Signature(packetlist);
}