emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/openpgp 75cc1e133f 07/30: Added and renamed opengpg-upl


From: ELPA Syncer
Subject: [elpa] externals/openpgp 75cc1e133f 07/30: Added and renamed opengpg-upload-key
Date: Sun, 26 Mar 2023 10:59:26 -0400 (EDT)

branch: externals/openpgp
commit 75cc1e133ff1e27bc2e97991e80f4cf45b07f25e
Author: Philip Kaludercic <philip.kaludercic@fau.de>
Commit: Philip Kaludercic <philip.kaludercic@fau.de>

    Added and renamed opengpg-upload-key
---
 openpgp.el | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/openpgp.el b/openpgp.el
index 4490240923..b730c499e1 100644
--- a/openpgp.el
+++ b/openpgp.el
@@ -1,4 +1,4 @@
-;;; $Id: openpgp.el,v 1.5 2020/03/04 15:42:07 oj14ozun Exp oj14ozun $
+;;; $Id: openpgp.el,v 1.6 2020/03/04 18:01:30 oj14ozun Exp oj14ozun $
 ;;; Implementation of the keys.openpgp.org protocol as specified by
 ;;; https://keys.openpgp.org/about/api
 
@@ -84,7 +84,7 @@ TOKEN should be supplied by a previous \"upload-key\" 
request."
       (error "Error in response: %s" (cdr (assq 'error data))))
     (openpgp-request-verify email (cdr (assq 'token data)))))
 
-(defun openpgp-upload-key (email key)
+(defun openpgp-upload-key-string (email key)
   "Upload KEY for address EMAIL to keyserver.
 
 The KEY should be a string, containing a ASCII armoured public
@@ -98,11 +98,21 @@ key."
 
 (defun openpgp-upload-key-file (email key-file)
   "Upload key from KEY-FILE for address EMAIL."
-  (interactive (list (read-string "Email: ")
+  (interactive (list (read-string "Email: " nil nil user-mail-address)
                     (read-file-name "Key file: ")))
   (with-temp-buffer
     (insert-file-contents key-file)
-    (openpgp-upload-key email (buffer-string))))
+    (openpgp-upload-key-string email (buffer-string))))
+
+(defun openpgp-upload-key (email)
+  "Upload public key for address EMAIL using gpg."
+  (interactive (list (read-string (format "Email (default: %s): "
+                                         user-mail-address)
+                                 nil nil user-mail-address)))
+  (let* ((addr (shell-quote-argument email))
+        (cmd (format "gpg --armor --export %s" addr))
+        (out (shell-command-to-string cmd)))
+    (openpgp-upload-key-string email out)))
 
  ;; MAIL CLIENT SUPPORT
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]