libutil: add Signature struct for typed signatures#15029
Merged
edolstra merged 1 commit intoNixOS:masterfrom Jan 21, 2026
Merged
libutil: add Signature struct for typed signatures#15029edolstra merged 1 commit intoNixOS:masterfrom
Signature struct for typed signatures#15029edolstra merged 1 commit intoNixOS:masterfrom
Conversation
dad1595 to
216e2e5
Compare
627ecbf to
b6384ad
Compare
Ericson2314
reviewed
Jan 20, 2026
Ericson2314
reviewed
Jan 20, 2026
Ericson2314
reviewed
Jan 20, 2026
Ericson2314
reviewed
Jan 20, 2026
b6384ad to
5829623
Compare
Ericson2314
reviewed
Jan 20, 2026
d0a8284 to
80ab69d
Compare
Ericson2314
reviewed
Jan 21, 2026
Ericson2314
reviewed
Jan 21, 2026
This comment was marked as resolved.
This comment was marked as resolved.
80ab69d to
ae17622
Compare
Ericson2314
reviewed
Jan 21, 2026
Introduce a new `Signature` struct that represents a cryptographic signature along with the key name that produced it. This provides: - Structured representation instead of colon-separated strings - Type-safe parsing with `Signature::parse()` - Serialization with `to_string()` - JSON serialization/deserialization - Batch parsing with `parseMany<Container>()` - Batch serialization with `toStrings()` This is scaffolding for future changes that will use this type throughout the codebase.
ae17622 to
12ef043
Compare
Ericson2314
approved these changes
Jan 21, 2026
edolstra
approved these changes
Jan 21, 2026
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.
Motivation
Currently, signatures are represented as raw strings in the format
keyName:base64sig. This requires parsing at every use site and makes the code less type-safe. This PR introduces aSignaturestruct that encapsulates this representation.Context
This PR introduces a
Signaturestruct and uses it throughout the codebase. The struct has two string fields, akeyNameand asigfield. Thesigfield contains the raw decoded bytes. All places where signatures were used as strings have been updated to useSignaturenow - for example, sets of signatures wereStringSetbefore, but are nowstd::set<Signature>. The JSON output is untouched in this PR; we useto_string()when writing to/reading from JSON.#15009 builds on top of this by actually changing the JSON output to use a more structured type. This PR is the preliminary scaffolding for that.
Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.