pickup

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: BSD-2-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package pickup implements the DIDComm Pickup Protocol 2.0.

This protocol enables retrieving messages from a mediator when the recipient is offline or uses asynchronous message delivery.

Protocol URI: https://didcomm.org/messagepickup/2.0/

See: https://identity.foundation/didcomm-messaging/spec/#pickup-protocol-20

Index

Constants

View Source
const (
	ProtocolURI            = "https://didcomm.org/messagepickup/2.0"
	TypeStatusRequest      = ProtocolURI + "/status-request"
	TypeStatus             = ProtocolURI + "/status"
	TypeDeliveryRequest    = ProtocolURI + "/delivery-request"
	TypeDelivery           = ProtocolURI + "/delivery"
	TypeMessagesReceived   = ProtocolURI + "/messages-received"
	TypeLiveDeliveryChange = ProtocolURI + "/live-delivery-change"
)

Variables

This section is empty.

Functions

func NewDelivery

func NewDelivery(request *message.Message, attachments []MessageAttachment) (*message.Message, error)

NewDelivery creates a delivery message with attached messages.

func NewDeliveryRequest

func NewDeliveryRequest(from, to string, limit int, recipientKey string) (*message.Message, error)

NewDeliveryRequest creates a message delivery request.

func NewLiveDeliveryChange

func NewLiveDeliveryChange(from, to string, enable bool) (*message.Message, error)

NewLiveDeliveryChange creates a live delivery mode change request.

func NewMessagesReceived

func NewMessagesReceived(from, to string, messageIDs []string) (*message.Message, error)

NewMessagesReceived creates an acknowledgment of received messages.

func NewStatus

func NewStatus(request *message.Message, status *Status) (*message.Message, error)

NewStatus creates a status response message.

func NewStatusRequest

func NewStatusRequest(from, to string, recipientKey string) (*message.Message, error)

NewStatusRequest creates a status request message.

Types

type AttachmentData

type AttachmentData struct {
	Base64 string          `json:"base64,omitempty"`
	JSON   json.RawMessage `json:"json,omitempty"`
}

AttachmentData holds the message content.

type Delivery

type Delivery struct {
	RecipientKey string              `json:"recipient_key,omitempty"`
	Attachments  []MessageAttachment `json:"~attach"`
}

Delivery contains messages being delivered.

func ParseDelivery

func ParseDelivery(msg *message.Message) (*Delivery, error)

ParseDelivery parses a delivery message.

type DeliveryRequest

type DeliveryRequest struct {
	Limit        int    `json:"limit,omitempty"`
	RecipientKey string `json:"recipient_key,omitempty"`
}

DeliveryRequest requests delivery of messages.

func ParseDeliveryRequest

func ParseDeliveryRequest(msg *message.Message) (*DeliveryRequest, error)

ParseDeliveryRequest parses a delivery request message.

type LiveDeliveryChange

type LiveDeliveryChange struct {
	LiveDelivery bool `json:"live_delivery"`
}

LiveDeliveryChange requests a change in live delivery mode.

type MessageAttachment

type MessageAttachment struct {
	ID   string         `json:"@id"`
	Data AttachmentData `json:"data"`
}

MessageAttachment contains a message being delivered.

type MessagesReceived

type MessagesReceived struct {
	MessageIDList []string `json:"message_id_list"`
}

MessagesReceived acknowledges receipt of messages.

func ParseMessagesReceived

func ParseMessagesReceived(msg *message.Message) (*MessagesReceived, error)

ParseMessagesReceived parses a messages-received acknowledgment.

type Status

type Status struct {
	RecipientKey         string `json:"recipient_key,omitempty"`
	MessageCount         int    `json:"message_count"`
	LongestWaitedSeconds int64  `json:"longest_waited_seconds,omitempty"`
	NewestReceivedTime   string `json:"newest_received_time,omitempty"`
	TotalBytes           int64  `json:"total_bytes,omitempty"`
	LiveDelivery         bool   `json:"live_delivery,omitempty"`
}

Status contains information about available messages at the mediator.

func ParseStatus

func ParseStatus(msg *message.Message) (*Status, error)

ParseStatus parses a status response message.

type StatusRequest

type StatusRequest struct {
	RecipientKey string `json:"recipient_key,omitempty"`
}

StatusRequest requests the current status of available messages.

func ParseStatusRequest

func ParseStatusRequest(msg *message.Message) (*StatusRequest, error)

ParseStatusRequest parses a status request message.

Jump to

Keyboard shortcuts

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