Skip to content

Commit d34438b

Browse files
authored
cleanup: Use --delete-secret-and-public-key to delete GPG_PRIVATE_KEY (#226)
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 <[email protected]>
1 parent 61c179a commit d34438b

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

dist/cleanup/index.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -63237,10 +63237,9 @@ function importKey(privateKey) {
6323763237
exports.importKey = importKey;
6323863238
function deleteKey(keyFingerprint) {
6323963239
return __awaiter(this, void 0, void 0, function* () {
63240-
yield exec.exec('gpg', ['--batch', '--yes', '--delete-secret-keys', keyFingerprint], {
63240+
yield exec.exec('gpg', ['--batch', '--yes', '--delete-secret-and-public-key', keyFingerprint], {
6324163241
silent: true
6324263242
});
63243-
yield exec.exec('gpg', ['--batch', '--yes', '--delete-keys', keyFingerprint], { silent: true });
6324463243
});
6324563244
}
6324663245
exports.deleteKey = deleteKey;

dist/setup/index.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -94689,10 +94689,9 @@ function importKey(privateKey) {
9468994689
exports.importKey = importKey;
9469094690
function deleteKey(keyFingerprint) {
9469194691
return __awaiter(this, void 0, void 0, function* () {
94692-
yield exec.exec('gpg', ['--batch', '--yes', '--delete-secret-keys', keyFingerprint], {
94692+
yield exec.exec('gpg', ['--batch', '--yes', '--delete-secret-and-public-key', keyFingerprint], {
9469394693
silent: true
9469494694
});
94695-
yield exec.exec('gpg', ['--batch', '--yes', '--delete-keys', keyFingerprint], { silent: true });
9469694695
});
9469794696
}
9469894697
exports.deleteKey = deleteKey;

src/gpg.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ export async function importKey(privateKey: string) {
3939
}
4040

4141
export async function deleteKey(keyFingerprint: string) {
42-
await exec.exec('gpg', ['--batch', '--yes', '--delete-secret-keys', keyFingerprint], {
42+
await exec.exec('gpg', ['--batch', '--yes', '--delete-secret-and-public-key', keyFingerprint], {
4343
silent: true
4444
});
45-
await exec.exec('gpg', ['--batch', '--yes', '--delete-keys', keyFingerprint], { silent: true });
4645
}

0 commit comments

Comments
 (0)