public EncryptionKey CurrentKey => _currentKey ??= AllKeys.First(x => x.IsCurrent); // There must always be 1, so let this throw public FoundEncryptionKey GetKeyFromString(string encrypted) { var key = AllKeys.FirstOrDefault(x => !string.IsNullOrEmpty(x.Id) && encrypted.StartsWith(x.Id, StringComparison.CurrentCulture)) ?? VoidKey ?? throw new Exception("Unable to locate matching encryption key"); return(new FoundEncryptionKey(key, encrypted)); }
private StepView FindInTree(Step step) { return(AllKeys.FirstOrDefault(i => i.Key.Id == step.Id)); }