| | | 1 | | namespace AsiBackbone.Core.Serialization; |
| | | 2 | | |
| | | 3 | | /// <summary> |
| | | 4 | | /// Defines schema version constants for persisted or exported AsiBackbone governance artifacts. |
| | | 5 | | /// </summary> |
| | | 6 | | public static class GovernanceSchemaVersions |
| | | 7 | | { |
| | | 8 | | /// <summary> |
| | | 9 | | /// Gets the initial stable schema version for persisted or exported AsiBackbone governance artifacts. |
| | | 10 | | /// </summary> |
| | | 11 | | public const string StableArtifactsV1 = "1.0.0"; |
| | | 12 | | |
| | | 13 | | /// <summary> |
| | | 14 | | /// Gets the second stable schema version, which adds the issuer-bound capability grant use limit. |
| | | 15 | | /// </summary> |
| | | 16 | | /// <remarks> |
| | | 17 | | /// A grant recording <see cref="StableArtifactsV1" /> is canonicalized without the use limit, so grants signed befo |
| | | 18 | | /// this version continue to verify unchanged. Only a grant recording this version binds a use limit into its signat |
| | | 19 | | /// </remarks> |
| | | 20 | | public const string StableArtifactsV2 = "2.0.0"; |
| | | 21 | | |
| | | 22 | | /// <summary> |
| | | 23 | | /// Normalizes a caller-supplied schema version to the current stable artifact schema version when none is supplied. |
| | | 24 | | /// </summary> |
| | | 25 | | /// <param name="schemaVersion">The caller-supplied schema version.</param> |
| | | 26 | | /// <returns>The normalized schema version.</returns> |
| | | 27 | | public static string Normalize(string? schemaVersion) |
| | | 28 | | { |
| | 1580 | 29 | | return string.IsNullOrWhiteSpace(schemaVersion) |
| | 1580 | 30 | | ? StableArtifactsV1 |
| | 1580 | 31 | | : schemaVersion.Trim(); |
| | | 32 | | } |
| | | 33 | | } |