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

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

[elpa] externals/llm 315aace3be: Add support for auth-source secret func


From: ELPA Syncer
Subject: [elpa] externals/llm 315aace3be: Add support for auth-source secret functions to :key argument (#111)
Date: Thu, 28 Nov 2024 15:58:52 -0500 (EST)

branch: externals/llm
commit 315aace3be1ccf1b239bcf6190a243eb782aa93a
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: GitHub <noreply@github.com>

    Add support for auth-source secret functions to :key argument (#111)
    
    Partially implements #110
---
 llm-openai.el | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/llm-openai.el b/llm-openai.el
index 2ddcaec2d4..7d9d3555d7 100644
--- a/llm-openai.el
+++ b/llm-openai.el
@@ -111,6 +111,10 @@ PROVIDER is the Open AI provider struct."
 
 (cl-defmethod llm-openai--headers ((provider llm-openai))
   (when-let ((key (llm-openai-key provider)))
+    ;; If the key is a function, call it.  The `auth-source' API uses functions
+    ;; to wrap secrets and to obfuscate them in the Emacs heap.
+    (when (functionp key)
+      (setq key (funcall key)))
     ;; Encode the API key to ensure it is unibyte.  The request library gets
     ;; confused by multibyte headers, which turn the entire body multibyte if
     ;; there’s a non-ascii character, regardless of encoding.  And API keys are



reply via email to

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