using Newtonsoft.Json; namespace Models { // TODO: Do we want them to be able to log in with username? // Could be nice, but adds complexity not worth at the moment public class LoginDetails { // Email associated with an account public string email; // Plain text password, must be hashed (Argon2d) and compared against database public string password; // This is a Ed25519 public key which can be used to verify that // a header was signed by a client. It will be included in the JWT public string clientVerificationKey; /// /// Returns a string representation of the object but replaces all of the characters in password with *. /// /// A string representation of the object with password replaced by * public override string ToString() { // Create a copy of the object so that we can modify its password field var copy = (LoginDetails)this.MemberwiseClone(); // Replace the characters in the password field with asterisks copy.password = new string('*', copy.password.Length); // Return the string representation of the modified copy return JsonConvert.SerializeObject(copy, Formatting.Indented); } } }