using System.Collections.Generic; using System.Security.Cryptography; namespace server; public class Data { public Dictionary Keys { set; get; } = []; public Dictionary> Messages { set; get; } = []; public RSA? GetKey(string Phone) { return Keys.TryGetValue(Phone, out RSA? value) ? value : null; } public Queue? GetMessages(string Phone) { // Check we have a RSA key for the phone and get the messages if(!Keys.ContainsKey(Phone)) { return null; } if(Messages.TryGetValue(Phone, out Queue? value)) { return value; } else { // generate a new queue because one doesnt already exists Messages[Phone] = new Queue(); return Messages[Phone]; } } }