1"use strict"; 2Object.defineProperty(exports, "__esModule", { value: true }); 3exports.Signature = void 0; 4/** 5 * A container class containing information about a signature. 6 * 7 * Contains a signature and the keyid uniquely identifying the key used 8 * to generate the signature. 9 * 10 * Provide a `fromJSON` method to create a Signature from a JSON object. 11 */ 12class Signature { 13 constructor(options) { 14 const { keyID, sig } = options; 15 this.keyID = keyID; 16 this.sig = sig; 17 } 18 toJSON() { 19 return { 20 keyid: this.keyID, 21 sig: this.sig, 22 }; 23 } 24 static fromJSON(data) { 25 const { keyid, sig } = data; 26 if (typeof keyid !== 'string') { 27 throw new TypeError('keyid must be a string'); 28 } 29 if (typeof sig !== 'string') { 30 throw new TypeError('sig must be a string'); 31 } 32 return new Signature({ 33 keyID: keyid, 34 sig: sig, 35 }); 36 } 37} 38exports.Signature = Signature; 39