Documentation
¶
Index ¶
- Constants
- type AddVCRequest
- type AddVCResponse
- type Cmd
- func (c *Cmd) AddVC(w io.Writer, r io.Reader) error
- func (c *Cmd) GetEntries(w io.Writer, r io.Reader) error
- func (c *Cmd) GetEntryAndProof(w io.Writer, r io.Reader) error
- func (c *Cmd) GetHandlers() []Handler
- func (c *Cmd) GetIssuers(w io.Writer, r io.Reader) error
- func (c *Cmd) GetProofByHash(w io.Writer, r io.Reader) error
- func (c *Cmd) GetSTH(w io.Writer, r io.Reader) error
- func (c *Cmd) GetSTHConsistency(w io.Writer, r io.Reader) error
- func (c *Cmd) Webfinger(w io.Writer, r io.Reader) error
- type CmdHandler
- type Config
- type Crypto
- type DigitallySigned
- type Exec
- type GetEntriesRequest
- type GetEntriesResponse
- type GetEntryAndProofRequest
- type GetEntryAndProofResponse
- type GetProofByHashRequest
- type GetProofByHashResponse
- type GetSTHConsistencyRequest
- type GetSTHConsistencyResponse
- type GetSTHResponse
- type Handler
- type Key
- type KeyManager
- type LeafEntry
- type Log
- type LogEntryType
- type MerkleLeafType
- type MerkleTreeLeaf
- type SignatureAlgorithm
- type SignatureAndHashAlgorithm
- type SignatureType
- type TimestampedEntry
- type TreeHeadSignature
- type TrillianLogClient
- type VCTimestampSignature
- type Version
- type WebFingerLink
- type WebFingerResponse
Constants ¶
const ( GetSTH = "getSTH" GetSTHConsistency = "getSTHConsistency" GetEntries = "getEntries" GetProofByHash = "getProofByHash" GetEntryAndProof = "getEntryAndProof" GetIssuers = "getIssuers" Webfinger = "webfinger" AddVC = "addVC" )
Command methods.
const ( // PublicKeyType is the public key property in the Webfinger document. PublicKeyType = "https://trustbloc.dev/ns/public-key" // LedgerType is the ledger type property in the Webfinger document. LedgerType = "https://trustbloc.dev/ns/ledger-type" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddVCRequest ¶ added in v0.1.2
AddVCRequest represents the request to add-vc.
type AddVCResponse ¶
type AddVCResponse struct {
SVCTVersion Version `json:"svct_version"`
ID []byte `json:"id"`
Timestamp uint64 `json:"timestamp"`
Extensions string `json:"extensions"`
Signature []byte `json:"signature"`
}
AddVCResponse represents the response to add-vc.
type Cmd ¶
Cmd is a controller for commands.
func New ¶
func New(cfg *Config, mf monitoring.MetricFactory) (*Cmd, error)
New returns commands controller.
func (*Cmd) GetEntries ¶
GetEntries retrieves entries from log.
func (*Cmd) GetEntryAndProof ¶
GetEntryAndProof retrieves entry and merkle audit proof from log.
func (*Cmd) GetHandlers ¶
GetHandlers returns list of all commands supported by this controller.
func (*Cmd) GetIssuers ¶
GetIssuers returns issuers.
func (*Cmd) GetProofByHash ¶
GetProofByHash retrieves Merkle Audit proof from Log by leaf hash.
func (*Cmd) GetSTHConsistency ¶
GetSTHConsistency retrieves merkle consistency proofs between signed tree heads.
type CmdHandler ¶
type CmdHandler struct {
// contains filtered or unexported fields
}
CmdHandler contains command handling details which can be used to build controller commands.
func NewCmdHandler ¶
func NewCmdHandler(method string, exec Exec) *CmdHandler
NewCmdHandler returns instance of CmdHandler which can be used handle controller commands.
func (*CmdHandler) Handle ¶
func (c *CmdHandler) Handle() Exec
Handle returns execute function of this command handler.
type Config ¶
type Config struct {
KMS KeyManager
Crypto Crypto
VDR vdr.Registry
Logs []Log
DocumentLoaders map[string]jsonld.DocumentLoader // alias -> loader
Key Key
BaseURL string
}
Config for the Cmd.
type DigitallySigned ¶
type DigitallySigned struct {
Algorithm SignatureAndHashAlgorithm `json:"algorithm"`
Signature []byte `json:"signature"`
}
DigitallySigned provides information about a signature.
type GetEntriesRequest ¶
type GetEntriesRequest struct {
Alias string `json:"alias"`
Start int64 `json:"start"`
End int64 `json:"end"`
}
GetEntriesRequest represents the request to the get-entries.
func (*GetEntriesRequest) Validate ¶
func (r *GetEntriesRequest) Validate() error
Validate validates data.
type GetEntriesResponse ¶
type GetEntriesResponse struct {
Entries []LeafEntry `json:"entries"`
}
GetEntriesResponse represents the response to the get-entries.
type GetEntryAndProofRequest ¶
type GetEntryAndProofRequest struct {
Alias string `json:"alias"`
LeafIndex int64 `json:"leaf_index"`
TreeSize int64 `json:"tree_size"`
}
GetEntryAndProofRequest represents the request to get-entry-and-proof.
func (*GetEntryAndProofRequest) Validate ¶
func (r *GetEntryAndProofRequest) Validate() error
Validate validates data.
type GetEntryAndProofResponse ¶
type GetEntryAndProofResponse struct {
LeafInput []byte `json:"leaf_input"`
ExtraData []byte `json:"extra_data"`
AuditPath [][]byte `json:"audit_path"`
}
GetEntryAndProofResponse represents the response to get-entry-and-proof.
type GetProofByHashRequest ¶
type GetProofByHashRequest struct {
Alias string `json:"alias"`
Hash string `json:"hash"`
TreeSize int64 `json:"tree_size"`
}
GetProofByHashRequest represents the request to the get-proof-by-hash.
func (*GetProofByHashRequest) Validate ¶
func (r *GetProofByHashRequest) Validate() error
Validate validates data.
type GetProofByHashResponse ¶
type GetProofByHashResponse struct {
LeafIndex int64 `json:"leaf_index"`
AuditPath [][]byte `json:"audit_path"`
}
GetProofByHashResponse represents the response to the get-proof-by-hash.
type GetSTHConsistencyRequest ¶
type GetSTHConsistencyRequest struct {
Alias string `json:"alias"`
FirstTreeSize int64 `json:"first_tree_size"`
SecondTreeSize int64 `json:"second_tree_size"`
}
GetSTHConsistencyRequest represents the request to the get-sth-consistency.
func (*GetSTHConsistencyRequest) Validate ¶
func (r *GetSTHConsistencyRequest) Validate() error
Validate validates data.
type GetSTHConsistencyResponse ¶
type GetSTHConsistencyResponse struct {
Consistency [][]byte `json:"consistency"`
}
GetSTHConsistencyResponse represents the response to the get-sth-consistency.
type GetSTHResponse ¶
type GetSTHResponse struct {
TreeSize uint64 `json:"tree_size"`
Timestamp uint64 `json:"timestamp"`
SHA256RootHash []byte `json:"sha256_root_hash"`
TreeHeadSignature []byte `json:"tree_head_signature"`
}
GetSTHResponse represents the response to the get-sth.
type Handler ¶
type Handler interface {
// Method method name of the command
Method() string
// Handle execute function of the command
Handle() Exec
}
Handler for each controller command.
type KeyManager ¶
type KeyManager interface {
Create(kt kms.KeyType, opts ...kms.KeyOpts) (string, interface{}, error)
Get(keyID string) (interface{}, error)
ExportPubKeyBytes(keyID string) ([]byte, kms.KeyType, error)
}
KeyManager key manager.
type Log ¶ added in v0.1.2
type Log struct {
// ID trillian`s log id.
ID int64
Alias string
Permission string
Endpoint string
Issuers []string
Client TrillianLogClient
}
Log represents the log.
type LogEntryType ¶
type LogEntryType uint64
LogEntryType type definition.
const (
VCLogEntryType LogEntryType = 100
)
LogEntryType constants.
type MerkleLeafType ¶
type MerkleLeafType uint64
MerkleLeafType type definition.
const (
TimestampedEntryLeafType MerkleLeafType = 100
)
MerkleLeafType constants.
type MerkleTreeLeaf ¶
type MerkleTreeLeaf struct {
Version Version `json:"version"`
LeafType MerkleLeafType `json:"leaf_type"`
TimestampedEntry *TimestampedEntry `json:"timestamped_entry"`
}
MerkleTreeLeaf represents the deserialized structure of the hash input for the leaves of a log's Merkle tree.
func CreateLeaf ¶
func CreateLeaf(timestamp uint64, vcBytes []byte, loader jsonld.DocumentLoader) (*MerkleTreeLeaf, error)
CreateLeaf creates MerkleTreeLeaf.
type SignatureAlgorithm ¶
type SignatureAlgorithm string
SignatureAlgorithm type definition.
const ( ECDSASignature SignatureAlgorithm = "ECDSA" EDDSASignature SignatureAlgorithm = "EDDSA" )
SignatureAlgorithm constants.
type SignatureAndHashAlgorithm ¶
type SignatureAndHashAlgorithm struct {
Signature SignatureAlgorithm `json:"signature"`
Type kms.KeyType `json:"type"`
}
SignatureAndHashAlgorithm provides information about the algorithm used for the signature.
type SignatureType ¶
type SignatureType uint64
SignatureType differentiates signatures.
const ( VCTimestampSignatureType SignatureType = 100 TreeHeadSignatureType SignatureType = 101 )
SignatureType constants.
type TimestampedEntry ¶
type TimestampedEntry struct {
Timestamp uint64 `json:"timestamp"`
EntryType LogEntryType `json:"entry_type"`
VCEntry []byte `json:"vc_entry"`
Extensions []byte `json:"extensions"`
}
TimestampedEntry is part of the MerkleTreeLeaf structure.
type TreeHeadSignature ¶
type TreeHeadSignature struct {
Version Version `json:"version"`
SignatureType SignatureType `json:"signature_type"`
Timestamp uint64 `json:"timestamp"`
TreeSize uint64 `json:"tree_size"`
SHA256RootHash []byte `json:"sha_256_root_hash"`
}
TreeHeadSignature keeps the data over which the signature in an STH is created.
type TrillianLogClient ¶
type TrillianLogClient trillian.TrillianLogClient
TrillianLogClient is the API client for TrillianLog service.
type VCTimestampSignature ¶
type VCTimestampSignature struct {
SVCTVersion Version `json:"svct_version"`
SignatureType SignatureType `json:"signature_type"`
Timestamp uint64 `json:"timestamp"`
EntryType LogEntryType `json:"entry_type"`
VCEntry []byte `json:"vc_entry"`
Extensions []byte `json:"extensions"`
}
VCTimestampSignature keeps the data over which the signature is created.
func CreateVCTimestampSignature ¶
func CreateVCTimestampSignature(leaf *MerkleTreeLeaf) *VCTimestampSignature
CreateVCTimestampSignature creates VCTimestampSignature structure.
type Version ¶
type Version uint8
Version type definition.
const (
V1 Version = 0
)
Version constants.
type WebFingerLink ¶ added in v0.1.2
type WebFingerLink struct {
Rel string `json:"rel,omitempty"`
Type string `json:"type,omitempty"`
Href string `json:"href,omitempty"`
}
WebFingerLink web finger link.
type WebFingerResponse ¶ added in v0.1.2
type WebFingerResponse struct {
Subject string `json:"subject,omitempty"`
Properties map[string]interface{} `json:"properties,omitempty"`
Links []WebFingerLink `json:"links,omitempty"`
}
WebFingerResponse web finger response.