transport

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: May 9, 2023 License: Apache-2.0 Imports: 1 Imported by: 46

Documentation

Index

Constants

View Source
const (
	// MediaTypeRFC0019EncryptedEnvelope is the original media type for DIDComm V1 encrypted envelopes as per
	// Aries RFC 0019.
	MediaTypeRFC0019EncryptedEnvelope = "JWM/1.0"
	// MediaTypeV1EncryptedEnvelope is the media type for DIDComm V1 encrypted envelopes as per Aries RFC 0044. This
	// media type never materialized as it was in-between state of DIDComm V1 and V2 and the intent was to build the new
	// JWE format which has now become V2. It's treated as V2 in the framework for the sake of JWE compatibility.
	MediaTypeV1EncryptedEnvelope = "application/didcomm-enc-env"
	// MediaTypeV1PlaintextPayload is the media type for DIDComm V1 JWE payloads as per Aries RFC 0044.
	MediaTypeV1PlaintextPayload = "application/json;flavor=didcomm-msg"
	// MediaTypeV2EncryptedEnvelope is the media type for DIDComm V2 encrypted envelopes as per Aries RFC 0044 and the
	// DIF DIDComm spec.
	MediaTypeV2EncryptedEnvelope = "application/didcomm-encrypted+json"
	// MediaTypeV2EncryptedEnvelopeV1PlaintextPayload is the media type for DIDComm V2 encrypted envelopes with a
	// V1 plaintext payload as per Aries RFC 0587.
	MediaTypeV2EncryptedEnvelopeV1PlaintextPayload = MediaTypeV2EncryptedEnvelope + ";cty=" + MediaTypeV1PlaintextPayload
	// MediaTypeV2PlaintextPayload is the media type for DIDComm V1 JWE payloads as per Aries 044.
	MediaTypeV2PlaintextPayload = "application/didcomm-plain+json"

	// MediaTypeProfileDIDCommAIP1 is the encryption envelope, signing mechanism, plaintext conventions,
	// and routing algorithms embodied in Aries AIP 1.0, circa 2020. Defined in RFC 0044.
	MediaTypeProfileDIDCommAIP1 = "didcomm/aip1"

	// MediaTypeAIP2RFC0019Profile for AIP 2.0, circa 2021 using RFC0019 encryption envelope.
	MediaTypeAIP2RFC0019Profile = "didcomm/aip2;env=rfc19"

	// MediaTypeAIP2RFC0587Profile for AIP 2.0, circa 2021 using the new JWE encryption envelope (DIDComm V2 style).
	MediaTypeAIP2RFC0587Profile = "didcomm/aip2;env=rfc587"

	// MediaTypeDIDCommV2Profile is the official DIDComm V2 profile.
	MediaTypeDIDCommV2Profile = "didcomm/v2"

	// LegacyDIDCommV1Profile is the media type used by legacy didcomm agent systems.
	LegacyDIDCommV1Profile = "IndyAgent"
)

Variables

This section is empty.

Functions

func IsDIDCommV2 added in v0.1.9

func IsDIDCommV2(mtp string) bool

IsDIDCommV2 returns true iff mtp is one of: MediaTypeV2EncryptedEnvelope, MediaTypeV2EncryptedEnvelopeV1PlaintextPayload, MediaTypeAIP2RFC0587Profile, MediaTypeDIDCommV2Profile, or MediaTypeV2PlaintextPayload.

func MediaTypeProfiles added in v0.1.8

func MediaTypeProfiles() []string

MediaTypeProfiles returns the list of accepted mediatype profiles.

Types

type Envelope added in v0.1.7

type Envelope struct {
	MediaTypeProfile string
	Message          []byte
	FromKey          []byte
	// ToKeys stores keys for an outbound message packing
	ToKeys []string
	// ToKey holds the key that was used to decrypt an inbound message
	ToKey []byte
}

Envelope holds message data and metadata for inbound and outbound messaging.

type InboundMessageHandler

type InboundMessageHandler func(envelope *Envelope) error

InboundMessageHandler handles the inbound requests. The transport will unpack the payload prior to the message handle invocation.

type InboundTransport

type InboundTransport interface {
	// starts the inbound transport
	Start(prov Provider) error

	// stops the inbound transport
	Stop() error

	// returns the endpoint
	Endpoint() string
}

InboundTransport interface definition for inbound transport layer.

type OutboundTransport

type OutboundTransport interface {
	// starts the outbound transport
	Start(prov Provider) error

	// Send send a2a exchange data
	Send(data []byte, destination *service.Destination) (string, error)

	// AcceptRecipient checks if there is a connection for the list of recipient keys. The framework executes this
	// function before Accept() in outbound message dispatcher.
	AcceptRecipient([]string) bool

	// Accept url
	Accept(string) bool
}

OutboundTransport interface definition for transport layer This is the client side of the agent.

type Packager added in v0.1.7

type Packager interface {
	// PackMessage Pack a message for one or more recipients.
	//
	// Args:
	//
	// envelope: The message to pack
	//
	// Returns:
	//
	// []byte: The packed message
	//
	// error: error
	PackMessage(envelope *Envelope) ([]byte, error)

	// UnpackMessage Unpack a message.
	//
	// Args:
	//
	// encMessage: The encrypted message
	//
	// Returns:
	//
	// envelope: unpack message
	//
	// error: error
	UnpackMessage(encMessage []byte) (*Envelope, error)
}

Packager manages the handling, building and parsing of DIDComm raw messages in JSON envelopes.

These envelopes are used as wire-level wrappers of messages sent in Aries agent-agent communication.

type Provider added in v0.1.1

type Provider interface {
	InboundMessageHandler() InboundMessageHandler
	Packager() Packager
	AriesFrameworkID() string
}

Provider contains dependencies for starting the inbound/outbound transports. It is typically created by using aries.Context().

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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