mirror of
https://github.com/openpgpjs/openpgpjs.git
synced 2026-03-18 06:08:58 +00:00
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:
@@ -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;
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user