From a1600c1f88a7741e2420b0a657f2838cec4f09c5 Mon Sep 17 00:00:00 2001 From: BJ Hargrave Date: Mon, 13 Sep 2021 17:58:55 -0400 Subject: [PATCH] cleanup: Use --delete-secret-and-public-key to delete GPG_PRIVATE_KEY This deletes the secret key(s) and public keys(s) for the fingerprint of the installed GPG_PRIVATE_KEY. If the installed GPG_PRIVATE_KEY only contains a signing subkey without the primary private key, the --delete-secret-and-public-key will successfully delete the keys. Signed-off-by: BJ Hargrave --- dist/cleanup/index.js | 3 +-- dist/setup/index.js | 3 +-- src/gpg.ts | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/dist/cleanup/index.js b/dist/cleanup/index.js index 4c6688d38..f9b10006e 100644 --- a/dist/cleanup/index.js +++ b/dist/cleanup/index.js @@ -63237,10 +63237,9 @@ function importKey(privateKey) { exports.importKey = importKey; function deleteKey(keyFingerprint) { return __awaiter(this, void 0, void 0, function* () { - yield exec.exec('gpg', ['--batch', '--yes', '--delete-secret-keys', keyFingerprint], { + yield exec.exec('gpg', ['--batch', '--yes', '--delete-secret-and-public-key', keyFingerprint], { silent: true }); - yield exec.exec('gpg', ['--batch', '--yes', '--delete-keys', keyFingerprint], { silent: true }); }); } exports.deleteKey = deleteKey; diff --git a/dist/setup/index.js b/dist/setup/index.js index 2d437f83e..ae1012a01 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -94689,10 +94689,9 @@ function importKey(privateKey) { exports.importKey = importKey; function deleteKey(keyFingerprint) { return __awaiter(this, void 0, void 0, function* () { - yield exec.exec('gpg', ['--batch', '--yes', '--delete-secret-keys', keyFingerprint], { + yield exec.exec('gpg', ['--batch', '--yes', '--delete-secret-and-public-key', keyFingerprint], { silent: true }); - yield exec.exec('gpg', ['--batch', '--yes', '--delete-keys', keyFingerprint], { silent: true }); }); } exports.deleteKey = deleteKey; diff --git a/src/gpg.ts b/src/gpg.ts index 10c203348..82fd22ffe 100644 --- a/src/gpg.ts +++ b/src/gpg.ts @@ -39,8 +39,7 @@ export async function importKey(privateKey: string) { } export async function deleteKey(keyFingerprint: string) { - await exec.exec('gpg', ['--batch', '--yes', '--delete-secret-keys', keyFingerprint], { + await exec.exec('gpg', ['--batch', '--yes', '--delete-secret-and-public-key', keyFingerprint], { silent: true }); - await exec.exec('gpg', ['--batch', '--yes', '--delete-keys', keyFingerprint], { silent: true }); }