[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Refactor elpa/oauth2.el to use plist over cl-defstruct
From: |
Soham Gumaste |
Subject: |
Re: Refactor elpa/oauth2.el to use plist over cl-defstruct |
Date: |
Sun, 19 Jan 2025 16:39:01 -0600 |
User-agent: |
Mozilla Thunderbird |
Hello,
Thanks for taking the time to reply!
I think this will break clients using the current interface of oauth2.el
(including one of my small hack to use oauth2 for email authentication).
Is there any functionalities that are missing and requiring such a
breaking change?
Yes, and that is my biggest concern too.
Agreed. ISTR the recent discussion on cl-lib, which AIUI was about
preloaded ELisp. The other majority of code is not bound by this
requirement, and cl-lib does make some tasks easier. (But please do
correct me.)
In this case, since `plstore` is used to store the information, it would
make it much easier to use a plist as it could be stored and retrieved
as-is, instead of having to convert between struct<-->plist every time.
Ditto. Do you have a proof-of-concept patch to look at?
I was writing the patch when I realised this change would make it
easier, which is why I asked. My idea is to store a (lambda) function as
the :secret attribute in the plstore, so that `auth-info-password` would
invoke it when the secret is requested, resulting in a refresh if
needed. I also want to add other parameters to the plstore entry like
:host, :port and :user.
Secondly, another breaking change I want to propose is renaming the
default plstore file from `oauth.plstore` to `oauth.plist`, as the
auth-sources library uses the `.plist` extension to trigger the plstore
backend instead of the netrc backend (this is not documented directly, I
read the source code).
I will report back in this thread with a proof of concept soon, with the
current cl-defstruct implementation. We can discuss further based on that.
Thanks
Re: Refactor elpa/oauth2.el to use plist over cl-defstruct, Adam Porter, 2025/01/25