// trustedViewableStatus provides functions to keep track of the trusted viewable moderation consensus statuses of content/identities // Viewable statuses are derived from sticky viewable statuses // Sticky viewable statuses only change if the viewable status has been changed for a minimum defined period of time // See verifiedStickyStatus.go for an explanation of sticky consensus statuses package trustedViewableStatus // We query from multiple different hosts who are hosting the profile/identity reviews to retrieve the trusted viewable statuses // "Trusted" is in reference to the reality that we are trusting that the hosts we query are providing truthful viewable statuses // To determine a "Verified" status one must download all of the moderator reviews to determine the viewable sticky consensus statuses // Once the client has received the viewable status from the required threshold of hosts, we can display viewable profiles/identities to the user // Unlike verifiedStickyStatus, this package treats a profile whose identity is banned as not viewable // Example: If an identity is banned but the profile is approved: // -The profile's trusted sticky consensus will be Unviewable // -The verified sticky consensus will be Viewable // Below describes what a viewable/unviewable status means: // Identity: // -Viewable: Not Banned // -Unviewable: Banned // Profile // -Viewable: // -Mate: Profile is Approved and identity is not banned // -Host/Moderator: Profile is Undecided/Approved and identity is not banned // -Unviewable // -Mate: Profile is Banned/Undecided or identity is banned // -Host/Moderator: Profile is Banned or identity is banned // Message: // -Viewable: Approved/Undecided // -Unviewable: Banned //TODO: Manually downloaded profiles should be viewable with only 1 trusted viewable status // Otherwise it would be cumbersome to download a profile, wait for the download, and then wait to download trusted statuses from different hosts //TODO: Build package // We should store statuses in badgerDatabase // We need to store the time we received each status, and from which host we received it from // This is required so we can replace older statuses we received from the same hosts, and so we can detect hosts who are sharing statuses // that are contrary to the rest of the hosts so we can designate those hosts as untrustworthy // We don't need to use this package to store message sticky statuses // Messages can only become unviewable when they are banned by the recipient or the author // Thus, a user does not need to check if a message they are retrieving is viewable or not before decrypting it // // The only time a user will retrieve a trusted message sticky status is to see if the message has been banned after they reported it // This status will be shown to the user in the GUI, and does not need to be stored in the database using this package //Outputs: // -bool: Status is known (is stored in database and agreed upon by minimum required hosts) // -bool: Identity is viewable (true = Identity is banned, false = identity is not banned) // -[][16]byte: Host identity hashes that have been queried // -error func GetTrustedIdentityIsViewableStatus(identityHash [16]byte, networkType byte)(bool, bool, [][16]byte, error){ //TODO return true, true, nil, nil } //Outputs: // -bool: Status is known // -bool: Profile Is Viewable // -[][16]byte: Host identity hashes that have been queried // -error func GetTrustedProfileIsViewableStatus(profileHash [28]byte)(bool, bool, [][16]byte, error){ //TODO return true, true, nil, nil } func AddTrustedIdentityIsViewableStatus(userIdentityHash [16]byte, hostIdentityHash [16]byte, networkType byte, viewableStatus bool)error{ //TODO return nil } func AddTrustedProfileIsViewableStatus(profileHash [28]byte, hostIdentityHash [16]byte, viewableStatus bool)error{ //TODO return nil }