endpoint

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: Apache-2.0 Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DIDCommV2Endpoint

type DIDCommV2Endpoint struct {
	// URI contains the endpoint URI.
	URI string `json:"uri"`
	// Accept contains the MediaType profiles accepted by this endpoint.
	Accept []string `json:"accept,omitempty"`
	// RoutingKeys contains the list of keys trusted as routing keys for the mediators/routers of this endpoint.
	RoutingKeys []string `json:"routingKeys,omitempty"`
}

DIDCommV2Endpoint contains ServiceEndpoint data specifically for DIDcommV2 and is wrapped in Endpoint as an array.

type Endpoint

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

Endpoint contains endpoint specific content. Content of ServiceEndpoint api above will be used by priority: 1- DIDcomm V2 2- DIDComm V1 3- DIDCore To force lower priority endpoint content, avoid setting higher priority data during Unmarshal() execution.

func NewDIDCommV1Endpoint

func NewDIDCommV1Endpoint(uri string) Endpoint

NewDIDCommV1Endpoint creates a DIDCommV1 endpoint.

func NewDIDCommV2Endpoint

func NewDIDCommV2Endpoint(endpoints []DIDCommV2Endpoint) Endpoint

NewDIDCommV2Endpoint creates a DIDCommV2 endpoint with the given array of endpoints. At the time of writing this comment, only the first endpoint is effective in the API. Additional logic is required to use a different index.

func NewDIDCoreEndpoint

func NewDIDCoreEndpoint(genericEndpoint interface{}) Endpoint

NewDIDCoreEndpoint creates a generic DIDCore endpoint.

func (*Endpoint) Accept

func (s *Endpoint) Accept() ([]string, error)

Accept is the DIDComm V2 Accept field of a service endpoint.

func (*Endpoint) MarshalJSON

func (s *Endpoint) MarshalJSON() ([]byte, error)

MarshalJSON marshals the content of Endpoint into a valid JSON []byte. Order of data is: 1. DIDCommV2 format if found 2. DIDCommV1 format if found 3. DIDCore generic format if found 4. JSON "Null" as fallback.

func (*Endpoint) RoutingKeys

func (s *Endpoint) RoutingKeys() ([]string, error)

RoutingKeys is the DIDComm V2 RoutingKeys field of a service endpoint.

func (*Endpoint) Type

func (s *Endpoint) Type() EndpointType

Type return endpoint type.

func (*Endpoint) URI

func (s *Endpoint) URI() (string, error)

URI is the URI of a service endpoint. It will return the value based on the underlying endpoint type in the following order: 1- DIDComm V2 URI (currently the first element's URI). TODO enhance API to pass in an optional index. 2- DIDComm V1 URI 3- DIDCore's first element printed as string for now. (not used by AFGO at the time of this writing, but can be

enhanced if needed).

func (*Endpoint) UnmarshalJSON

func (s *Endpoint) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals data into Endpoint based on its format.

type EndpointType

type EndpointType int // nolint: golint

EndpointType endpoint type.

const (
	// DIDCommV1 type.
	DIDCommV1 EndpointType = iota
	// DIDCommV2 type.
	DIDCommV2
	// Generic type.
	Generic
)

type ServiceEndpoint

type ServiceEndpoint interface {
	URI() (string, error)
	Accept() ([]string, error)
	RoutingKeys() ([]string, error)
	Type() EndpointType
}

ServiceEndpoint api for fetching ServiceEndpoint content based off of a DIDComm V1, V2 or DIDCore format.

Jump to

Keyboard shortcuts

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