identityhub

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package identityhub implements a subset of Identity Hub data models, to support requesting identity hub data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ServiceEndpoint

func ServiceEndpoint(doc *did.Doc) (string, error)

ServiceEndpoint returns the identity hub service endpoint URI from the identity hub service of the given DID doc.

Types

type Message

type Message struct {
	Descriptor map[string]interface{} `json:"descriptor"`
	Data       string                 `json:"data,omitempty"`
}

Message holds a single data element inside an identity hub response.

func (Message) GetObjectID

func (m Message) GetObjectID() (string, bool)

GetObjectID returns the objectId of the Message.

func (Message) IsMethod

func (m Message) IsMethod(method string) bool

IsMethod returns true iff the Message matches the given method.

type MessageResult

type MessageResult struct {
	MessageID string    `json:"messageId"`
	Status    Status    `json:"status"`
	Entries   []Message `json:"entries,omitempty"`
}

MessageResult holds a set of messages inside an identity hub response.

type Request

type Request struct {
	RequestID string    `json:"requestId"`
	Target    string    `json:"target"`
	Messages  []Message `json:"messages"`
}

Request contains an identity hub query.

func GetRequest

func GetRequest(
	hubDID, messageMethod string,
	messageDescriptorData []map[string]interface{},
) (string, *Request, error)

GetRequest constructs a Request with one message, for the given method, with message descriptor taken from the matching method in messageDescriptorData. Returns the object ID of the selected message, and the Request.

type Response

type Response struct {
	RequestID string          `json:"requestId"`
	Status    *Status         `json:"status"`
	Replies   []MessageResult `json:"replies"`
}

Response contains the results of an identity hub query.

func (Response) CheckStatus

func (i Response) CheckStatus() error

CheckStatus returns an error if this Response or any MessageResult within has a status other than http.StatusOK.

func (Response) GetMessageData

func (i Response) GetMessageData(objectID string) ([]byte, error)

GetMessageData returns the data for the Message with the given ID inside this Response.

type Status

type Status struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

Status holds a http status code and error message, for an identity hub response or message result.

Jump to

Keyboard shortcuts

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