s2k.js,async_proxy.js: Initialize variable data
properly
It fixes error when running the example code (in Node.js with enforced strict mode) from README.md: [ReferenceError: data is not defined] Error: Error generating keypair using js fallback! at /tmp/fff/node_modules/openpgp/src/openpgp.js:266:13 at process._tickDomainCallback (node.js:399:9)
This commit is contained in:
parent
1ee96a3f40
commit
9de55b49f3
|
@ -153,8 +153,8 @@ S2K.prototype.produce_key = function (passphrase, numBytes) {
|
||||||
|
|
||||||
case 'iterated':
|
case 'iterated':
|
||||||
var isp = [],
|
var isp = [],
|
||||||
count = s2k.get_count();
|
count = s2k.get_count(),
|
||||||
data = s2k.salt + passphrase;
|
data = s2k.salt + passphrase;
|
||||||
|
|
||||||
while (isp.length * data.length < count)
|
while (isp.length * data.length < count)
|
||||||
isp.push(data);
|
isp.push(data);
|
||||||
|
|
|
@ -333,8 +333,8 @@ AsyncProxy.prototype.decryptKey = function(privateKey, password) {
|
||||||
});
|
});
|
||||||
|
|
||||||
self.tasks.push({ resolve:function(data) {
|
self.tasks.push({ resolve:function(data) {
|
||||||
var packetlist = packet.List.fromStructuredClone(data);
|
var packetlist = packet.List.fromStructuredClone(data),
|
||||||
data = new key.Key(packetlist);
|
data = new key.Key(packetlist);
|
||||||
resolve(data);
|
resolve(data);
|
||||||
}, reject:reject });
|
}, reject:reject });
|
||||||
});
|
});
|
||||||
|
@ -361,8 +361,8 @@ AsyncProxy.prototype.decryptKeyPacket = function(privateKey, keyIds, password) {
|
||||||
});
|
});
|
||||||
|
|
||||||
self.tasks.push({ resolve:function(data) {
|
self.tasks.push({ resolve:function(data) {
|
||||||
var packetlist = packet.List.fromStructuredClone(data);
|
var packetlist = packet.List.fromStructuredClone(data),
|
||||||
data = new key.Key(packetlist);
|
data = new key.Key(packetlist);
|
||||||
resolve(data);
|
resolve(data);
|
||||||
}, reject:reject });
|
}, reject:reject });
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user