private bool IsUserTrusted(User user) { if (!this.configurationManager.Configuration.TrustedUsers.ContainsKey(user.Username)) { return(false); } string keyHash = HashingUtil.GetSha256Hash(user.PublicKey); return(this.configurationManager.Configuration.TrustedUsers[user.Username] == keyHash); }
private bool TrustUser(User user) { if (user == null) { return(false); } if (this.configurationManager.Configuration.TrustedUsers.ContainsKey(user.Username)) { return(false); } string keyHash = HashingUtil.GetSha256Hash(user.PublicKey); this.configurationManager.Configuration.TrustedUsers.Add(user.Username, keyHash); this.configurationManager.SaveChanges(); return(true); }