namespace DodoSSH.Crypto;

/// <summary>
/// An identity key statement, in the form the specification hashes and signs.
/// </summary>
/// <remarks>
/// <para>
/// Deliberately separate from the transport DTO in <c>DodoSSH.Contracts</c>. This type defines
/// what is <em>hashed</em>; that one defines what is <em>transmitted</em>. Keeping them apart is
/// what lets the canonical encoding stay stable while the JSON shape gains fields, and it keeps
/// <c>DodoSSH.Crypto</c> free of a dependency on the contract assembly. A test asserts the two
/// carry the same fields, so they cannot drift.
/// </para>
/// <para>
/// Equality on this record is not meaningful — the key and signature members are arrays, so it
/// compares by reference. Compare canonical encodings instead.
/// </para>
/// </remarks>
/// <param name="Version">Statement format version. Currently 1.</param>
/// <param name="Issuer">OIDC issuer that vouches for the subject.</param>
/// <param name="Subject">OIDC subject.</param>
/// <param name="Email">Email at enrollment time, for display only. May be absent.</param>
/// <param name="EncryptionPublicKey">X25519 public key, 32 bytes.</param>
/// <param name="SigningPublicKey">Ed25519 public key, 32 bytes.</param>
/// <param name="KeyGeneration">Generation of this key pair, starting at 1.</param>
/// <param name="CreatedAt">When the client generated the keys.</param>
/// <param name="DeviceName">Human-readable name of the enrolling device.</param>
public sealed record KeyStatementFields(
    int Version,
    string Issuer,
    string Subject,
    string? Email,
    byte[] EncryptionPublicKey,
    byte[] SigningPublicKey,
    int KeyGeneration,
    DateTimeOffset CreatedAt,
    string DeviceName);
