commit
acf66eb012
|
@ -39,7 +39,7 @@ export default function Keyid() {
|
|||
|
||||
/**
|
||||
* 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) {
|
||||
this.bytes = util.Uint8Array2str(bytes.subarray(0, 8));
|
||||
|
@ -73,6 +73,6 @@ Keyid.fromClone = function (clone) {
|
|||
|
||||
Keyid.fromId = function (hex) {
|
||||
var keyid = new Keyid();
|
||||
keyid.read(util.hex2bin(hex));
|
||||
keyid.read(util.str2Uint8Array(util.hex2bin(hex)));
|
||||
return keyid;
|
||||
};
|
||||
|
|
|
@ -426,6 +426,13 @@ var pgp_desktop_priv =
|
|||
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) {
|
||||
var pubKeys = openpgp.key.readArmored(pub_sig_test);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user