aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-23 19:05:01 -0500
committerCraig Jennings <c@cjennings.net>2026-05-23 19:05:01 -0500
commitfcac4e94c7dd858e7d8604afb3e10e731bf1c8b7 (patch)
tree11cb3006702f0dad43d76744c1bebcbab7561490 /modules
parentb70781e8eeaa67cf2a1aa804c27b92f38fd52742 (diff)
downloaddotemacs-fcac4e94c7dd858e7d8604afb3e10e731bf1c8b7.tar.gz
dotemacs-fcac4e94c7dd858e7d8604afb3e10e731bf1c8b7.zip
refactor(restclient): remove SkyFi key-injection feature
cj/restclient-skyfi-buffer opened the SkyFi template in a file-visiting buffer and rewrote the :skyfi-key line with the live key from authinfo. An accidental save would then persist the plaintext key to disk, which breaks the module's own "key never stored on disk" promise. The template file was gitignored and never tracked, so the exposure was local only, not a repo leak. I removed the feature rather than hardening it: cj/skyfi-api-key, cj/restclient--inject-skyfi-key, cj/restclient-skyfi-buffer, the C-; R s binding, and the two SkyFi test files are gone, along with the local template. The generic restclient setup stays: scratch buffer on C-; R n, open a .rest file on C-; R o.
Diffstat (limited to 'modules')
-rw-r--r--modules/restclient-config.el41
1 files changed, 1 insertions, 40 deletions
diff --git a/modules/restclient-config.el b/modules/restclient-config.el
index 650bb781..6d38739d 100644
--- a/modules/restclient-config.el
+++ b/modules/restclient-config.el
@@ -8,13 +8,9 @@
;; results inline. Supports .rest files with variable substitution for
;; reusable API templates.
;;
-;; Includes SkyFi satellite imagery API integration with automatic key
-;; injection from authinfo.gpg (key never stored on disk).
-;;
;; Keybindings (C-; R prefix):
;; - C-; R n : New scratch *restclient* buffer
;; - C-; R o : Open a .rest file (defaults to data/)
-;; - C-; R s : Open SkyFi API template
;;; Code:
@@ -35,31 +31,8 @@
:if (executable-find "jq")
:after restclient)
-;; ----------------------------- Private Helpers -------------------------------
-
-(defun cj/restclient--inject-skyfi-key ()
- "Replace the :skyfi-key variable line with the real key from authinfo.
-Only acts when the buffer is in `restclient-mode', the filename ends
-in \"skyfi-api.rest\", and a :skyfi-key line exists. If the auth
-lookup returns nil, leaves the buffer unchanged."
- (when (and (derived-mode-p 'restclient-mode)
- buffer-file-name
- (string-match-p "skyfi-api\\.rest\\'" buffer-file-name))
- (let ((key (condition-case nil
- (cj/skyfi-api-key)
- (error nil))))
- (when key
- (save-excursion
- (goto-char (point-min))
- (when (re-search-forward "^:skyfi-key = .*$" nil t)
- (replace-match (format ":skyfi-key = %s" key))))))))
-
;; ----------------------------- Public Functions ------------------------------
-(defun cj/skyfi-api-key ()
- "Fetch SkyFi API key from authinfo.gpg."
- (cj/auth-source-secret "app.skyfi.com" "apikey"))
-
(defun cj/restclient-new-buffer ()
"Open a scratch *restclient* buffer in `restclient-mode'."
(interactive)
@@ -77,28 +50,16 @@ lookup returns nil, leaves the buffer unchanged."
(string-match-p "\\.rest\\'" f))))))
(find-file file)))
-(defun cj/restclient-skyfi-buffer ()
- "Open the SkyFi API template file.
-Runs the key-injection hook after opening."
- (interactive)
- (let ((skyfi-file (expand-file-name "skyfi-api.rest" cj/restclient-data-dir)))
- (unless (file-exists-p skyfi-file)
- (user-error "SkyFi template not found: %s" skyfi-file))
- (find-file skyfi-file)
- (cj/restclient--inject-skyfi-key)))
-
;; -------------------------------- Keybindings --------------------------------
(global-set-key (kbd "C-; R n") #'cj/restclient-new-buffer)
(global-set-key (kbd "C-; R o") #'cj/restclient-open-file)
-(global-set-key (kbd "C-; R s") #'cj/restclient-skyfi-buffer)
(with-eval-after-load 'which-key
(which-key-add-key-based-replacements
"C-; R" "REST client"
"C-; R n" "new scratch buffer"
- "C-; R o" "open .rest file"
- "C-; R s" "SkyFi API template"))
+ "C-; R o" "open .rest file"))
(provide 'restclient-config)
;;; restclient-config.el ends here