/// Generate a new salt and then return that salt and this ID hashed with that new salt.
///
/// This salt should be
pubfngenerate_hash(&self)-> (UserSalt,Sha256Hash)
{
letsalt=UserSalt::generate();
lethash=self.hash_with_salt(&salt);
(salt,hash)
}
}
/// A user identifier.
///
/// Contains the user's unique ID, their public key(s), and a valid signature of the sha256 hash of the user's ID + a random salt.
#[derive(Debug, PartialEq, Eq, Hash)]
pubstructUser
{
/// The user's unique ID.
id: UserID,
/// A optional set of identifiers given by the user. The user must be trusted to set/edit this value.
ident: post::Ident,
/// The public keys associated with this user.
///
/// # Trust
/// Each public key must have a corresponding signature in its complemental entry in `id_sig` to be considered trusted.
/// A user with no trusted public keys can be anyone or multiple people. This is not *disallowed* usually but should be discouraged.
///
/// Users are only considered trusted if they have at least one trusted public key.
pubkey: Vec<RsaPublicKey>,
/// This vector contains the complemental signature (and salt used with `id` to produce the signed hash) to the public keys in `pubkey`. Each element of `pubkey` must have a complemental element in this vector.
///
/// # Trusted public keys
/// `None` values for this are signatures that have not yet been produces for a given salt, and do not count as complete. Public keys in `pubkey` that do not have a corresponding `Some` signature value in this field should not be trusted.
id_sig: Vec<(UserSalt,Option<Signature>)>,
}
implUser
{
/// Is this user a trusted user?
///
/// I.e. Does this user have at least one trusted public key (they have produced a valid signature specified in `id_sig`).