api

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultPaginationSize = 20

Variables

This section is empty.

Functions

This section is empty.

Types

type APIDataResponse

type APIDataResponse struct {
	Type        types.String       `` /* 146-byte string literal not displayed */
	MerkleState *MerkleState       `json:"merkleState,omitempty" form:"merkleState" query:"merkleState"`
	Data        *json.RawMessage   `json:"data" form:"data" query:"data"`
	Origin      types.String       `json:"sponsor" form:"sponsor" query:"sponsor" validate:"required"` // retain 'sponsor' for backwards compatability
	KeyPage     *APIRequestKeyPage `json:"keyPage" form:"keyPage" query:"keyPage" validate:"required"`
	TxId        *types.Bytes       `json:"txid" form:"txid" query:"txid"`
	//the following are optional available only if pending chain has not been purged
	Signer *Signer          `json:"signer,omitempty" form:"signer" query:"signer"`
	Sig    *types.Bytes64   `json:"sig,omitempty" form:"sig" query:"sig"`
	Status *json.RawMessage `json:"status,omitempty" form:"status" query:"status"`
}

APIDataResponse is used in "get" API method response

type APIDataResponsePagination

type APIDataResponsePagination struct {
	Data  []*APIDataResponse `json:"data"`
	Type  types.String       `json:"type"`
	Start int64              `json:"start"`
	Limit int64              `json:"limit"`
	Total int64              `json:"total"`
}

APIDataResponsePagination is APIDataResponse with pagination data

type APIRequestChainId

type APIRequestChainId struct {
	ChainId types.Bytes `json:"chainId" form:"chainId" query:"chainId" validate:"required"`
	Wait    bool        `json:"wait" form:"wait" query:"wait"`
}

APIRequestChainId is used to unmarshal URL param into API methods, that retrieves data by URL

type APIRequestKeyPage

type APIRequestKeyPage struct {
	Height uint64 `json:"height" form:"height" query:"height" validate:"required"`
	Index  uint64 `json:"index" form:"index" query:"index"`
}

APIRequestKeyPage specifies the key page used to sign the transaction. The index is the index of the key page within its key book. The height is the height of the key page chain.

type APIRequestRaw

type APIRequestRaw struct {
	Wait bool             `json:"wait" form:"wait" query:"wait"`
	Tx   *APIRequestRawTx `json:"tx" form:"tx" query:"tx" validate:"required"`
}

APIRequestRaw will leave the data payload intact which is required for signature verification

type APIRequestRawTx

type APIRequestRawTx struct {
	Origin  types.String       `json:"sponsor" form:"sponsor" query:"sponsor" validate:"required"` // retain 'sponsor' for backwards compatability
	Data    *json.RawMessage   `json:"data" form:"data" query:"data" validate:"required"`
	Signer  *Signer            `json:"signer" form:"signer" query:"signer" validate:"required"`
	Sig     types.Bytes64      `json:"sig" form:"sig" query:"sig" validate:"required"`
	KeyPage *APIRequestKeyPage `json:"keyPage" form:"keyPage" query:"keyPage" validate:"required"`
}

APIRequestRawTx is used to maintain the integrety of the Data field when it is read in The data field is used to verify the signature. The transaction ledger is the concatenation of ( sha256(Signer.URL) | Data | Timestamp ). The txid is the sha256(ledger) and the signature is ed25519( ledger )

type APIRequestTxId

type APIRequestTxId struct {
	TxId types.Bytes `json:"txid" form:"txid" query:"txid" validate:"required"`
	Wait bool        `json:"wait" form:"wait" query:"wait"`
}

APIRequestTxId is used to unmarshal URL param into API methods, that retrieves data by URL

type APIRequestURL

type APIRequestURL struct {
	URL  types.String `json:"url" form:"url" query:"url" validate:"required"`
	Wait bool         `json:"wait" form:"wait" query:"wait"`
}

APIRequestURL is used to unmarshal URL param into API methods, that retrieves data by URL

type APIRequestURLPagination

type APIRequestURLPagination struct {
	APIRequestURL
	Start int64 `json:"start" validate:"number,gte=0"`
	Limit int64 `json:"limit" validate:"number,gt=0"`
}

APIRequestURLPagination is APIRequestURL with pagination params

func (*APIRequestURLPagination) UnmarshalJSON

func (p *APIRequestURLPagination) UnmarshalJSON(data []byte) error

UnmarshalJSON is custom Unmarshal for APIRequestURLPagination

type MerkleState

type MerkleState struct {
	Count uint64        `json:"count,omitempty" form:"count" query:"count"`
	Roots []types.Bytes `json:"roots,omitempty" form:"roots" query:"roots"`
}

type Signer

type Signer struct {
	PublicKey types.Bytes32 `json:"publicKey" form:"publicKey" query:"publicKey" validate:"required"`
	Nonce     uint64        `json:"nonce" form:"nonce" query:"nonce" validate:"required"`
}

Signer holds the ADI and public key to use to verify the transaction

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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