lib.ec.secret_store.TarGpg: Add the write path #147

Merged
Jan Lindemann merged 1 commit from jan/feature/20261017-lib-ec-secret-store-targpg-add-the-write-path into master 2026-10-17 13:21:17 +02:00 AGit
Owner

lib.ec.secret_store.TarGpg: Add the write path

The TarGpg store is read-only: put() and unlink() raise, so the store can be copied from, but not into, and a copy that lands entries and blobs below a host prefix has no tarball target.

This matches the way jw-pkg secrets has worked for a long time. Since Stores are now FileContext-backed, a write path can be cleanly implemented, and that's what this commit does.

A put rebuilds the tarball: the existing members minus the removed, plus the written one; the result is signed with the recipient from JW_SECRETS_TARGPG_RECIPIENT and written back to the tarball location, which must be a local path. A missing tarball is an empty store, so a put creates it.

The put dispatch follows the other stores: a typed entry put replaces the entry with the given serialized content, a key put merges into its entry, creating it if it does not exist yet, and an untyped put below an entry lands a key there, otherwise a blob. unlink() removes the node's member.

#### lib.ec.secret_store.TarGpg: Add the write path The TarGpg store is read-only: `put()` and `unlink()` raise, so the store can be copied from, but not into, and a copy that lands entries and blobs below a host prefix has no tarball target. This matches the way `jw-pkg` secrets has worked for a long time. Since Stores are now FileContext-backed, a write path can be cleanly implemented, and that's what this commit does. A put rebuilds the tarball: the existing members minus the removed, plus the written one; the result is signed with the recipient from `JW_SECRETS_TARGPG_RECIPIENT` and written back to the tarball location, which must be a local path. A missing tarball is an empty store, so a put creates it. The put dispatch follows the other stores: a typed entry put replaces the entry with the given serialized content, a key put merges into its entry, creating it if it does not exist yet, and an untyped put below an entry lands a key there, otherwise a blob. `unlink()` removes the node's member.
lib.ec.secret_store.TarGpg: Add the write path
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 4m32s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 4m52s
CI / Packaging test (pull_request) Successful in 0s
CI / Packaging - Kali Linux (push) Successful in 4m35s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 5m17s
CI / Packaging test (push) Successful in 0s
f70cc48eb6
The TarGpg store is read-only: put() and unlink() raise, so the store can
be copied from, but not into, and a copy that lands entries and blobs below
a host prefix has no tarball target.

This matches the way jw-pkg secrets has worked for a long time. Since
Stores are now FileContext-backed, a write path can be cleanly implemented,
and that's what this commit does.

A put rebuilds the tarball: the existing members minus the removed, plus
the written one; the result is signed with the recipient from
JW_SECRETS_TARGPG_RECIPIENT and written back to the tarball location, which
must be a local path. A missing tarball is an empty store, so a put creates
it.

The put dispatch follows the other stores: a typed entry put replaces the
entry with the given serialized content, a key put merges into its entry,
creating it if it does not exist yet, and an untyped put below an entry
lands a key there, otherwise a blob. unlink() removes the node's member.

Signed-off-by: Jan Lindemann <jan@janware.com>
Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v1.1.0
Jan Lindemann scheduled this pull request to auto merge when all checks succeed 2026-10-17 13:09:48 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
janware/jw-pkg!147
No description provided.