diff --git a/Changelog.md b/Changelog.md index 0ecfb7c..e9cc156 100644 --- a/Changelog.md +++ b/Changelog.md @@ -4,6 +4,10 @@ This document attempts to describe the history of changes to Seekia. Small and insignificant changes may not be included in this log. +## Unversioned Changes + +* Removed the trusted/verified funded status packages to progress towards the replacement of account credit servers with payment proofs. - *Simon Sarasova* + ## Version 0.71 *Release Date: September 6, 2024* diff --git a/Contributors.md b/Contributors.md index 905b89c..d94dda3 100644 --- a/Contributors.md +++ b/Contributors.md @@ -9,4 +9,4 @@ Many other people have written code for modules which are imported by Seekia. Th Name | Date Of First Commit | Number Of Commits --- | --- | --- -Simon Sarasova | June 13, 2023 | 310 \ No newline at end of file +Simon Sarasova | June 13, 2023 | 311 \ No newline at end of file diff --git a/documentation/Specification.md b/documentation/Specification.md index 1b51ec4..e1c2b73 100644 --- a/documentation/Specification.md +++ b/documentation/Specification.md @@ -129,7 +129,7 @@ The Value String section describes the map entry values encoded as String, which * **MinimumIdentityDaysToFund** * Description: * A file describing the minimum number of days required to fund a mate/host identity - * The historic rates are needed so that updates to the durations will have time to be downloaded by the account credit servers and users of the network before the new durations take effect + * The historic rates are needed so that updates to the durations will have time to be downloaded by the users of the network before the new durations take effect * Format: * **(IdentityType)_(TimeUnix)** * Description: The minimum number of days required to fund for identities of the identityType @@ -142,7 +142,7 @@ The Value String section describes the map entry values encoded as String, which * **MaximumIdentityDaysToFund** * Description: * A file describing the maximum number of days required to fund a mate/host identity - * The historic rates are needed so that updates to the durations will have time to be downloaded by the account credit servers and users of the network before the new durations take effect + * The historic rates are needed so that updates to the durations will have time to be downloaded by the users of the network before the new durations take effect * Format: * **(IdentityType)_(TimeUnix)** * Description: The maximum number of days required to fund for identities of the identityType @@ -164,9 +164,9 @@ The Value String section describes the map entry values encoded as String, which * Value Bytes: `[32]byte` * Value String: `[32]byte` encoded in Hex * Example: - * `Seekia_v0.1.zip -> 12a34e43b2c112f34e43a21a341958a4841ab12abbba192384ab3804ab (Not A Real Hash)` - * `Seekia_v1.2.dmg -> 12a34e43b2c112f34e43a21a341958a4841ab12abbba192384ab3804ab (Not A Real Hash)` - * `Seekia_v1.2.exe -> 12a34e43b2c112f34e43a21a341958a4841ab12abbba192384ab3804ab (Not A Real Hash)` + * `Seekia-v0.1.AppImage -> 12a34e43b2c112f34e43a21a341958a4841ab12abbba192384ab3804ab (Not A Real Hash)` + * `Seekia-v1.2.dmg -> 12a34e43b2c112f34e43a21a341958a4841ab12abbba192384ab3804ab (Not A Real Hash)` + * `Seekia-v1.2.exe -> 12a34e43b2c112f34e43a21a341958a4841ab12abbba192384ab3804ab (Not A Real Hash)` * **MessageCosts** * Description: * These are the gold/kilobytes/day rates for messages to be hosted on the network @@ -181,7 +181,7 @@ The Value String section describes the map entry values encoded as String, which * **FundingIdentityCosts** * Description: * These are the milligrams of gold/day rates for Mate/Host identities to be funded and hosted on the network - * The historical cost rates are needed so updates to the rates have time to be downloaded by the account credit servers and users before the new rates go into effect + * The historical cost rates are needed so updates to the rates have time to be downloaded by users before the new rates go into effect * Format: * **(IdentityType)_(TimeUnix)** * Description: Milligrams of gold rate per day at TimeUnix to fund an IdentityType identity @@ -193,7 +193,7 @@ The Value String section describes the map entry values encoded as String, which * **ReportCosts** * Description: * The cost to fund a report - * Historical times are needed so that all users and account credits servers have time to download the parameters before a price change takes place + * Historical times are needed so that all users have time to download the parameters before a price change takes place * Format: * **(TimeUnix)** * Description: Cost in milligrams of gold to fund a report for the standard report duration at timeUnix @@ -204,7 +204,7 @@ The Value String section describes the map entry values encoded as String, which * **MateProfileCosts** * Description: * The cost to fund a mate profile - * Historical times are needed so that all users and account credits servers have time to download the parameters before a price change takes place + * Historical times are needed so that all users have time to download the parameters before a price change takes place * Format: * **(TimeUnix)** * Description: Cost in milligrams of gold to fund a mate profile at timeUnix @@ -313,28 +313,23 @@ The Value String section describes the map entry values encoded as String, which * Examples: * `1690000000_Ethereum -> 12332123123123` * `1690000000_Cardano -> 123213123123123123123` -* **AccountCreditServersStatus** +* **PaymentProofProvidersStatus** * Description: - * Used to tell users if the account credit server(s) were hacked/broken for any period of time - * The nodes that relied upon this inaccurate data would disregard any data received from the account credit servers during these time periods - * The Seekia application must keep track of when it learned information from the servers - * This is necessary because Hosts usually never check the servers for updates after receiving certain kinds of information - * For example, if a host learned that a message was funded for 14 days, then they would host the message for 14 days and never ask the server about the message's funded status again - * An attack on the servers could result in hosts hosting unfunded messages for a while + * Used to tell users if any payment proof providers were hacked/broken for any period of time + * * Format: * TODO: Historical information describing periods that the servers were hacked/broken -* **AccountCreditServersList** +* **PaymentProofProvidersList** * Description: - * A list of all of the account credit server URLS + * A list of all of the payment proof server URLS * These may be clearnet or Tor * Format: * **(URL)** - * Description: The read-only/writeable status of the server. Some servers are read-only. - * Value Bytes: `bool` - * Value String: "Unwriteable"/"Writeable" + * Description: The URL of the payment proof provider server. + * Value Bytes: `string` + * Value String: A description about the server and who operates it. * Examples: - * `https://server1.seekia.net/ -> Unwriteable` - * `https://server2.seekia.net/ -> Writeable` + * `https://paymentproofprovider.seekia.net/ -> The main payment provider operated by X. *TODO: Add parameters to ban specific messages (they could be malformed and undecryptable with the cipherkeyhash, but still contain unruleful content within them)* diff --git a/gui/viewProfileGui.go b/gui/viewProfileGui.go index 874115e..ca1107b 100644 --- a/gui/viewProfileGui.go +++ b/gui/viewProfileGui.go @@ -36,7 +36,7 @@ import "seekia/internal/moderation/trustedViewableStatus" import "seekia/internal/moderation/verifiedStickyStatus" import "seekia/internal/myIdentity" import "seekia/internal/network/appNetworkType/getAppNetworkType" -import "seekia/internal/network/fundedStatus" +import "seekia/internal/network/getFundedStatuses" import "seekia/internal/network/myBroadcasts" import "seekia/internal/profiles/attributeDisplay" import "seekia/internal/profiles/calculatedAttributes" @@ -394,7 +394,7 @@ func setViewPeerProfilePageFromIdentityHash(window fyne.Window, peerIdentityHash // Identity is not banned. Profile does not exist // We check if user's identity is known to be expired. - statusIsKnown, identityIsFunded, err := fundedStatus.GetIdentityIsFundedStatus(peerIdentityHash, appNetworkType) + statusIsKnown, identityIsFunded, _, err := getFundedStatuses.GetIdentityIsFundedStatus(peerIdentityHash, appNetworkType) if (err != nil) { setErrorEncounteredPage(window, err, previousPage) return diff --git a/internal/network/accountKeys/accountKeys.go b/internal/network/accountKeys/accountKeys.go index 1b6d537..5332b18 100644 --- a/internal/network/accountKeys/accountKeys.go +++ b/internal/network/accountKeys/accountKeys.go @@ -1,9 +1,11 @@ // accountKeys provides functions to derive account identifiers and cryptocurrency addresses from credit account keys. -// These keys are used to interface with the credit accounts servers to manage a user's account credits. +// These keys are used to interface with the payment proof servers to manage a user's account credits. package accountKeys +//TODO: Fix this package to interface with payment proof providers rather than account credit servers + // A user's account private key is required to check their account balance // Each public key corresponds to an account identifier and crypto address(es) // We only use each key for a single purpose. diff --git a/internal/network/craftResponses/craftResponses.go b/internal/network/craftResponses/craftResponses.go index 4b2b79d..a882452 100644 --- a/internal/network/craftResponses/craftResponses.go +++ b/internal/network/craftResponses/craftResponses.go @@ -25,10 +25,10 @@ import "seekia/internal/moderation/reviewStorage" import "seekia/internal/moderation/verifiedStickyStatus" import "seekia/internal/myIdentity" import "seekia/internal/myRanges" +import "seekia/internal/network/getFundedStatuses" import "seekia/internal/network/mateCriteria" import "seekia/internal/network/serverRequest" import "seekia/internal/network/serverResponse" -import "seekia/internal/network/verifiedFundedStatus" import "seekia/internal/parameters/parametersStorage" import "seekia/internal/parameters/readParameters" import "seekia/internal/profiles/profileStorage" @@ -287,7 +287,7 @@ func GetServerResponseForRequest(requestBytes []byte, networkType byte, connecti // profileType == "Mate" or "Host" - statusIsKnown, isFunded, _, _, err := verifiedFundedStatus.GetVerifiedIdentityIsFundedStatus(identityHash, networkType) + statusIsKnown, isFunded, _, err := getFundedStatuses.GetIdentityIsFundedStatus(identityHash, networkType) if (err != nil) { return nil, err } if (statusIsKnown == false || isFunded == false){ continue @@ -428,7 +428,7 @@ func GetServerResponseForRequest(requestBytes []byte, networkType byte, connecti if (profileTypeToRetrieve == "Mate"){ - statusIsKnown, isFunded, _, _, err := verifiedFundedStatus.GetVerifiedMateProfileIsFundedStatus(profileHash) + statusIsKnown, isFunded, _, err := getFundedStatuses.GetMateProfileIsFundedStatus(profileHash) if (err != nil) { return nil, err } if (statusIsKnown == false || isFunded == false){ continue @@ -536,7 +536,7 @@ func GetServerResponseForRequest(requestBytes []byte, networkType byte, connecti // We make sure profile is funded - statusIsKnown, isFunded, _, _, err := verifiedFundedStatus.GetVerifiedMateProfileIsFundedStatus(profileHash) + statusIsKnown, isFunded, _, err := getFundedStatuses.GetMateProfileIsFundedStatus(profileHash) if (err != nil) { return nil, err } if (statusIsKnown == false || isFunded == false){ continue @@ -590,7 +590,7 @@ func GetServerResponseForRequest(requestBytes []byte, networkType byte, connecti // profileType == "Mate" or "Host" - statusIsKnown, isFunded, _, _, err := verifiedFundedStatus.GetVerifiedIdentityIsFundedStatus(profileAuthor, networkType) + statusIsKnown, isFunded, _, err := getFundedStatuses.GetIdentityIsFundedStatus(profileAuthor, networkType) if (err != nil) { return nil, err } if (statusIsKnown == false || isFunded == false){ continue @@ -702,7 +702,7 @@ func GetServerResponseForRequest(requestBytes []byte, networkType byte, connecti // We make sure each message is funded - statusIsKnown, messageIsFunded, _, _, err := verifiedFundedStatus.GetVerifiedMessageIsFundedStatus(messageHash) + statusIsKnown, messageIsFunded, _, err := getFundedStatuses.GetMessageIsFundedStatus(messageHash) if (err != nil) { return nil, err } if (statusIsKnown == false || messageIsFunded == false){ continue @@ -812,7 +812,7 @@ func GetServerResponseForRequest(requestBytes []byte, networkType byte, connecti // We make sure each message is funded - statusIsKnown, messageIsFunded, _, _, err := verifiedFundedStatus.GetVerifiedMessageIsFundedStatus(messageHash) + statusIsKnown, messageIsFunded, _, err := getFundedStatuses.GetMessageIsFundedStatus(messageHash) if (err != nil) { return nil, err } if (statusIsKnown == false || messageIsFunded == false){ continue @@ -1087,7 +1087,7 @@ func GetServerResponseForRequest(requestBytes []byte, networkType byte, connecti // identityTypeToRetrieve == "Mate" or "Host" - statusIsKnown, isFunded, _, _, err := verifiedFundedStatus.GetVerifiedIdentityIsFundedStatus(reviewedIdentityHash, networkType) + statusIsKnown, isFunded, _, err := getFundedStatuses.GetIdentityIsFundedStatus(reviewedIdentityHash, networkType) if (err != nil) { return nil, err } if (statusIsKnown == false || isFunded == false){ continue @@ -1105,7 +1105,7 @@ func GetServerResponseForRequest(requestBytes []byte, networkType byte, connecti reviewedProfileHash := [28]byte(reviewedHash) - statusIsKnown, isFunded, _, _, err := verifiedFundedStatus.GetVerifiedMateProfileIsFundedStatus(reviewedProfileHash) + statusIsKnown, isFunded, _, err := getFundedStatuses.GetMateProfileIsFundedStatus(reviewedProfileHash) if (err != nil) { return nil, err } if (statusIsKnown == false || isFunded == false){ continue @@ -1132,7 +1132,7 @@ func GetServerResponseForRequest(requestBytes []byte, networkType byte, connecti for _, profileHash := range attributeProfileHashesList{ - statusIsKnown, isFunded, _, _, err := verifiedFundedStatus.GetVerifiedMateProfileIsFundedStatus(profileHash) + statusIsKnown, isFunded, _, err := getFundedStatuses.GetMateProfileIsFundedStatus(profileHash) if (err != nil) { return false, err } if (statusIsKnown == true && isFunded == true){ return true, nil @@ -1293,7 +1293,7 @@ func GetServerResponseForRequest(requestBytes []byte, networkType byte, connecti // We make sure message is funded - statusIsKnown, messageIsFunded, _, _, err := verifiedFundedStatus.GetVerifiedMessageIsFundedStatus(reviewedMessageHash) + statusIsKnown, messageIsFunded, _, err := getFundedStatuses.GetMessageIsFundedStatus(reviewedMessageHash) if (err != nil) { return nil, err } if (statusIsKnown == false || messageIsFunded == false){ continue @@ -1388,7 +1388,7 @@ func GetServerResponseForRequest(requestBytes []byte, networkType byte, connecti continue } - statusIsKnown, messageIsFunded, _, _, err := verifiedFundedStatus.GetVerifiedMessageIsFundedStatus(reviewedMessageHash) + statusIsKnown, messageIsFunded, _, err := getFundedStatuses.GetMessageIsFundedStatus(reviewedMessageHash) if (err != nil) { return nil, err } if (statusIsKnown == false || messageIsFunded == false){ continue @@ -1504,7 +1504,7 @@ func GetServerResponseForRequest(requestBytes []byte, networkType byte, connecti // reviewedIdentityType == "Mate" or "Host" - statusIsKnown, isFunded, _, _, err := verifiedFundedStatus.GetVerifiedIdentityIsFundedStatus(reviewedIdentityHash, networkType) + statusIsKnown, isFunded, _, err := getFundedStatuses.GetIdentityIsFundedStatus(reviewedIdentityHash, networkType) if (err != nil) { return nil, err } if (statusIsKnown == false || isFunded == false){ continue @@ -1522,7 +1522,7 @@ func GetServerResponseForRequest(requestBytes []byte, networkType byte, connecti reviewedProfileHash := [28]byte(reviewedHash) - statusIsKnown, isFunded, _, _, err := verifiedFundedStatus.GetVerifiedMateProfileIsFundedStatus(reviewedProfileHash) + statusIsKnown, isFunded, _, err := getFundedStatuses.GetMateProfileIsFundedStatus(reviewedProfileHash) if (err != nil) { return nil, err } if (statusIsKnown == false || isFunded == false){ continue @@ -1549,7 +1549,7 @@ func GetServerResponseForRequest(requestBytes []byte, networkType byte, connecti for _, profileHash := range attributeProfileHashesList{ - statusIsKnown, isFunded, _, _, err := verifiedFundedStatus.GetVerifiedMateProfileIsFundedStatus(profileHash) + statusIsKnown, isFunded, _, err := getFundedStatuses.GetMateProfileIsFundedStatus(profileHash) if (err != nil) { return false, err } if (statusIsKnown == true && isFunded == true){ return true, nil @@ -1647,7 +1647,7 @@ func GetServerResponseForRequest(requestBytes []byte, networkType byte, connecti for _, reportHash := range relevantReportHashesList{ - statusIsKnown, reportIsFunded, _, _, err := verifiedFundedStatus.GetVerifiedReportIsFundedStatus(reportHash) + statusIsKnown, reportIsFunded, _, err := getFundedStatuses.GetReportIsFundedStatus(reportHash) if (err != nil) { return nil, err } if (statusIsKnown == false || reportIsFunded == false){ continue @@ -1802,7 +1802,7 @@ func GetServerResponseForRequest(requestBytes []byte, networkType byte, connecti // reviewedIdentityType == "Mate" or "Host" - statusIsKnown, isFunded, _, _, err := verifiedFundedStatus.GetVerifiedIdentityIsFundedStatus(reportedIdentityHash, networkType) + statusIsKnown, isFunded, _, err := getFundedStatuses.GetIdentityIsFundedStatus(reportedIdentityHash, networkType) if (err != nil) { return nil, err } if (statusIsKnown == false || isFunded == false){ continue @@ -1820,7 +1820,7 @@ func GetServerResponseForRequest(requestBytes []byte, networkType byte, connecti reportedProfileHash := [28]byte(reportedHash) - statusIsKnown, isFunded, _, _, err := verifiedFundedStatus.GetVerifiedMateProfileIsFundedStatus(reportedProfileHash) + statusIsKnown, isFunded, _, err := getFundedStatuses.GetMateProfileIsFundedStatus(reportedProfileHash) if (err != nil) { return nil, err } if (statusIsKnown == false || isFunded == false){ continue @@ -1847,7 +1847,7 @@ func GetServerResponseForRequest(requestBytes []byte, networkType byte, connecti for _, profileHash := range attributeProfileHashesList{ - statusIsKnown, isFunded, _, _, err := verifiedFundedStatus.GetVerifiedMateProfileIsFundedStatus(profileHash) + statusIsKnown, isFunded, _, err := getFundedStatuses.GetMateProfileIsFundedStatus(profileHash) if (err != nil) { return false, err } if (statusIsKnown == true && isFunded == true){ return true, nil @@ -1934,7 +1934,7 @@ func GetServerResponseForRequest(requestBytes []byte, networkType byte, connecti for _, reportHash := range relevantReportHashesList{ - statusIsKnown, reportIsFunded, _, _, err := verifiedFundedStatus.GetVerifiedReportIsFundedStatus(reportHash) + statusIsKnown, reportIsFunded, _, err := getFundedStatuses.GetReportIsFundedStatus(reportHash) if (err != nil) { return nil, err } if (statusIsKnown == false || reportIsFunded == false){ continue @@ -2005,7 +2005,7 @@ func GetServerResponseForRequest(requestBytes []byte, networkType byte, connecti // We make sure message is funded - statusIsKnown, messageIsFunded, _, _, err := verifiedFundedStatus.GetVerifiedMessageIsFundedStatus(reportedMessageHash) + statusIsKnown, messageIsFunded, _, err := getFundedStatuses.GetMessageIsFundedStatus(reportedMessageHash) if (err != nil) { return nil, err } if (statusIsKnown == false || messageIsFunded == false){ continue @@ -2096,7 +2096,7 @@ func GetServerResponseForRequest(requestBytes []byte, networkType byte, connecti // We make sure message is funded - statusIsKnown, messageIsFunded, _, _, err := verifiedFundedStatus.GetVerifiedMessageIsFundedStatus(reportedMessageHash) + statusIsKnown, messageIsFunded, _, err := getFundedStatuses.GetMessageIsFundedStatus(reportedMessageHash) if (err != nil) { return nil, err } if (statusIsKnown == false || messageIsFunded == false){ continue @@ -2211,7 +2211,7 @@ func GetServerResponseForRequest(requestBytes []byte, networkType byte, connecti // reportedIdentityType == "Mate" or "Host" - statusIsKnown, isFunded, _, _, err := verifiedFundedStatus.GetVerifiedIdentityIsFundedStatus(reportedIdentityHash, networkType) + statusIsKnown, isFunded, _, err := getFundedStatuses.GetIdentityIsFundedStatus(reportedIdentityHash, networkType) if (err != nil) { return nil, err } if (statusIsKnown == false || isFunded == false){ continue @@ -2229,7 +2229,7 @@ func GetServerResponseForRequest(requestBytes []byte, networkType byte, connecti reportedProfileHash := [28]byte(reportedHash) - statusIsKnown, isFunded, _, _, err := verifiedFundedStatus.GetVerifiedMateProfileIsFundedStatus(reportedProfileHash) + statusIsKnown, isFunded, _, err := getFundedStatuses.GetMateProfileIsFundedStatus(reportedProfileHash) if (err != nil) { return nil, err } if (statusIsKnown == false || isFunded == false){ continue @@ -2255,7 +2255,7 @@ func GetServerResponseForRequest(requestBytes []byte, networkType byte, connecti for _, profileHash := range attributeProfileHashesList{ - statusIsKnown, isFunded, _, _, err := verifiedFundedStatus.GetVerifiedMateProfileIsFundedStatus(profileHash) + statusIsKnown, isFunded, _, err := getFundedStatuses.GetMateProfileIsFundedStatus(profileHash) if (err != nil) { return false, err } if (statusIsKnown == true && isFunded == true){ return true, nil @@ -2329,7 +2329,7 @@ func GetServerResponseForRequest(requestBytes []byte, networkType byte, connecti // userIdentityType == "Mate" or "Host" - statusIsKnown, isFunded, _, _, err := verifiedFundedStatus.GetVerifiedIdentityIsFundedStatus(userIdentityHash, networkType) + statusIsKnown, isFunded, _, err := getFundedStatuses.GetIdentityIsFundedStatus(userIdentityHash, networkType) if (err != nil) { return nil, err } if (statusIsKnown == false || isFunded == false){ continue @@ -2421,7 +2421,7 @@ func GetServerResponseForRequest(requestBytes []byte, networkType byte, connecti // profileIdentityType == "Mate" or "Host" - statusIsKnown, isFunded, _, _, err := verifiedFundedStatus.GetVerifiedIdentityIsFundedStatus(profileAuthor, networkType) + statusIsKnown, isFunded, _, err := getFundedStatuses.GetIdentityIsFundedStatus(profileAuthor, networkType) if (err != nil) { return nil, err } if (statusIsKnown == false || isFunded == false){ continue @@ -2432,7 +2432,7 @@ func GetServerResponseForRequest(requestBytes []byte, networkType byte, connecti if (profileIdentityType == "Mate"){ - statusIsKnown, isFunded, _, _, err := verifiedFundedStatus.GetVerifiedMateProfileIsFundedStatus(profileHash) + statusIsKnown, isFunded, _, err := getFundedStatuses.GetMateProfileIsFundedStatus(profileHash) if (err != nil) { return nil, err } if (statusIsKnown == false || isFunded == false){ continue @@ -2924,7 +2924,7 @@ func GetServerResponseForRequest(requestBytes []byte, networkType byte, connecti return responseBytes, nil } - //TODO: GetAddressDeposits, GetFundedStatuses + //TODO: GetAddressDeposits, GetIdentityPaymentProofs, GetMessagePaymentProofs // Request contains unknown requestType return invalidRequestResponse, nil diff --git a/internal/network/eligibleHosts/eligibleHosts.go b/internal/network/eligibleHosts/eligibleHosts.go index 6821a31..c5c7d5e 100644 --- a/internal/network/eligibleHosts/eligibleHosts.go +++ b/internal/network/eligibleHosts/eligibleHosts.go @@ -24,7 +24,7 @@ import "seekia/internal/myBlockedUsers" import "seekia/internal/network/enabledHosts" import "seekia/internal/network/unreachableHosts" import "seekia/internal/network/maliciousHosts" -import "seekia/internal/network/fundedStatus" +import "seekia/internal/network/getFundedStatuses" import "seekia/internal/profiles/viewableProfiles" import "seekia/internal/parameters/getParameters" @@ -142,7 +142,7 @@ func GetEligibleHostsList(networkType byte)([][16]byte, error){ for _, hostIdentityHash := range reachableHostsList{ - statusIsKnown, identityIsFunded, err := fundedStatus.GetIdentityIsFundedStatus(hostIdentityHash, networkType) + statusIsKnown, identityIsFunded, _, err := getFundedStatuses.GetIdentityIsFundedStatus(hostIdentityHash, networkType) if (err != nil) { return nil, err } if (statusIsKnown == true && identityIsFunded == false){ continue diff --git a/internal/network/fundedStatus/fundedStatus.go b/internal/network/fundedStatus/fundedStatus.go deleted file mode 100644 index 54bf6c0..0000000 --- a/internal/network/fundedStatus/fundedStatus.go +++ /dev/null @@ -1,122 +0,0 @@ - -// fundedStatus provides functions to check the funded status of identities, mate profiles, messages, and reports -// Some content must be funded via the account credit servers -// This package will retrieve from the verified and trusted funded status packages. - -package fundedStatus - -// Be aware that Funded means that the content/identity will be hosted by the network -// It may have been funded at one point in the past, but if it has expired, it is no longer considered Funded - -import "seekia/internal/helpers" -import "seekia/internal/network/verifiedFundedStatus" -import "seekia/internal/network/trustedFundedStatus" - -import "errors" - -//Outputs: -// -bool: Status is known (it may not be fully up to date, but it at least has been checked once) -// -bool: Identity is funded status -// -error -func GetIdentityIsFundedStatus(identityHash [16]byte, networkType byte)(bool, bool, error){ - - isValid := helpers.VerifyNetworkType(networkType) - if (isValid == false){ - networkTypeString := helpers.ConvertByteToString(networkType) - return false, false, errors.New("GetIdentityIsFundedStatus called with invalid networkType: " + networkTypeString) - } - - verifiedStatusIsKnown, verifiedIdentityIsFundedStatus, _, timeOfCheckingVerified, err := verifiedFundedStatus.GetVerifiedIdentityIsFundedStatus(identityHash, networkType) - if (err != nil) { return false, false, err } - - trustedStatusIsKnown, trustedIdentityIsFundedStatus, timeOfCheckingTrusted, err := trustedFundedStatus.GetTrustedIdentityIsFundedStatus(identityHash, networkType) - if (err != nil) { return false, false, err } - - if (verifiedStatusIsKnown == false && trustedStatusIsKnown == false){ - return false, false, nil - } - - if (verifiedStatusIsKnown == true && trustedStatusIsKnown == false){ - return true, verifiedIdentityIsFundedStatus, nil - } - if (verifiedStatusIsKnown == false && trustedStatusIsKnown == true){ - return true, trustedIdentityIsFundedStatus, nil - } - - // Both statuses are known and are the same - if (verifiedIdentityIsFundedStatus == trustedIdentityIsFundedStatus){ - return true, verifiedIdentityIsFundedStatus, nil - } - - // Both statuses are known, and they disagree. - // We rely on the verified status more, unless it is older than the trusted status by at least 1 day - - if (timeOfCheckingTrusted > (timeOfCheckingVerified + 86400)){ - return true, trustedIdentityIsFundedStatus, nil - } - - return true, verifiedIdentityIsFundedStatus, nil -} - - -// Outputs: -// -bool: Status is known -// -bool: Profile is funded status -// -error -func GetMateProfileIsFundedStatus(profileHash [28]byte)(bool, bool, error){ - - statusIsKnown, profileIsFunded, _, _, err := verifiedFundedStatus.GetVerifiedMateProfileIsFundedStatus(profileHash) - if (err != nil) { return false, false, err } - if (statusIsKnown == true){ - return true, profileIsFunded, nil - } - - statusIsKnown, profileIsFunded, err = trustedFundedStatus.GetTrustedMateProfileIsFundedStatus(profileHash) - if (err != nil) { return false, false, err } - if (statusIsKnown == true){ - return true, profileIsFunded, nil - } - - return false, false, nil -} - - -//Outputs: -// -bool: Status is known -// -bool: Message is funded -// -error -func GetMessageIsFundedStatus(messageHash [26]byte)(bool, bool, error){ - - statusIsKnown, messageIsFunded, _, _, err := verifiedFundedStatus.GetVerifiedMessageIsFundedStatus(messageHash) - if (err != nil) { return false, false, err } - if (statusIsKnown == true){ - return true, messageIsFunded, nil - } - - statusIsKnown, messageIsFunded, err = trustedFundedStatus.GetTrustedMessageIsFundedStatus(messageHash) - if (err != nil) { return false, false, err } - if (statusIsKnown == true){ - return true, messageIsFunded, nil - } - - return false, false, nil -} - -func GetReportIsFundedStatus(reportHash [30]byte)(bool, bool, error){ - - statusIsKnown, reportIsFunded, _, _, err := verifiedFundedStatus.GetVerifiedReportIsFundedStatus(reportHash) - if (err != nil) { return false, false, err } - if (statusIsKnown == true){ - return true, reportIsFunded, nil - } - - statusIsKnown, reportIsFunded, err = trustedFundedStatus.GetTrustedReportIsFundedStatus(reportHash) - if (err != nil) { return false, false, err } - if (statusIsKnown == true){ - return true, reportIsFunded, nil - } - - return false, false, nil -} - - diff --git a/internal/network/getFundedStatuses/getFundedStatuses.go b/internal/network/getFundedStatuses/getFundedStatuses.go new file mode 100644 index 0000000..5b872c0 --- /dev/null +++ b/internal/network/getFundedStatuses/getFundedStatuses.go @@ -0,0 +1,98 @@ + +// getFundedStatuses provides functions to retrieve the funded status of identities, messages, profiles, and reports +// Funded statuses are determined by payment proofs and their associated blockchain address deposits +// If the user is hosting their own blockchain, this package will retrieve those address deposits from the user's own node +// If the user is not hosting their own blockchain, this package will retrieve those address deposits from other hosts + +package getFundedStatuses + +// Be aware that Funded means that the content/identity will be hosted by the network +// It may have been funded at one point in the past, but if it has expired, it is no longer considered Funded + +//TODO: Build this package + +// For our own funded statuses, we use different packages: +// myIdentityBalance for our identities, and myFundedStatus for content +// This is because we want to store our own payment proofs in a seperate place than the database + +// The status being known for a particular status means that we at least tried to retrieve a payment proof and checked its balance. +// The problem is that we never truly know if the content is actually funded, as a payment proof could be hard to download from the network +// It is still useful to know if the status is known, as this will help with pruning unfunded content from our database. + +import "seekia/internal/encoding" +import "seekia/internal/helpers" +import "seekia/internal/identity" + +import "errors" + +// This should only be used for Mate/Host identities +// Moderator identities are funded through identity scores, which use blockchain(s) without payment proofs +//Outputs: +// -bool: Status is known +// -bool: Identity is funded +// -int64: Time of expiration +// -error +func GetIdentityIsFundedStatus(identityHash [16]byte, networkType byte)(bool, bool, int64, error){ + + identityType, err := identity.GetIdentityTypeFromIdentityHash(identityHash) + if (err != nil) { + identityHashHex := encoding.EncodeBytesToHexString(identityHash[:]) + return false, false, 0, errors.New("GetIdentityIsFundedStatus called with invalid identityHash: " + identityHashHex) + } + if (identityType != "Mate" && identityType != "Host"){ + return false, false, 0, errors.New("GetIdentityIsFundedStatus called with Host identity: " + identityType) + } + + isValid := helpers.VerifyNetworkType(networkType) + if (isValid == false){ + networkTypeString := helpers.ConvertByteToString(networkType) + return false, false, 0, errors.New("GetIdentityIsFundedStatus called with invalid networkType: " + networkTypeString) + } + + //TODO + + return true, true, 10000000000000, nil +} + + +//Outputs: +// -bool: Status is known +// -bool: Profile Is Funded +// -int64: Time of expiration +// -error +func GetMateProfileIsFundedStatus(profileHash [28]byte)(bool, bool, int64, error){ + + //TODO + + return true, true, 10000000000000, nil +} + + +//Outputs: +// -bool: Status is known +// -bool: Message Is funded +// -int64: Time of expiration +// -error +func GetMessageIsFundedStatus(messageHash [26]byte)(bool, bool, int64, error){ + + //TODO + // The size of the message is needed to get the isFunded status. + // We will use contentMetadata for this. + + return true, true, 10000000000000, nil +} + + +//Outputs: +// -bool: Status is known +// -bool: Report Is funded +// -int64: Time of expiration +// -error +func GetReportIsFundedStatus(reportHash [30]byte)(bool, bool, int64, error){ + + //TODO + + return true, true, 10000000000000, nil +} + + diff --git a/internal/network/networkJobs/networkJobs.go b/internal/network/networkJobs/networkJobs.go index 9545901..4cfcf9f 100644 --- a/internal/network/networkJobs/networkJobs.go +++ b/internal/network/networkJobs/networkJobs.go @@ -54,7 +54,7 @@ import "seekia/internal/myIdentity" import "seekia/internal/myLikedUsers" import "seekia/internal/myRanges" import "seekia/internal/mySettings" -import "seekia/internal/network/fundedStatus" +import "seekia/internal/network/getFundedStatuses" import "seekia/internal/network/mateCriteria" import "seekia/internal/network/myMateCriteria" import "seekia/internal/network/queryHosts" @@ -65,6 +65,7 @@ import "seekia/internal/profiles/viewableProfiles" import "errors" + // This function will download and update the network-wide parameters files func DownloadParameters(networkType byte)error{ @@ -271,7 +272,7 @@ func DownloadMateOutlierProfiles(outlierType string, networkType byte, missingOr for _, userIdentityHash := range myOutlierIdentitiesList{ - statusIsKnown, identityIsFunded, err := fundedStatus.GetIdentityIsFundedStatus(userIdentityHash, networkType) + statusIsKnown, identityIsFunded, _, err := getFundedStatuses.GetIdentityIsFundedStatus(userIdentityHash, networkType) if (err != nil) { return err } if (statusIsKnown == true && identityIsFunded == false){ @@ -1515,7 +1516,7 @@ func DownloadMateViewableStatusesForBrowsing(networkType byte, knownOrUnknown st for _, userIdentityHash := range allMateProfileIdentityHashesList{ - statusIsKnown, identityIsFunded, err := fundedStatus.GetIdentityIsFundedStatus(userIdentityHash, networkType) + statusIsKnown, identityIsFunded, _, err := getFundedStatuses.GetIdentityIsFundedStatus(userIdentityHash, networkType) if (err != nil) { return err } if (statusIsKnown == true && identityIsFunded == false){ @@ -1687,7 +1688,7 @@ func DownloadMateOutlierViewableStatuses(outlierType string, networkType byte, k for _, mateIdentityHash := range myOutlierIdentityHashesList{ - statusIsKnown, identityIsFunded, err := fundedStatus.GetIdentityIsFundedStatus(mateIdentityHash, networkType) + statusIsKnown, identityIsFunded, _, err := getFundedStatuses.GetIdentityIsFundedStatus(mateIdentityHash, networkType) if (err != nil) { return err } if (statusIsKnown == true && identityIsFunded == false){ diff --git a/internal/network/serverRequest/serverRequest.go b/internal/network/serverRequest/serverRequest.go index 17946cd..f70bab5 100644 --- a/internal/network/serverRequest/serverRequest.go +++ b/internal/network/serverRequest/serverRequest.go @@ -21,11 +21,14 @@ package serverRequest // See a description of each request and its purpose in Specification.md -//TODO: Add GetFundedStatuses -// Will be used to get the identity/profile IsFunded statuses from hosts -// This will lessen the load on the credit account servers -// We don't need this for messages, because we will always retrieve their fundedStatuses directly from the credits servers -// Retrieving them from hosts is a privacy risk, and will take too long to retrieve individually +//TODO: Add GetIdentityPaymentProofs and GetMessagePaymentProofs +// Will be used to get payment proofs from hosts +// We need this because hosts can provide us with invalid payment proofs for content +// This is also needed because we don't download identity payment proofs when downloading profiles. +// Identities can also broadcast multiple payment proofs + +//TODO: Add payment proofs to the BroadcastContent, GetProfiles, GetMessages, etc... requests. +// Payment proofs must be shared whenever we download or broadcast a piece of content import "seekia/internal/cryptography/chaPolyShrink" import "seekia/internal/encoding" diff --git a/internal/network/trustedFundedStatus/trustedFundedStatus.go b/internal/network/trustedFundedStatus/trustedFundedStatus.go deleted file mode 100644 index 73c54c4..0000000 --- a/internal/network/trustedFundedStatus/trustedFundedStatus.go +++ /dev/null @@ -1,67 +0,0 @@ - -// trustedFundedStatus provides functions to store and retrieve the trusted funded status of identities, messages, profiles, and reports -// "trusted" means we are retrieving funded statuses from hosts -// This is different from verifiedFundedStatus, which retrieves the statuses from the account credit servers - -package trustedFundedStatus - -// For our own funded statuses, we use different packages: -// myIdentityBalance for our identities, and myFundedStatus for content -// This is because we want to use the account credit servers for our own statuses, -// and we want to store the statuses in myDatastores instead of the badgerDatabase - -//TODO: Build this package -// We need to make fundedStatus requests to hosts -// We should store the statuses in badgerDatabase -// If a status has not been checked in 1 month, it should be considered unknown - -//Outputs: -// -bool: Funded status is known -// -bool: Identity is funded -// -int64: Last time we checked -// -error -func GetTrustedIdentityIsFundedStatus(userIdentityHash [16]byte, networkType byte)(bool, bool, int64, error){ - - //TODO - - return true, true, 0, nil -} - -//Outputs: -// -bool: Funded status is known -// -bool: Profile is funded -// -error -func GetTrustedMateProfileIsFundedStatus(profileHash [28]byte)(bool, bool, error){ - - //TODO - - return true, true, nil -} - -//Outputs: -// -bool: Funded status is known -// -bool: Message is funded -// -error -func GetTrustedMessageIsFundedStatus(messageHash [26]byte)(bool, bool, error){ - - //TODO - - return true, true, nil -} - - -//Outputs: -// -bool: Funded status is known -// -bool: Report is funded -// -error -func GetTrustedReportIsFundedStatus(reportHash [30]byte)(bool, bool, error){ - - //TODO - - return true, true, nil -} - - - - - diff --git a/internal/network/verifiedFundedStatus/verifiedFundedStatus.go b/internal/network/verifiedFundedStatus/verifiedFundedStatus.go deleted file mode 100644 index 1b5c849..0000000 --- a/internal/network/verifiedFundedStatus/verifiedFundedStatus.go +++ /dev/null @@ -1,107 +0,0 @@ - -// verifiedFundedStatus provides functions to store and retrieve the verified funded status of identities, messages, profiles, and reports -// "verified" means we are retrieving statuses from the account credit servers -// This is different from trustedFundedStatus, which retrieves the information from hosts - -package verifiedFundedStatus - -// We only have to check the status once for mate profiles, reports, and messages -// This is because for those types of content, they can only be funded once, and their time cannot be increased -// A user will only broadcast their profile/report/message after it has been funded -// If we are aware of a profile/report/message hash, we know it must either be funded, or it is created by a malicious entity. - -// We keep track of the last time we checked each status -// This enables us to disregard statuses we received when the credits servers were hacked, if the servers are ever hacked -// The parameters will describe the time period during which the server(s) were hacked -// The app should disregard any information it received from the servers during this time -//TODO: Add a serverIdentifier to the hacked notification, and keep track of which server we received from, -// so we can disregard only what the compromised servers told us? - -//TODO: Build this package -// Hosts must retrieve funded status information from the account credit servers -// We should store the statuses in badgerDatabase -// If an identity status has not been checked in 1 month, it should be considered unknown - -import "seekia/internal/encoding" -import "seekia/internal/helpers" -import "seekia/internal/identity" - -import "errors" - -// This should only be used for Mate/Host identities -// Moderator identities are funded through identity scores, which use blockchain(s), not the account credit servers -//Outputs: -// -bool: Status is known -// -bool: Identity is funded -// -int64: Time of expiration -// -int64: Last time we checked -// -error -func GetVerifiedIdentityIsFundedStatus(identityHash [16]byte, networkType byte)(bool, bool, int64, int64, error){ - - identityType, err := identity.GetIdentityTypeFromIdentityHash(identityHash) - if (err != nil) { - identityHashHex := encoding.EncodeBytesToHexString(identityHash[:]) - return false, false, 0, 0, errors.New("GetVerifiedIdentityIsFundedStatus called with invalid identityHash: " + identityHashHex) - } - if (identityType != "Mate" && identityType != "Host"){ - return false, false, 0, 0, errors.New("GetVerifiedIdentityIsFundedStatus called with Host identity: " + identityType) - } - - isValid := helpers.VerifyNetworkType(networkType) - if (isValid == false){ - networkTypeString := helpers.ConvertByteToString(networkType) - return false, false, 0, 0, errors.New("GetVerifiedIdentityIsFundedStatus called with invalid networkType: " + networkTypeString) - } - - //TODO - - return true, true, 1, 100, nil -} - - -//Outputs: -// -bool: Status is known -// -bool: Profile Is Funded -// -int64: Time of expiration -// -int64: Last time we checked (the expiration time will never change once funded) -// -error -func GetVerifiedMateProfileIsFundedStatus(profileHash [28]byte)(bool, bool, int64, int64, error){ - - //TODO - - - return true, true, 100000000000, 100, nil -} - - -//Outputs: -// -bool: Status is known -// -bool: Message Is funded -// -int64: Time of expiration -// -int64: Last time we checked (the expiration time will never change once funded) -// -error -func GetVerifiedMessageIsFundedStatus(messageHash [26]byte)(bool, bool, int64, int64, error){ - - //TODO - // The size of the message is needed to get the isFunded status. - // We will use contentMetadata for this. - - return true, true, 1, 100, nil -} - - -//Outputs: -// -bool: Status is known -// -bool: Report Is funded -// -bool: Report was funded at one point in time -// -int64: Time of expiration -// -int64: Last time we checked (the expiration time will never change once funded) -// -error -func GetVerifiedReportIsFundedStatus(reportHash [30]byte)(bool, bool, int64, int64, error){ - - //TODO - - return true, true, 1, 100, nil -} - -