closemsg

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const Kind = "close"

Kind identifies this message kind

Variables

This section is empty.

Functions

This section is empty.

Types

type Close

type Close struct {
	Metadata  message.Metadata `json:"metadata,omitempty"`
	Data      Data             `json:"data,omitempty"`
	Signature string           `json:"signature,omitempty"`
}

Close represents a close message within the exchange.

func Create

func Create(fromDID did.BearerDID, to, exchangeID string, opts ...CreateOption) (Close, error)

Create creates a new Close message.

func Parse

func Parse(data []byte) (Close, error)

Parse validates and unmarshals the input data into a Close.

func (Close) Digest

func (c Close) Digest() ([]byte, error)

Digest computes a hash of the message

func (Close) GetKind added in v0.13.0

func (c Close) GetKind() string

GetKind returns the kind of message.

func (Close) GetMetadata added in v0.13.0

func (c Close) GetMetadata() message.Metadata

GetMetadata returns the metadata of the message.

func (Close) GetValidNext added in v0.13.0

func (c Close) GetValidNext() []string

GetValidNext returns the kinds of messages that can follow a close.

func (*Close) UnmarshalJSON

func (c *Close) UnmarshalJSON(data []byte) error

UnmarshalJSON validates and unmarshals the input data into a Close.

func (*Close) Verify

func (c *Close) Verify() error

Verify verifies the signature of the Close.

type CreateOption

type CreateOption func(*createOptions)

CreateOption defines a type for functions that can modify the createOptions struct.

func CreatedAt

func CreatedAt(t time.Time) CreateOption

CreatedAt can be passed to Create to provide a custom created at time.

func ExternalID

func ExternalID(externalID string) CreateOption

ExternalID can be passed to Create to provide a custom external id.

func ID

func ID(id string) CreateOption

ID can be passed to Create to provide a custom id.

func Reason

func Reason(reason string) CreateOption

Reason can be passed to Create to provide a custom reason.

func Success

func Success(success bool) CreateOption

Success can be passed to Create to provide a custom success.

type Data

type Data struct {
	Reason  string `json:"reason,omitempty"`
	Success bool   `json:"success,omitempty"`
}

Data encapsulates the data content of a close.

Jump to

Keyboard shortcuts

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