Documentation
¶
Index ¶
Constants ¶
const ( // APIVersion defines the version number for this code. APIVersion = 1 // ResultOK indicates the operation completed successfully. ResultOK = 0 // ResultExistsError indicates the digest already exists and was // rejected. ResultExistsError = 1 // ResultDoesntExistError indiciates the timestamp or digest does not // exist. ResultDoesntExistError = 2 // ResultDisabled indicates querying is disabled. ResultDisabled = 3 // DefaultMainnetTimeHost indicates the default mainnet time host // server. DefaultMainnetTimeHost = "time.decred.org" // DefaultMainnetTimePort indicates the default mainnet time host // port. DefaultMainnetTimePort = "49152" // DefaultTestnetTimeHost indicates the default testnet time host // server. DefaultTestnetTimeHost = "time-testnet.decred.org" // DefaultTestnetTimePort indicates the default testnet time host // port. DefaultTestnetTimePort = "59152" )
Variables ¶
var ( // RoutePrefix is the route url prefix for this version. RoutePrefix = fmt.Sprintf("/v%v", APIVersion) // StatusRoute defines the API route for retrieving // the server status. StatusRoute = RoutePrefix + "/status/" // TimestampRoute defines the API route for submitting // both timestamps and digests. TimestampRoute = RoutePrefix + "/timestamp/" // VerifyRoute defines the API route for both timestamp // and digest verification. VerifyRoute = RoutePrefix + "/verify/" // Multi verify digest // WalletBalanceRoute defines the API route for retrieving // the account balance from dcrtimed's wallet instance WalletBalanceRoute = RoutePrefix + "/balance" // LastAnchorRoute defines the API route for retrieving // info about last successful anchor, such as // timestamp, block height & tx id LastAnchorRoute = RoutePrefix + "/last" // Result defines legible string messages to a timestamping/query // result code. Result = map[int]string{ ResultOK: "OK", ResultExistsError: "Exists", ResultDoesntExistError: "Doesn't exist", ResultDisabled: "Query disallowed", } // RegexpSHA256 is the valid text representation of a sha256 digest. RegexpSHA256 = regexp.MustCompile("^[A-Fa-f0-9]{64}$") // RegexpTimestamp is the valid text representation of a timestamp. RegexpTimestamp = regexp.MustCompile("^[0-9]{10}$") )
Functions ¶
This section is empty.
Types ¶
type ChainInformation ¶
type CollectionInformation ¶
type LastAnchorReply ¶
type Status ¶
type Status struct {
ID string `json:"id"`
}
Status is used to ask the server if everything is running properly. ID is user settable and can be used as a unique identifier by the client.
type StatusReply ¶
type StatusReply struct {
ID string `json:"id"`
}
StatusReply is returned by the server if everything is running properly.
type Timestamp ¶
Timestamp is used to ask the timestamp server to store a batch of digests. ID is user settable and can be used as a unique identifier by the client.
type TimestampReply ¶
type TimestampReply struct { ID string `json:"id"` ServerTimestamp int64 `json:"servertimestamp"` Digests []string `json:"digests"` Results []int `json:"results"` }
TimestampReply is returned by the timestamp server after storing the batch of digests. ID is copied from the originating Timestamp call and can be used by the client as a unique identifier. The ServerTimestamp indicates what collection the Digests belong to. Results contains individual result codes for each digest.
type VerifyDigest ¶
type VerifyDigest struct { Digest string `json:"digest"` ServerTimestamp int64 `json:"servertimestamp"` Result int `json:"result"` ChainInformation ChainInformation `json:"chaininformation"` }
type VerifyReply ¶
type VerifyReply struct { ID string `json:"id"` Digests []VerifyDigest `json:"digests"` Timestamps []VerifyTimestamp `json:"timestamps"` }
type VerifyTimestamp ¶
type VerifyTimestamp struct { ServerTimestamp int64 `json:"servertimestamp"` Result int `json:"result"` CollectionInformation CollectionInformation `json:"collectioninformation"` }
VerifyTimestamp is zero if this digest collection is not anchored in the blockchain; it is however set to the block timestamp it was anchored in.