diff --git a/cli/githubUtils.ts b/cli/githubUtils.ts index a4bdd20..8429c82 100644 --- a/cli/githubUtils.ts +++ b/cli/githubUtils.ts @@ -169,21 +169,28 @@ export async function addGitHubKey( // Generate key name const keyName = customName || `github:${sanitizedUsername}`; + // Map the PGP key info to GitHub key format + // importPgpKey returns keyId, but we use it as fingerprint for GitHub keys + const githubKeyInfo = { + fingerprint: keyInfo.keyId, + email: keyInfo.email ?? undefined + }; + // Add to key manager - await addGitHubKeyToManager(keyName, sanitizedUsername, keyInfo, gpgKeyData); + await addGitHubKeyToManager(keyName, sanitizedUsername, githubKeyInfo, gpgKeyData); if (!silent) { console.log(`✓ GitHub key added: ${keyName}`); - console.log(` Fingerprint: ${keyInfo.fingerprint}`); - if (keyInfo.email) { - console.log(` Email: ${keyInfo.email}`); + console.log(` Fingerprint: ${githubKeyInfo.fingerprint}`); + if (githubKeyInfo.email) { + console.log(` Email: ${githubKeyInfo.email}`); } } return { name: keyName, - fingerprint: keyInfo.fingerprint, - email: keyInfo.email + fingerprint: githubKeyInfo.fingerprint, + email: githubKeyInfo.email }; } diff --git a/cli/index.ts b/cli/index.ts index a87f5f2..b22d3a5 100644 --- a/cli/index.ts +++ b/cli/index.ts @@ -125,6 +125,8 @@ interface KeysOptions { nativePgp?: boolean; keybase?: string; keybaseName?: string; + github?: string; + githubName?: string; verify?: boolean; verbose?: boolean; debug?: boolean; diff --git a/cli/unifiedKeyManager.ts b/cli/unifiedKeyManager.ts index fb28d04..af743ee 100644 --- a/cli/unifiedKeyManager.ts +++ b/cli/unifiedKeyManager.ts @@ -65,7 +65,7 @@ export interface ExecResult { } export interface ImportOptions { - source: 'file' | 'pgp-server' | 'keybase' | 'gpg-import' | 'gpg-keyring'; + source: 'file' | 'pgp-server' | 'keybase' | 'github' | 'gpg-import' | 'gpg-keyring'; content?: string; name?: string; file?: string; diff --git a/package-lock.json b/package-lock.json index 68cde03..5cbb027 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "dedpaste", - "version": "1.19.1", + "version": "1.20.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "dedpaste", - "version": "1.19.1", + "version": "1.20.0", "hasInstallScript": true, "license": "ISC", "dependencies": {