Repository navigation
Conversation
Calling it on each token request lets the secret be fetched on demand, e.g. from auth-source, instead of being stored in the init file. A plain string behaves exactly as before.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The README recommends storing the client secret with auth-source. That is already possible by looking it up when the init file is evaluated:
but doing it eagerly means an encrypted authinfo file is decrypted at startup — a GPG passphrase prompt in every session, whether or not TickTick is used that session — and the plaintext secret then sits in a variable for as long as Emacs runs.
This allows
ticktick-client-secretto also be a function of no arguments, deferring the lookup to the moment a token is actually requested:It is called at authorization and on token refresh, so nothing is decrypted until it is needed.
Notes:
ticktick--client-secret, resolves the value. All three read sites go through it:ticktick--authorization-header,ticktick-debug-oauth, and the guard inticktick-authorize.stringpconjunct in that guard had to be dropped rather than wrapped, since it is what rejected a function value outright. Thestring-empty-pcheck on the resolved value still covers both the unset and the failed-lookup cases.""when the function yields nil (e.g. an auth-source miss), so a miss gives the existing "must be set"user-errorrather than awrong-type-argumentcrash.Verified with
emacs -Q --batch: byte-compiles and passes checkdoc with no new warnings, and the string and function forms produce identicalAuthorizationheaders.