From e642671ce2601c5fc31c09357e3b282ae7994fb6 Mon Sep 17 00:00:00 2001 From: Ionite Date: Fri, 30 Jun 2023 17:48:20 -0400 Subject: [PATCH 1/3] Remove ctor from UpdateInfo, add pragmas --- StabilityMatrix/Updater/UpdateInfo.cs | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/StabilityMatrix/Updater/UpdateInfo.cs b/StabilityMatrix/Updater/UpdateInfo.cs index 45aa180c..51094143 100644 --- a/StabilityMatrix/Updater/UpdateInfo.cs +++ b/StabilityMatrix/Updater/UpdateInfo.cs @@ -6,6 +6,7 @@ namespace StabilityMatrix.Updater; public class UpdateInfo { +#pragma warning disable CS8618 [JsonRequired] [JsonPropertyName("version")] public Version Version { get; set; } @@ -31,15 +32,5 @@ public class UpdateInfo [JsonPropertyName("type")] public UpdateType? Type { get; set; } - - public UpdateInfo(Version version, DateTimeOffset releaseDate, UpdateChannel channel, string downloadUrl, string changelogUrl, string? signature = null, UpdateType? updateType = null) - { - Version = version; - ReleaseDate = releaseDate; - Channel = channel; - DownloadUrl = downloadUrl; - ChangelogUrl = changelogUrl; - Signature = signature; - Type = updateType; - } +#pragma warning restore CS8618 } From 47ee95221457ff795ca4ae6dbd4a168eae157bcf Mon Sep 17 00:00:00 2001 From: Ionite Date: Fri, 30 Jun 2023 17:58:23 -0400 Subject: [PATCH 2/3] Change UpdateInfo to record --- StabilityMatrix/Updater/UpdateInfo.cs | 43 +++++++++++---------------- 1 file changed, 17 insertions(+), 26 deletions(-) diff --git a/StabilityMatrix/Updater/UpdateInfo.cs b/StabilityMatrix/Updater/UpdateInfo.cs index 51094143..1c63ba46 100644 --- a/StabilityMatrix/Updater/UpdateInfo.cs +++ b/StabilityMatrix/Updater/UpdateInfo.cs @@ -1,36 +1,27 @@ using System; using System.Text.Json.Serialization; -using StabilityMatrix.Models; namespace StabilityMatrix.Updater; -public class UpdateInfo -{ -#pragma warning disable CS8618 - [JsonRequired] - [JsonPropertyName("version")] - public Version Version { get; set; } +public record UpdateInfo( + [property: JsonPropertyName("version")] + Version Version, - [JsonRequired] - [JsonPropertyName("releaseDate")] - public DateTimeOffset ReleaseDate { get; set; } + [property: JsonPropertyName("releaseDate")] + DateTimeOffset ReleaseDate, - [JsonRequired] - [JsonPropertyName("channel")] - public UpdateChannel Channel { get; set; } - - [JsonRequired] - [JsonPropertyName("url")] - public string DownloadUrl { get; set; } + [property: JsonPropertyName("channel")] + UpdateChannel Channel, + + [property: JsonPropertyName("url")] + string DownloadUrl, - [JsonRequired] - [JsonPropertyName("changelog")] - public string ChangelogUrl { get; set; } + [property: JsonPropertyName("changelog")] + string ChangelogUrl, - [JsonPropertyName("signature")] - public string? Signature { get; set; } + [property: JsonPropertyName("signature")] + string Signature, - [JsonPropertyName("type")] - public UpdateType? Type { get; set; } -#pragma warning restore CS8618 -} + [property: JsonPropertyName("type")] + UpdateType Type +); From f064697493e09170f20ab0f22b2bf78d01d32b5e Mon Sep 17 00:00:00 2001 From: Ionite Date: Sat, 1 Jul 2023 03:41:53 -0400 Subject: [PATCH 3/3] Add hash_blake3 field to updateinfo --- StabilityMatrix/Updater/UpdateInfo.cs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/StabilityMatrix/Updater/UpdateInfo.cs b/StabilityMatrix/Updater/UpdateInfo.cs index 1c63ba46..b9e74525 100644 --- a/StabilityMatrix/Updater/UpdateInfo.cs +++ b/StabilityMatrix/Updater/UpdateInfo.cs @@ -13,15 +13,22 @@ public record UpdateInfo( [property: JsonPropertyName("channel")] UpdateChannel Channel, + [property: JsonPropertyName("type")] + UpdateType Type, + [property: JsonPropertyName("url")] string DownloadUrl, [property: JsonPropertyName("changelog")] string ChangelogUrl, - [property: JsonPropertyName("signature")] - string Signature, + // Blake3 hash of the file + [property: JsonPropertyName("hash_blake3")] + string HashBlake3, - [property: JsonPropertyName("type")] - UpdateType Type + // ED25519 signature of the semicolon seperated string: + // "version + releaseDate + channel + type + url + changelog + hash_blake3" + // verifiable using our stored public key + [property: JsonPropertyName("signature")] + string Signature );