v1

package
v0.0.0-...-f028303 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 20, 2019 License: ISC Imports: 2 Imported by: 3

Documentation

Index

Constants

View Source
const (
	// StatusRoute defines the API route for retrieving
	// the server status.
	StatusRoute = "/v1/status/"

	// TimestampRoute defines the API route for submitting
	// both timestamps and digests.
	TimestampRoute = "/v1/timestamp/"

	// VerifyRoute defines the API route for both timestamp
	// and digest verification.
	VerifyRoute = "/v1/verify/" // Multi verify ingest

	// 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.bitum.io"

	// DefaultMainnetTimePort indicates the default mainnet time host
	// port.
	DefaultMainnetTimePort = "49152"

	// DefaultTestnetTimeHost indicates the default testnet time host
	// server.
	DefaultTestnetTimeHost = "time-testnet.bitum.io"

	// DefaultTestnetTimePort indicates the default testnet time host
	// port.
	DefaultTestnetTimePort = "59152"
)

Variables

View Source
var (
	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 ChainInformation struct {
	ChainTimestamp int64         `json:"chaintimestamp"`
	Transaction    string        `json:"transaction"`
	MerkleRoot     string        `json:"merkleroot"`
	MerklePath     merkle.Branch `json:"merklepath"`
}

type CollectionInformation

type CollectionInformation struct {
	ChainTimestamp int64    `json:"chaintimestamp"`
	Transaction    string   `json:"transaction"`
	MerkleRoot     string   `json:"merkleroot"`
	Digests        []string `json:"digests"`
}

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

type Timestamp struct {
	ID      string   `json:"id"`
	Digests []string `json:"digests"`
}

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 Verify

type Verify struct {
	ID         string   `json:"id"`
	Digests    []string `json:"digests"`
	Timestamps []int64  `json:"timestamps"`
}

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL