using System; using System.Collections.Generic; using ln.types.net; using ln.types.odb.attributes; namespace skyspot.radius { public class RadiusSecretsStore { [DocumentID] Guid ID = Guid.NewGuid(); public byte[] DefaultSecret { get; set; } Dictionary secrets = new Dictionary(); public RadiusSecretsStore() { } public bool ContainsEndpoint(Endpoint4 endpoint) => secrets.ContainsKey(endpoint); public IEnumerable Endpoints => secrets.Keys; public byte[] LookupSecret(Endpoint4 endpoint) { if (secrets.ContainsKey(endpoint)) return secrets[endpoint]; return DefaultSecret; } public byte[] GetSecret(Endpoint4 endpoint) => secrets[endpoint]; public void SetSecret(Endpoint4 endpoint, byte[] secret) => secrets[endpoint] = secret; public void RemoveSecret(Endpoint4 endpoint) => secrets.Remove(endpoint); } }