Skip to content

Commit

Permalink
cleanup: Use --delete-secret-and-public-key to delete GPG_PRIVATE_KEY
Browse files Browse the repository at this point in the history
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 <bj@hargrave.dev>
  • Loading branch information
bjhargrave committed Sep 13, 2021
1 parent 68c162b commit 1693197
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/gpg.ts
Expand Up @@ -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 });
}

0 comments on commit 1693197

Please sign in to comment.