====== December Adventure 2023 ====== On 2023-12-01 I've learned about [[https://eli.li/december-adventure|December Adventure]]. It's a very nice idea (esp. compared to Advent of Code, as I don't like competing). My //December Adventure// will be working on [[:lacre:overview|Lacre]], a Postfix mail filter encrypting incoming mail before it is written to recipient's inbox. ===== December 2nd ===== * Lacre Webgate: [[https://git.disroot.org/Lacre/lacre-webgate/pulls/11|Add identity table]] --- I've finished introduction of identity database. * Lacre backend: [[lacrepr>130|Fix unencrypted delivery and key removal]] --- I've re-read and merged my recent work on storing identities in a database. * Lacre backend: [[lacreissue>120|Enhance validation of keys with multiple email addresses]] --- I've analysed the flow, and found that: * we enforce keys with single email during key verification in Lacre Webgate (in [[https://git.disroot.org/Lacre/lacre-webgate/src/commit/750014e58836d75cd47655a5dddd336a575a71c1/public_html/include/gpg.php#L76|public_html/include/gpg.php:76]]); * to handle keys with multiple emails I'll need to rework ''GnuPG.confirm_key'' function. * I've learned a bit about [[https://docs.python.org/3/library/asyncio-stream.html|asyncio Streams]] in Python by writing a little program. So far I seem to be doing something wrong. ===== December 3rd ===== * I've implemented a tiny key-value store in Python using ''asyncio'' streams and ''email''. It's an exercise before I approach something bigger but with similar semantics in Lacre backend. * Next, I've written something very similar based on [[https://docs.python.org/3/library/http.server.html|http.server]] Python package. ===== December 4th ===== * I've added support for TTL to my tiny key-value store, learning how to use [[https://docs.python.org/3/library/collections.html#collections.namedtuple|named tuples]] and [[https://docs.python.org/3/library/asyncio-eventloop.html#scheduling-delayed-callbacks|delayed callbacks with asyncio]]. ===== December 5th ===== * I've fixed cron script that I've broken during refactoring. (I should rework its tests too.) * I've fixed identity removal. * I've added support for ''-r'' or ''--reload'' flag to ''import'' command, which deletes all keys before importing them from GnuPG's ''pubring.kbx''. ===== December 6th ===== * I've written some Python [[https://docs.python.org/3/reference/compound_stmts.html#function-definitions|decorators]]. I suspect reading decorators from the standard library could be enlightening. ===== December 7th ===== * Today I've skimmed some [[https://docs.python.org/3/library/functools.html|functools]] code and written another Python decorator. This one emits an [[https://docs.python.org/3/library/audit_events.html|auditing event]] before execution of the decorated function. ===== December 9th ===== * Fixed some minor error-reporting issues. Now when an expired key prevents Lacre from encrypting a message, a short error message is logged instead of a full trace-back. * Updated admin CLI documentation to include info about ''import'' command and its ''-r'' option. * Tagged 0.2 RC2. * Started working on Rust re-implementation of the Lacre admin's CLI tool. Started by trying to connect to sqlite. ===== December 10th ===== * Fixed misbehaviour when Lacre would bounce messages upon database exception. Now we let admin decide if they want cleartext to be delivered. ===== December 12th ===== * Experimented with [[https://crates.io/crates/clap|clap]], a Rust //Command Line Argument Parser//. Also learned about [[https://doc.rust-lang.org/rust-by-example/custom_types/constants.html|constants]]. ===== December 13th ===== * I had a little morning warm-up with Rust. Rust's compiler gives very helpful and detailed error messages! ===== December 16th ===== * I've added 3 new configuration parameters to Lacre's config file, controlling database connection pool. (Read more in [[https://docs.sqlalchemy.org/en/20/core/pooling.html#dealing-with-disconnects|Dealing with disconnects]] section of SQLAlchemy documentation.) ===== December 17th ===== * Learned more about [[https://docs.python.org/3/library/enum.html|enum]] Python module, then used it in Lacre. * Provided a configuration parameter in Lacre to choose optimistic or pessimistic handling of database connections. ===== December 19th ===== * Added more logging while hunting a bug reported by Muppeth. * Lacre admin CLI tool: added ''-D'' (''--delete'') option to ''queue'' sub-command. ===== December 29th ===== * Continued learning Rust, this time trying to implement a [[wp>Brainfuck]] interpreter.