diff --git a/.gitignore b/.gitignore
index 1e0bc5c..9f03e18 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,13 +1,6 @@
/.dev
-/lib
-/node_modules/*
-
-# Fix https://github.com/crazy-max/ghaction-import-gpg/issues/9
-!/node_modules/asn1.js/
-!/node_modules/bn.js/
-!/node_modules/inherits/
-!/node_modules/safer-buffer/
-!/node_modules/minimalistic-assert/
+node_modules/
+lib
# Jetbrains
/.idea
diff --git a/dist/index.js b/dist/index.js
index 415ac3e..0e07274 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -396,7 +396,7 @@ function run() {
}
const version = yield gpg.getVersion();
const dirs = yield gpg.getDirs();
- yield core.group(`๐ฃ GnuPG info`, () => __awaiter(this, void 0, void 0, function* () {
+ yield core.group(`GnuPG info`, () => __awaiter(this, void 0, void 0, function* () {
core.info(`Version : ${version.gnupg} (libgcrypt ${version.libgcrypt})`);
core.info(`Libdir : ${dirs.libdir}`);
core.info(`Libexecdir : ${dirs.libexecdir}`);
@@ -404,38 +404,37 @@ function run() {
core.info(`Homedir : ${dirs.homedir}`);
}));
const privateKey = yield openpgp.readPrivateKey(inputs.gpgPrivateKey);
- yield core.group(`๐ฎ Checking GPG private key`, () => __awaiter(this, void 0, void 0, function* () {
+ yield core.group(`GPG private key info`, () => __awaiter(this, void 0, void 0, function* () {
core.info(`Fingerprint : ${privateKey.fingerprint}`);
core.info(`KeyID : ${privateKey.keyID}`);
core.info(`Name : ${privateKey.name}`);
core.info(`Email : ${privateKey.email}`);
core.info(`CreationTime : ${privateKey.creationTime}`);
}));
- yield core.group(`๐ Importing GPG private key`, () => __awaiter(this, void 0, void 0, function* () {
+ yield core.group(`Importing GPG private key`, () => __awaiter(this, void 0, void 0, function* () {
yield gpg.importKey(inputs.gpgPrivateKey).then(stdout => {
core.info(stdout);
});
}));
if (inputs.passphrase) {
- core.info('โ๏ธ Configuring GnuPG agent');
+ core.info('Configuring GnuPG agent');
yield gpg.configureAgent(gpg.agentConfig);
- core.info('๐ Getting keygrips');
- yield core.group(`๐ Getting keygrips`, () => __awaiter(this, void 0, void 0, function* () {
+ yield core.group(`Getting keygrips`, () => __awaiter(this, void 0, void 0, function* () {
for (let keygrip of yield gpg.getKeygrips(privateKey.fingerprint)) {
- core.info(`๐ Presetting passphrase for ${keygrip}`);
+ core.info(`Presetting passphrase for ${keygrip}`);
yield gpg.presetPassphrase(keygrip, inputs.passphrase).then(stdout => {
core.debug(stdout);
});
}
}));
}
- core.info('๐ Setting outputs...');
+ core.info('Setting outputs');
context.setOutput('fingerprint', privateKey.fingerprint);
context.setOutput('keyid', privateKey.keyID);
context.setOutput('name', privateKey.name);
context.setOutput('email', privateKey.email);
if (inputs.gitUserSigningkey) {
- core.info('๐ Setting GPG signing keyID for this Git repository');
+ core.info('Setting GPG signing keyID for this Git repository');
yield git.setConfig('user.signingkey', privateKey.keyID, inputs.gitConfigGlobal);
const userEmail = inputs.gitCommitterEmail || privateKey.email;
const userName = inputs.gitCommitterName || privateKey.name;
@@ -443,19 +442,19 @@ function run() {
core.setFailed(`Committer email "${inputs.gitCommitterEmail}" (name: "${inputs.gitCommitterName}") does not match GPG private key email "${privateKey.email}" (name: "${privateKey.name}")`);
return;
}
- core.info(`๐จ Configuring Git committer (${userName} <${userEmail}>)`);
+ core.info(`Configuring Git committer (${userName} <${userEmail}>)`);
yield git.setConfig('user.name', userName, inputs.gitConfigGlobal);
yield git.setConfig('user.email', userEmail, inputs.gitConfigGlobal);
if (inputs.gitCommitGpgsign) {
- core.info('๐ Sign all commits automatically');
+ core.info('Sign all commits automatically');
yield git.setConfig('commit.gpgsign', 'true', inputs.gitConfigGlobal);
}
if (inputs.gitTagGpgsign) {
- core.info('๐ Sign all tags automatically');
+ core.info('Sign all tags automatically');
yield git.setConfig('tag.gpgsign', 'true', inputs.gitConfigGlobal);
}
if (inputs.gitPushGpgsign) {
- core.info('๐ Sign all pushes automatically');
+ core.info('Sign all pushes automatically');
yield git.setConfig('push.gpgsign', inputs.gitPushGpgsign, inputs.gitConfigGlobal);
}
}
@@ -472,10 +471,10 @@ function cleanup() {
return;
}
try {
- core.info('๐ฟ Removing keys');
+ core.info('Removing keys');
const privateKey = yield openpgp.readPrivateKey(stateHelper.gpgPrivateKey);
yield gpg.deleteKey(privateKey.fingerprint);
- core.info('๐ Killing GnuPG agent');
+ core.info('Killing GnuPG agent');
yield gpg.killAgent();
}
catch (error) {
@@ -531,36 +530,36 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.isArmored = exports.generateKeyPair = exports.readPrivateKey = void 0;
-const openpgp = __importStar(__webpack_require__(144));
+const openpgp = __importStar(__webpack_require__(946));
const addressparser_1 = __importDefault(__webpack_require__(764));
exports.readPrivateKey = (key) => __awaiter(void 0, void 0, void 0, function* () {
- const { keys: [privateKey], err: err } = yield openpgp.key.readArmored((yield exports.isArmored(key)) ? key : Buffer.from(key, 'base64').toString());
- if (err === null || err === void 0 ? void 0 : err.length) {
- throw err[0];
- }
+ const privateKey = yield openpgp.readKey({
+ armoredKey: (yield exports.isArmored(key)) ? key : Buffer.from(key, 'base64').toString()
+ });
const address = yield privateKey.getPrimaryUser().then(primaryUser => {
- return addressparser_1.default(primaryUser.user.userId.userid)[0];
+ var _a;
+ return addressparser_1.default((_a = primaryUser.user.userID) === null || _a === void 0 ? void 0 : _a.userID)[0];
});
return {
fingerprint: privateKey.getFingerprint().toUpperCase(),
keyID: yield privateKey.getEncryptionKey().then(encKey => {
// @ts-ignore
- return encKey === null || encKey === void 0 ? void 0 : encKey.getKeyId().toHex().toUpperCase();
+ return encKey === null || encKey === void 0 ? void 0 : encKey.getKeyID().toHex().toUpperCase();
}),
name: address.name,
email: address.address,
creationTime: privateKey.getCreationTime()
};
});
-exports.generateKeyPair = (name, email, passphrase, numBits = 4096) => __awaiter(void 0, void 0, void 0, function* () {
+exports.generateKeyPair = (name, email, passphrase, type) => __awaiter(void 0, void 0, void 0, function* () {
const keyPair = yield openpgp.generateKey({
- userIds: [{ name: name, email: email }],
- numBits,
- passphrase
+ userIDs: [{ name: name, email: email }],
+ passphrase: passphrase,
+ type: type
});
return {
- publicKey: keyPair.publicKeyArmored.replace(/\r\n/g, '\n').trim(),
- privateKey: keyPair.privateKeyArmored.replace(/\r\n/g, '\n').trim()
+ publicKey: keyPair.publicKey.replace(/\r\n/g, '\n').trim(),
+ privateKey: keyPair.privateKey.replace(/\r\n/g, '\n').trim()
};
});
exports.isArmored = (text) => __awaiter(void 0, void 0, void 0, function* () {
@@ -2619,4540 +2618,1907 @@ Tokenizer.prototype.checkChar = function (chr) {
/***/ }),
-/***/ 144:
-/***/ ((module) => {
+/***/ 435:
+/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
-/*! OpenPGP.js v4.10.10 - 2021-01-24 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */
-(function(f){if(true){module.exports=f()}else { var g; }})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=require,i=0;i
- * Heap buffer layout by offset:
- *
- * 0x0000 encryption key schedule
- * 0x0400 decryption key schedule
- * 0x0800 sbox
- * 0x0c00 inv sbox
- * 0x1000 encryption tables
- * 0x2000 decryption tables
- * 0x3000 reserved (future GCM multiplication lookup table)
- * 0x4000 data
- *
- * Don't touch anything before 0x400
.
- *
>3,r-=c,a-=c<<3,n&=(1<=1&&0===P[m];m--);if(g>m&&(g=m),0===m)return n[a++]=20971520,n[a++]=20971520,o.bits=1,0;for(b=1;b =0;i--){for(var u=t.words[i],h=c-1;h>=0;h--){var d=u>>h&1;a!==r[0]&&(a=this.sqr(a)),0!==d||0!==s?(s<<=1,s|=d,(4===++o||0===i&&0===h)&&(a=this.mul(a,r[s]),o=0,s=0)):o=0}c=26}return a},k.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},k.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},n.mont=function(e){return new A(e)},i(A,k),A.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},A.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},A.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),a=n;return n.cmp(this.m)>=0?a=n.isub(this.m):n.cmpn(0)<0&&(a=n.iadd(this.m)),a._forceRed(this)},A.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new n(0)._forceRed(this);var r=e.mul(t),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),a=r.isub(i).iushrn(this.shift),s=a;return a.cmp(this.m)>=0?s=a.isub(this.m):a.cmpn(0)<0&&(s=a.iadd(this.m)),s._forceRed(this)},A.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,pt)})),Pf=/*#__PURE__*/Object.freeze({__proto__:null,default:Ef,__moduleExports:Ef});class xf{constructor(e){if(void 0===e)throw Error("Invalid BigInteger input");this.value=new Ef(e)}clone(){const e=new xf(null);return this.value.copy(e.value),e}iinc(){return this.value.iadd(new Ef(1)),this}inc(){return this.clone().iinc()}idec(){return this.value.isub(new Ef(1)),this}dec(){return this.clone().idec()}iadd(e){return this.value.iadd(e.value),this}add(e){return this.clone().iadd(e)}isub(e){return this.value.isub(e.value),this}sub(e){return this.clone().isub(e)}imul(e){return this.value.imul(e.value),this}mul(e){return this.clone().imul(e)}imod(e){return this.value=this.value.umod(e.value),this}mod(e){return this.clone().imod(e)}modExp(e,t){const r=t.isEven()?Ef.red(t.value):Ef.mont(t.value),i=this.clone();return i.value=i.value.toRed(r).redPow(e.value).fromRed(),i}modInv(e){if(!this.gcd(e).isOne())throw Error("Inverse does not exist");return new xf(this.value.invm(e.value))}gcd(e){return new xf(this.value.gcd(e.value))}ileftShift(e){return this.value.ishln(e.value.toNumber()),this}leftShift(e){return this.clone().ileftShift(e)}irightShift(e){return this.value.ishrn(e.value.toNumber()),this}rightShift(e){return this.clone().irightShift(e)}equal(e){return this.value.eq(e.value)}lt(e){return this.value.lt(e.value)}lte(e){return this.value.lte(e.value)}gt(e){return this.value.gt(e.value)}gte(e){return this.value.gte(e.value)}isZero(){return this.value.isZero()}isOne(){return this.value.eq(new Ef(1))}isNegative(){return this.value.isNeg()}isEven(){return this.value.isEven()}abs(){const e=this.clone();return e.value=e.value.abs(),e}toString(){return this.value.toString()}toNumber(){return this.value.toNumber()}getBit(e){return this.value.testn(e)?1:0}bitLength(){return this.value.bitLength()}byteLength(){return this.value.byteLength()}toUint8Array(e="be",t){return this.value.toArrayLike(Uint8Array,e,t)}}var Mf,Cf=/*#__PURE__*/Object.freeze({__proto__:null,default:xf}),Kf=yt((function(e,t){var r=t;function i(e){return 1===e.length?"0"+e:e}function n(e){for(var t="",r=0;rn.bindingSignatures[t].created&&(n.bindingSignatures[t]=e),!1;try{return await e.verify(i,be.signature.subkeyBinding,a,t,void 0,r),!0}catch(e){return!1}})),await jo(e,this,"revocationSignatures",t,(function(e){return Lo(i,be.signature.subkeyRevocation,a,[e],void 0,void 0,t,r)}))}async revoke(e,{flag:t=be.reasonForRevocation.noReason,string:r=""}={},i=new Date,n=me){const a={key:e,bind:this.keyPacket},s=new Xo(this.keyPacket,this.mainKey);return s.revocationSignatures.push(await No(a,null,e,{signatureType:be.signature.subkeyRevocation,reasonForRevocationFlag:be.write(be.reasonForRevocation,t),reasonForRevocationString:r},i,void 0,!1,n)),await s.update(this),s}hasSameFingerprintAs(e){return this.keyPacket.hasSameFingerprintAs(e.keyPacket||e)}}["getKeyID","getFingerprint","getAlgorithmInfo","getCreationTime","isDecrypted"].forEach((e=>{Xo.prototype[e]=function(){return this.keyPacket[e]()}}));const Qo=/*#__PURE__*/oe.constructAllowedPackets([eo]);class Jo{packetListToStructure(e,t=new Set){let r,i,n;for(const a of e){const e=a.constructor.tag;if(t.has(e))throw Error("Unexpected packet type: "+e);switch(e){case be.packet.publicKey:case be.packet.secretKey:if(this.keyPacket)throw Error("Key block contains multiple keys");if(this.keyPacket=a,i=this.getKeyID(),!i)throw Error("Missing Key ID");break;case be.packet.userID:case be.packet.userAttribute:r=new Yo(a,this),this.users.push(r);break;case be.packet.publicSubkey:case be.packet.secretSubkey:r=null,n=new Xo(a,this),this.subkeys.push(n);break;case be.packet.signature:switch(a.signatureType){case be.signature.certGeneric:case be.signature.certPersona:case be.signature.certCasual:case be.signature.certPositive:if(!r){oe.printDebug("Dropping certification signatures without preceding user packet");continue}a.issuerKeyID.equals(i)?r.selfCertifications.push(a):r.otherCertifications.push(a);break;case be.signature.certRevocation:r?r.revocationSignatures.push(a):this.directSignatures.push(a);break;case be.signature.key:this.directSignatures.push(a);break;case be.signature.subkeyBinding:if(!n){oe.printDebug("Dropping subkey binding signature without preceding subkey packet");continue}n.bindingSignatures.push(a);break;case be.signature.keyRevocation:this.revocationSignatures.push(a);break;case be.signature.subkeyRevocation:if(!n){oe.printDebug("Dropping subkey revocation signature without preceding subkey packet");continue}n.revocationSignatures.push(a)}}}}toPacketList(){const e=new no;return e.push(this.keyPacket),e.push(...this.revocationSignatures),e.push(...this.directSignatures),this.users.map((t=>e.push(...t.toPacketList()))),this.subkeys.map((t=>e.push(...t.toPacketList()))),e}clone(e=!1){const t=new this.constructor(this.toPacketList());return e&&t.getKeys().forEach((e=>{if(e.keyPacket=Object.create(Object.getPrototypeOf(e.keyPacket),Object.getOwnPropertyDescriptors(e.keyPacket)),!e.keyPacket.isDecrypted())return;const t={};Object.keys(e.keyPacket.privateParams).forEach((r=>{t[r]=new Uint8Array(e.keyPacket.privateParams[r])})),e.keyPacket.privateParams=t})),t}getSubkeys(e=null){return this.subkeys.filter((t=>!e||t.getKeyID().equals(e,!0)))}getKeys(e=null){const t=[];return e&&!this.getKeyID().equals(e,!0)||t.push(this),t.concat(this.getSubkeys(e))}getKeyIDs(){return this.getKeys().map((e=>e.getKeyID()))}getUserIDs(){return this.users.map((e=>e.userID?e.userID.userID:null)).filter((e=>null!==e))}write(){return this.toPacketList().write()}async getSigningKey(e=null,t=new Date,r={},i=me){await this.verifyPrimaryKey(t,r,i);const n=this.keyPacket,a=this.subkeys.slice().sort(((e,t)=>t.keyPacket.created-e.keyPacket.created));let s;for(const r of a)if(!e||r.getKeyID().equals(e))try{await r.verify(t,i);const e={key:n,bind:r.keyPacket},a=await To(r.bindingSignatures,n,be.signature.subkeyBinding,e,t,i);if(!Go(r.keyPacket,a))continue;if(!a.embeddedSignature)throw Error("Missing embedded signature");return await To([a.embeddedSignature],r.keyPacket,be.signature.keyBinding,e,t,i),Zo(r.keyPacket,i),r}catch(e){s=e}try{const a=await this.getPrimaryUser(t,r,i);if((!e||n.getKeyID().equals(e))&&Go(n,a.selfCertification))return Zo(n,i),this}catch(e){s=e}throw oe.wrapError("Could not find valid signing key packet in key "+this.getKeyID().toHex(),s)}async getEncryptionKey(e,t=new Date,r={},i=me){await this.verifyPrimaryKey(t,r,i);const n=this.keyPacket,a=this.subkeys.slice().sort(((e,t)=>t.keyPacket.created-e.keyPacket.created));let s;for(const r of a)if(!e||r.getKeyID().equals(e))try{await r.verify(t,i);const e={key:n,bind:r.keyPacket},a=await To(r.bindingSignatures,n,be.signature.subkeyBinding,e,t,i);if(Vo(r.keyPacket,a))return Zo(r.keyPacket,i),r}catch(e){s=e}try{const a=await this.getPrimaryUser(t,r,i);if((!e||n.getKeyID().equals(e))&&Vo(n,a.selfCertification))return Zo(n,i),this}catch(e){s=e}throw oe.wrapError("Could not find valid encryption key packet in key "+this.getKeyID().toHex(),s)}async isRevoked(e,t,r=new Date,i=me){return Lo(this.keyPacket,be.signature.keyRevocation,{key:this.keyPacket},this.revocationSignatures,e,t,r,i)}async verifyPrimaryKey(e=new Date,t={},r=me){const i=this.keyPacket;if(await this.isRevoked(null,null,e,r))throw Error("Primary key is revoked");const{selfCertification:n}=await this.getPrimaryUser(e,t,r);if(zo(i,n,e))throw Error("Primary key is expired");const a=await To(this.directSignatures,i,be.signature.key,{key:i},e,r).catch((()=>{}));if(a&&zo(i,a,e))throw Error("Primary key is expired")}async getExpirationTime(e,t=me){let r;try{const{selfCertification:i}=await this.getPrimaryUser(null,e,t),n=Wo(this.keyPacket,i),a=i.getExpirationTime(),s=await To(this.directSignatures,this.keyPacket,be.signature.key,{key:this.keyPacket},null,t).catch((()=>{}));if(s){const e=Wo(this.keyPacket,s);r=Math.min(n,a,e)}else r=ne.subkeys.some((e=>t.hasSameFingerprintAs(e)))))))throw Error("Cannot update public key with private key if subkeys mismatch");return e.update(this,r)}const i=this.clone();return await jo(e,i,"revocationSignatures",t,(n=>Lo(i.keyPacket,be.signature.keyRevocation,i,[n],null,e.keyPacket,t,r))),await jo(e,i,"directSignatures",t),await Promise.all(e.users.map((async e=>{const n=i.users.filter((t=>e.userID&&e.userID.equals(t.userID)||e.userAttribute&&e.userAttribute.equals(t.userAttribute)));if(n.length>0)await Promise.all(n.map((i=>i.update(e,t,r))));else{const t=e.clone();t.mainKey=i,i.users.push(t)}}))),await Promise.all(e.subkeys.map((async e=>{const n=i.subkeys.filter((t=>t.hasSameFingerprintAs(e)));if(n.length>0)await Promise.all(n.map((i=>i.update(e,t,r))));else{const t=e.clone();t.mainKey=i,i.subkeys.push(t)}}))),i}async getRevocationCertificate(e=new Date,t=me){const r={key:this.keyPacket},i=await To(this.revocationSignatures,this.keyPacket,be.signature.keyRevocation,r,e,t),n=new no;return n.push(i),Pe(be.armor.publicKey,n.write(),null,null,"This is a revocation certificate")}async applyRevocationCertificate(e,t=new Date,r=me){const i=await Ee(e,r),n=(await no.fromBinary(i.data,Qo,r)).findPacket(be.packet.signature);if(!n||n.signatureType!==be.signature.keyRevocation)throw Error("Could not find revocation signature packet");if(!n.issuerKeyID.equals(this.getKeyID()))throw Error("Revocation signature does not match key");try{await n.verify(this.keyPacket,be.signature.keyRevocation,{key:this.keyPacket},t,void 0,r)}catch(e){throw oe.wrapError("Could not verify revocation signature",e)}const a=this.clone();return a.revocationSignatures.push(n),a}async signPrimaryUser(e,t,r,i=me){const{index:n,user:a}=await this.getPrimaryUser(t,r,i),s=await a.certify(e,t,i),o=this.clone();return o.users[n]=s,o}async signAllUsers(e,t=new Date,r=me){const i=this.clone();return i.users=await Promise.all(this.users.map((function(i){return i.certify(e,t,r)}))),i}async verifyPrimaryUser(e,t=new Date,r,i=me){const n=this.keyPacket,{user:a}=await this.getPrimaryUser(t,r,i);return e?await a.verifyAllCertifications(e,t,i):[{keyID:n.getKeyID(),valid:await a.verify(t,i).catch((()=>!1))}]}async verifyAllUsers(e,t=new Date,r=me){const i=this.keyPacket,n=[];return await Promise.all(this.users.map((async a=>{const s=e?await a.verifyAllCertifications(e,t,r):[{keyID:i.getKeyID(),valid:await a.verify(t,r).catch((()=>!1))}];n.push(...s.map((e=>({userID:a.userID.userID,keyID:e.keyID,valid:e.valid}))))}))),n}}function ec(e){for(const t of e)switch(t.constructor.tag){case be.packet.secretKey:return new rc(e);case be.packet.publicKey:return new tc(e)}throw Error("No key packet found")}["getKeyID","getFingerprint","getAlgorithmInfo","getCreationTime","hasSameFingerprintAs"].forEach((e=>{Jo.prototype[e]=Xo.prototype[e]}));class tc extends Jo{constructor(e){if(super(),this.keyPacket=null,this.revocationSignatures=[],this.directSignatures=[],this.users=[],this.subkeys=[],e&&(this.packetListToStructure(e,new Set([be.packet.secretKey,be.packet.secretSubkey])),!this.keyPacket))throw Error("Invalid key: missing public-key packet")}isPrivate(){return!1}toPublic(){return this}armor(e=me){return Pe(be.armor.publicKey,this.toPacketList().write(),void 0,void 0,void 0,e)}}class rc extends tc{constructor(e){if(super(),this.packetListToStructure(e,new Set([be.packet.publicKey,be.packet.publicSubkey])),!this.keyPacket)throw Error("Invalid key: missing private-key packet")}isPrivate(){return!0}toPublic(){const e=new no,t=this.toPacketList();for(const r of t)switch(r.constructor.tag){case be.packet.secretKey:{const t=ko.fromSecretKeyPacket(r);e.push(t);break}case be.packet.secretSubkey:{const t=Eo.fromSecretSubkeyPacket(r);e.push(t);break}default:e.push(r)}return new tc(e)}armor(e=me){return Pe(be.armor.privateKey,this.toPacketList().write(),void 0,void 0,void 0,e)}async getDecryptionKeys(e,t=new Date,r={},i=me){const n=this.keyPacket,a=[];for(let r=0;r