Fix Keyid.fromId()
This commit is contained in:
parent
b80a172834
commit
e3b146b9d9
|
@ -39,7 +39,7 @@ export default function Keyid() {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parsing method for a key id
|
* Parsing method for a key id
|
||||||
* @param {String} input Input to read the key id from
|
* @param {Uint8Array} input Input to read the key id from
|
||||||
*/
|
*/
|
||||||
Keyid.prototype.read = function(bytes) {
|
Keyid.prototype.read = function(bytes) {
|
||||||
this.bytes = util.Uint8Array2str(bytes.subarray(0, 8));
|
this.bytes = util.Uint8Array2str(bytes.subarray(0, 8));
|
||||||
|
@ -73,6 +73,6 @@ Keyid.fromClone = function (clone) {
|
||||||
|
|
||||||
Keyid.fromId = function (hex) {
|
Keyid.fromId = function (hex) {
|
||||||
var keyid = new Keyid();
|
var keyid = new Keyid();
|
||||||
keyid.read(util.hex2bin(hex));
|
keyid.read(util.str2Uint8Array(util.hex2bin(hex)));
|
||||||
return keyid;
|
return keyid;
|
||||||
};
|
};
|
||||||
|
|
|
@ -426,6 +426,13 @@ var pgp_desktop_priv =
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('Create new key ID with fromId()', function() {
|
||||||
|
var pubKeyV4 = openpgp.key.readArmored(twoKeys).keys[0];
|
||||||
|
var keyId = pubKeyV4.primaryKey.getKeyId();
|
||||||
|
var newKeyId = keyId.constructor.fromId(keyId.toHex());
|
||||||
|
expect(newKeyId.toHex()).to.equal(keyId.toHex());
|
||||||
|
});
|
||||||
|
|
||||||
it('Testing key method getSubkeyPackets', function(done) {
|
it('Testing key method getSubkeyPackets', function(done) {
|
||||||
var pubKeys = openpgp.key.readArmored(pub_sig_test);
|
var pubKeys = openpgp.key.readArmored(pub_sig_test);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user