using FinalFactory.Rendezvous.Contracts; namespace FinalFactory.Rendezvous.Server.Provisioning; internal sealed class ProvisioningOptions { public const string SectionName = "Rendezvous:Provisioning"; public string Issuer { get; set; } = string.Empty; public string Audience { get; set; } = string.Empty; public int ClockSkewSeconds { get; set; } = 30; public List SigningKeys { get; set; } = []; public List Games { get; set; } = []; } internal sealed class SigningKeyOptions { public string KeyId { get; set; } = string.Empty; public string SecretReference { get; set; } = string.Empty; public List CredentialKinds { get; set; } = []; public string? GameId { get; set; } public string? EnvironmentId { get; set; } public DateTimeOffset NotBefore { get; set; } public DateTimeOffset SignUntil { get; set; } public DateTimeOffset VerifyUntil { get; set; } public bool Revoked { get; set; } } internal sealed class GamePolicyOptions { public string GameId { get; set; } = string.Empty; public string EnvironmentId { get; set; } = string.Empty; public bool Enabled { get; set; } = true; public List ProtocolVersions { get; set; } = []; public List Regions { get; set; } = []; public List VisibilityModes { get; set; } = []; public List PublisherTrustModes { get; set; } = []; public Dictionary MetadataValueMaxBytes { get; set; } = new(StringComparer.Ordinal); public List RequiredMetadataKeys { get; set; } = []; public int MetadataMaxBytes { get; set; } = ContractLimits.MetadataMaxBytes; public int MetadataMaxKeys { get; set; } = ContractLimits.MetadataMaxKeys; public int MaxListingsPerPrincipal { get; set; } = 100; public int MaxAnonymousListingsPerAddress { get; set; } = 2; public int MaxActiveJoinAttempts { get; set; } = 1_000; public FallbackPolicyMode FallbackPolicy { get; set; } } internal enum FallbackPolicyMode { Disabled = 0, DedicatedEndpointAllowed = 1, } internal static class ProvisioningLimits { public const int MaxGamePolicies = 1_024; public const int MaxSigningKeys = 128; public const int MaxProtocolVersionsPerPolicy = 64; public const int MaxRegionsPerPolicy = 32; public const int MaxListingsPerPrincipal = 25_000; public const int MaxActiveJoinAttemptsPerPolicy = 10_000; } internal sealed class ProvisioningConfigurationException : Exception { public ProvisioningConfigurationException(string message) : base(message) { } }