From fbb12f9a62d1afd1a72354e6dcc11e3fdd999c17 Mon Sep 17 00:00:00 2001 From: snowiow Date: Fri, 21 Nov 2025 16:32:16 +0100 Subject: [PATCH] add auth source pass option --- org-readwise.el | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/org-readwise.el b/org-readwise.el index fdb27fc..a412bfc 100644 --- a/org-readwise.el +++ b/org-readwise.el @@ -70,6 +70,14 @@ :group 'org-readwise :type 'integer) +(defcustom org-readwise-auth-source 'auth-source + "Authentication source to use for retrieving the Readwise API token. +'auth-source - Use standard auth-source (default). +'auth-source-pass - Use auth-source-pass (pass/password-store)." + :group 'org-readwise + :type '(choice (const :tag "Standard auth-source (default)" auth-source) + (const :tag "Password Store (pass)" auth-source-pass))) + (defvar org-readwise-last-sync-time nil "The timestamp of the last successful sync.") @@ -97,7 +105,11 @@ MESSAGE is the format string, and ARGS are the arguments for the format string." This function expects the token to be present in one of the files defined in `auth-sources`. If it is not present, it will prompt the user for their access token. It returns a list containing the token and a save function." - (let ((found (nth 0 (auth-source-search :host "readwise.io")))) + (let ((found (if (eq org-readwise-auth-source 'auth-source-pass) + (progn + (require 'auth-source-pass) + (car (auth-source-pass-search :host "readwise.io"))) + (nth 0 (auth-source-search :host "readwise.io"))))) (if found (list (let ((secret (plist-get found :secret))) (if (functionp secret)