vct

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2023 License: Apache-2.0 Imports: 20 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateLeafHash

func CalculateLeafHash(timestamp uint64, vcBytes []byte, loader jsonld.DocumentLoader) (string, error)

CalculateLeafHash calculates hash for given credentials.

func VerifyVCTimestampSignature

func VerifyVCTimestampSignature(signature, pubKey []byte, timestamp uint64, vcBytes []byte,
	loader jsonld.DocumentLoader) error

VerifyVCTimestampSignature verifies VC timestamp signature.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client represents VCT REST client.

func New

func New(endpoint string, opts ...ClientOpt) *Client

New returns VCT REST client.

func (*Client) AddVC

func (c *Client) AddVC(ctx context.Context, credential []byte) (*command.AddVCResponse, error)

AddVC adds verifiable credential to log.

func (*Client) GetEntries

func (c *Client) GetEntries(ctx context.Context, start, end uint64) (*command.GetEntriesResponse, error)

GetEntries retrieves entries from log.

func (*Client) GetEntryAndProof

func (c *Client) GetEntryAndProof(ctx context.Context, leafIndex, treeSize uint64) (*command.GetEntryAndProofResponse, error)

GetEntryAndProof retrieves entry and merkle audit proof from log.

func (*Client) GetIssuers

func (c *Client) GetIssuers(ctx context.Context) ([]string, error)

GetIssuers returns issuers.

func (*Client) GetProofByHash

func (c *Client) GetProofByHash(ctx context.Context, hash string, treeSize uint64) (*command.GetProofByHashResponse, error)

GetProofByHash retrieves Merkle Audit proof from Log by leaf hash.

func (*Client) GetSTH

func (c *Client) GetSTH(ctx context.Context) (*command.GetSTHResponse, error)

GetSTH retrieves latest signed tree head.

func (*Client) GetSTHConsistency

func (c *Client) GetSTHConsistency(ctx context.Context, first, second uint64) (*command.GetSTHConsistencyResponse, error)

GetSTHConsistency retrieves merkle consistency proofs between signed tree heads.

func (*Client) HealthCheck added in v1.0.0

func (c *Client) HealthCheck(ctx context.Context) error

HealthCheck check health.

func (*Client) Webfinger added in v0.1.2

func (c *Client) Webfinger(ctx context.Context) (*command.WebFingerResponse, error)

Webfinger returns discovery info.

type ClientOpt

type ClientOpt func(client *Client)

ClientOpt represents client option func.

func WithAuthReadToken added in v1.0.0

func WithAuthReadToken(authToken string) ClientOpt

WithAuthReadToken add auth token.

func WithAuthWriteToken added in v1.0.0

func WithAuthWriteToken(authToken string) ClientOpt

WithAuthWriteToken add auth token.

func WithHTTPClient

func WithHTTPClient(client HTTPClient) ClientOpt

WithHTTPClient allows providing HTTP client.

func WithLedgerURI added in v1.0.0

func WithLedgerURI(ledgerURI string) ClientOpt

WithLedgerURI sets the ledger URI. By default, the ledger URI is set to the endpoint URL.

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPClient represents HTTP client.

Jump to

Keyboard shortcuts

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