-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for age encryption via age.el #442
base: master
Are you sure you want to change the base?
Conversation
- require age.el if the package is installed https://github.com/anticomputer/age.el - add new customizable variable `org-journal-encryption-extension` to control the file extension appended to the file name to trigger transparent encryption - recognize `.age` files as journal files - generate encrypted files based on chosen file extension instead of hard coding `.gpg` - support `.age` files in `org-journal-re-encrypt-journals` - only re-encrypt files for the currently chosen encryption extension - functional change: don't edit/re-save files that aren't encrypted. I assume that they where handled by this function in the past was an oversight and not intended. - allow multiple recipients for `age` encryption closes bastibe#441
@rosstimson Can you please test if this is working for you? |
@fapdash Thanks for your work here. I don't think it is encrypting the file properly. My relevant config looks like: (use-package age
:mode ("\\.age\\'" . age-encryption-mode)
:custom
(age-default-identity (expand-file-name ".age/rosstimson.txt" (getenv "HOME")))
;; My public age key
(age-default-recipient "age17ll5hultu5gpye40nlj7z7ktcxl8ne9xvtd6udzugkmwlmt83uns82smww")
:config
(age-file-enable))
(use-package org-journal
:after org
:bind ("C-c j" . org-journal-new-entry)
:custom
(org-journal-file-type 'monthly)
(org-journal-date-format "%A, %d %B %Y")
(org-journal-encrypt-journal t)
(org-journal-encryption-extension "age")
(org-journal-dir (concat (concat org-directory "/journal/") (format-time-string "%Y")))) If I create a test file of I then shifted my existing gpg encrypted journal files into a backup dir and used I've rebuilt the org-journal package with your branch and restarted emacs of course, if I enter the customize stuff I can see your newly added |
@rosstimson Mh, I can't reproduce this.. 🤷 Can you please check if |
@fapdash Not sure why it was a problem but you were correct, simply removing the line I can now confirm that this works as expected. Thanks again for your work here. 🎉 |
This way the function `org-journal-re-encrypt-journal` will work with `age` even if `age` has been installed after `org-journal` has been loaded.
org-journal-encryption-extension
to control the file extension appended to the file name to trigger transparent encryption.age
files as journal files.gpg
.age
files inorg-journal-re-encrypt-journals
- only re-encrypt files for the currently chosen encryption extension - functional change: don't edit/re-save files that aren't encrypted. I assume that they where handled by this function in the past was an oversight and not intended. - allow multiple recipients forage
encryptioncloses #441
age encyrption works with this change.
TODOs from age encrypted journal files get added to the agenda. (
org-journal-enable-agenda-integration
)I wasn't sure how to do optional dependencies for Emacs packages.
If someone tries to set
age
as extension theorg-journal-re-encrypt-journals
function will fail because of missing functions, of course.
org-journal-re-encrypt-journals
works for me ifage-default-recipient
andage-default-identity
are set,but things got a bit weird when I hadn't set those.
I might be missing some settings, but at some point age encryption wasn't working at all and I had to restart Emacs.
Theoretically org-journal would work with any encryption that implements transparent, as long as the
org-journal--list-files
andorg-journal--dir-and-file-format->pattern
would get consider the value oforg-journal-encryption-extension
in their regexes. If we don't want to implement this then it's probably better to makeorg-journal-encryption-extension
of:type '(choice (const :tag "age" age) (const :tag "gpg" gpg))
instead of'string
.Instructions for testing
age
binaries: https://github.com/FiloSottile/age/releases/latestCreate age keys:
age-keygen -o key.txt age-keygen -y key.txt > key.pub
Example
age.el
configuration for testing:Activate
age
encrption fororg-journal
: