plc

package module
v0.0.0-...-5ec991b Latest Latest
Warning

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

Go to latest
Published: May 12, 2023 License: BSD-3-Clause Imports: 20 Imported by: 0

README

Go PLC Client

A client for working with a DID:Placeholder server. This is likely to change as the intent and specification for DID discovery changes.

TODO

  • add tests
  • add docs
  • add method for '/export'

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrIsTombstone = fmt.Errorf("plc client: did is marked as tombstone")
View Source
var ErrNotCBORCompatible = fmt.Errorf("plc client: not cbor compatible")
View Source
var ErrUnknownOperationType = fmt.Errorf("plc client: unknown operation type")

Functions

This section is empty.

Types

type AuditLog

type AuditLog struct {
	Did       string      `json:"did"`
	Cid       string      `json:"cid""`
	Operation interface{} `json:"operation"`
	Nullified bool        `json:"nullified"`
	CreatedAt time.Time   `json:"createdAt"`
}

type Client

type Client struct {
	Host string
	C    *http.Client
}

func New

func New(host string) *Client

func (*Client) CreateDID

func (c *Client) CreateDID(ctx context.Context, signer *did.PrivKey, recoveryDID, handle, pdsEndpoint string) (string, error)

func (*Client) GetAuditLog

func (c *Client) GetAuditLog(ctx context.Context, didstr string) ([]*AuditLog, error)

func (*Client) GetDocument

func (c *Client) GetDocument(ctx context.Context, didstr string) (*did.Document, error)

func (*Client) GetDocumentData

func (c *Client) GetDocumentData(ctx context.Context, didstr string) (*DocumentData, error)

func (*Client) GetHealth

func (c *Client) GetHealth(ctx context.Context) (*Health, error)

func (*Client) GetLastOperation

func (c *Client) GetLastOperation(ctx context.Context, didstr string) (Operation, error)

func (*Client) GetOperationLog

func (c *Client) GetOperationLog(ctx context.Context, didstr string) (Operations, error)

func (*Client) SetTombstone

func (c *Client) SetTombstone(ctx context.Context, signer *did.PrivKey, didstr string) error

func (*Client) UpdateHandle

func (c *Client) UpdateHandle(ctx context.Context, signer *did.PrivKey, didstr, handle string) error

func (*Client) UpdatePDS

func (c *Client) UpdatePDS(ctx context.Context, signer *did.PrivKey, didstr, pdsEndpoint string) error

func (*Client) UpdateRotationKeys

func (c *Client) UpdateRotationKeys(ctx context.Context, signer *did.PrivKey, didstr string, rotationKeys []string) error

func (*Client) UpdateVerificationMethod

func (c *Client) UpdateVerificationMethod(ctx context.Context, signer *did.PrivKey, didstr, keyID, keyDID string) error

type Create

type Create struct {
	SigningKey  string `json:"signingKey" cborgen:"signingKey"`
	RecoveryKey string `json:"recoveryKey" cborgen:"recoveryKey"`
	Handle      string `json:"handle" cborgen:"handle"`
	Service     string `json:"service" cborgen:"service"`

	Type string  `json:"type" cborgen:"type"`
	Prev *string `json:"prev" cborgen:"prev"`
	Sig  string  `json:"sig" cborgen:"sig,omitempty"`
}

func (*Create) GetAlsoKnownAs

func (c *Create) GetAlsoKnownAs() []string

func (*Create) GetRotationKeys

func (c *Create) GetRotationKeys() []string

func (*Create) GetServices

func (c *Create) GetServices() map[string]*Service

func (*Create) GetType

func (c *Create) GetType() string

func (*Create) GetVerificationMethods

func (c *Create) GetVerificationMethods() map[string]string

func (*Create) MarshalCBOR

func (t *Create) MarshalCBOR(w io.Writer) error

func (*Create) SetSignature

func (c *Create) SetSignature(signature string)

func (*Create) UnmarshalCBOR

func (t *Create) UnmarshalCBOR(r io.Reader) (err error)

type DocumentData

type DocumentData struct {
	DID                 string              `json:"did"`
	RotationKeys        []string            `json:"rotationKeys"`
	VerificationMethods map[string]string   `json:"verificationMethods"`
	AlsoKnownAs         []string            `json:"alsoKnownAs"`
	Services            map[string]*Service `json:"services"`
}

type Health

type Health struct {
	Version string `json:"version"`
}

type Operation

type Operation interface {
	GetType() string
	GetRotationKeys() []string
	GetAlsoKnownAs() []string
	GetServices() map[string]*Service
	GetVerificationMethods() map[string]string
}

type Operations

type Operations []Operation

type Service

type Service struct {
	Type     string `json:"type" cborgen:"type"`
	Endpoint string `json:"endpoint" cborgen:"endpoint"`
}

func (*Service) MarshalCBOR

func (t *Service) MarshalCBOR(w io.Writer) error

func (*Service) UnmarshalCBOR

func (t *Service) UnmarshalCBOR(r io.Reader) (err error)

type Signable

type Signable interface {
	cbor.CBORMarshaler

	SetSignature(string)
}

type Tombstone

type Tombstone struct {
	Type string  `json:"type" cborgen:"type"`
	Prev *string `json:"prev" cborgen:"prev"`
	Sig  string  `json:"sig" cborgen:"sig,omitempty"`
}

func (*Tombstone) GetAlsoKnownAs

func (t *Tombstone) GetAlsoKnownAs() []string

func (*Tombstone) GetRotationKeys

func (t *Tombstone) GetRotationKeys() []string

func (*Tombstone) GetServices

func (t *Tombstone) GetServices() map[string]*Service

func (*Tombstone) GetType

func (t *Tombstone) GetType() string

func (*Tombstone) GetVerificationMethods

func (t *Tombstone) GetVerificationMethods() map[string]string

func (*Tombstone) MarshalCBOR

func (t *Tombstone) MarshalCBOR(w io.Writer) error

func (*Tombstone) SetSignature

func (t *Tombstone) SetSignature(signature string)

func (*Tombstone) UnmarshalCBOR

func (t *Tombstone) UnmarshalCBOR(r io.Reader) (err error)

type Update

type Update struct {
	RotationKeys        []string            `json:"rotationKeys" cborgen:"rotationKeys"`
	VerificationMethods map[string]string   `json:"verificationMethods" cborgen:"verificationMethods"`
	AlsoKnownAs         []string            `json:"alsoKnownAs" cborgen:"alsoKnownAs"`
	Services            map[string]*Service `json:"services" cborgen:"services"`

	Type string  `json:"type" cborgen:"type"`
	Prev *string `json:"prev" cborgen:"prev"`
	Sig  string  `json:"sig" cborgen:"sig,omitempty"`
}

func (*Update) GetAlsoKnownAs

func (o *Update) GetAlsoKnownAs() []string

func (*Update) GetRotationKeys

func (o *Update) GetRotationKeys() []string

func (*Update) GetServices

func (o *Update) GetServices() map[string]*Service

func (*Update) GetType

func (o *Update) GetType() string

func (*Update) GetVerificationMethods

func (o *Update) GetVerificationMethods() map[string]string

func (*Update) MarshalCBOR

func (t *Update) MarshalCBOR(w io.Writer) error

func (*Update) SetSignature

func (o *Update) SetSignature(signature string)

func (*Update) UnmarshalCBOR

func (t *Update) UnmarshalCBOR(r io.Reader) (err error)

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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