Add web worker support. Load the whole library in a web worker

and make the high-level API accessible from an asynchronous proxy.
Entropy is seeded to worker on each generateKeyPair() call.
Allow serialization of packets and custom types for messaging API.
This commit is contained in:
Thomas Oberndörfer
2014-01-13 13:56:06 +01:00
parent 4f2100fa40
commit 3612fc12dc
25 changed files with 499 additions and 20 deletions

View File

@@ -65,3 +65,9 @@ Keyid.prototype.isNull = function() {
module.exports.mapToHex = function (keyId) {
return keyId.toHex();
};
module.exports.fromClone = function (clone) {
var keyid = new Keyid();
keyid.bytes = clone.bytes;
return keyid;
};

View File

@@ -100,3 +100,12 @@ MPI.prototype.toBigInteger = function () {
MPI.prototype.fromBigInteger = function (bn) {
this.data = bn.clone();
};
module.exports.fromClone = function (clone) {
clone.data.copyTo = BigInteger.prototype.copyTo;
var bn = new BigInteger();
clone.data.copyTo(bn);
var mpi = new MPI();
mpi.data = bn;
return mpi;
};

View File

@@ -178,3 +178,12 @@ S2K.prototype.produce_key = function (passphrase, numBytes) {
return result.substr(0, numBytes);
};
module.exports.fromClone = function (clone) {
var s2k = new S2K();
this.algorithm = clone.algorithm;
this.type = clone.type;
this.c = clone.c;
this.salt = clone.salt;
return s2k;
};