Matthias Andreas Benkard | 4e8423d | 2021-12-19 22:56:09 +0100 | [diff] [blame] | 1 | package eu.mulk.jgvariant.ostree; |
| 2 | |
| 3 | import eu.mulk.jgvariant.core.Decoder; |
| 4 | import eu.mulk.jgvariant.core.Variant; |
| 5 | import java.nio.charset.StandardCharsets; |
Matthias Andreas Benkard | 329168c | 2021-12-28 01:20:05 +0100 | [diff] [blame] | 6 | import java.util.Map; |
Matthias Andreas Benkard | 4e8423d | 2021-12-19 22:56:09 +0100 | [diff] [blame] | 7 | |
| 8 | /** |
| 9 | * A collection of cryptographic signatures for a {@link Summary}. |
| 10 | * |
| 11 | * <p>Stored as a file named {@code summary.sig} in the OSTree repository root. |
| 12 | * |
| 13 | * <p>Reference: {@code ostree-repo-static-delta-private.h#OSTREE_SUMMARY_SIG_GVARIANT_STRING} |
Matthias Andreas Benkard | 0511464 | 2021-12-29 21:51:29 +0100 | [diff] [blame] | 14 | * |
| 15 | * @param signatures a list of signatures, indexed by type. |
Matthias Andreas Benkard | 4e8423d | 2021-12-19 22:56:09 +0100 | [diff] [blame] | 16 | */ |
Matthias Andreas Benkard | 329168c | 2021-12-28 01:20:05 +0100 | [diff] [blame] | 17 | public record SummarySignature(Map<String, Variant> signatures) { |
Matthias Andreas Benkard | 4e8423d | 2021-12-19 22:56:09 +0100 | [diff] [blame] | 18 | |
| 19 | private static final Decoder<SummarySignature> DECODER = |
Matthias Andreas Benkard | 329168c | 2021-12-28 01:20:05 +0100 | [diff] [blame] | 20 | Decoder.ofDictionary(Decoder.ofString(StandardCharsets.UTF_8), Decoder.ofVariant()) |
| 21 | .map(SummarySignature::new); |
Matthias Andreas Benkard | 4e8423d | 2021-12-19 22:56:09 +0100 | [diff] [blame] | 22 | |
Matthias Andreas Benkard | 0511464 | 2021-12-29 21:51:29 +0100 | [diff] [blame] | 23 | /** |
| 24 | * Acquires a {@link Decoder} for the enclosing type. |
| 25 | * |
| 26 | * @return a possibly shared {@link Decoder}. |
| 27 | */ |
Matthias Andreas Benkard | 4e8423d | 2021-12-19 22:56:09 +0100 | [diff] [blame] | 28 | public static Decoder<SummarySignature> decoder() { |
| 29 | return DECODER; |
| 30 | } |
| 31 | } |