middleware

package
v0.0.0-...-57c6170 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DIDCommMessageMiddleware

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

DIDCommMessageMiddleware performs inbound/outbound message handling tasks that apply to all DIDComm V2 messages.

  • Rotates DIDs on outbound messages, and handles inbound messages that rotate DIDs.

func New

func New(p provider) (*DIDCommMessageMiddleware, error)

New creates a DIDCommMessageMiddleware.

func (*DIDCommMessageMiddleware) Create

func (h *DIDCommMessageMiddleware) Create(oldDoc *did.Doc, oldKID, newDID string) (string, error)

Create creates a didcomm/v2 DID rotation `from_prior`, as a compact-serialized JWS.

func (*DIDCommMessageMiddleware) HandleInboundMessage

func (h *DIDCommMessageMiddleware) HandleInboundMessage(
	msg didcomm.DIDCommMsgMap,
	theirDID, myDID string,
) error

HandleInboundMessage processes did rotation and invitee connection creation on inbound messages.

func (*DIDCommMessageMiddleware) HandleInboundPeerDID

func (h *DIDCommMessageMiddleware) HandleInboundPeerDID(msg didcomm.DIDCommMsgMap) error

HandleInboundPeerDID checks if an inbound message contains a peer DID, saving the peer DID if so.

func (*DIDCommMessageMiddleware) HandleOutboundMessage

HandleOutboundMessage processes an outbound message.

func (*DIDCommMessageMiddleware) RotateConnectionDID

func (h *DIDCommMessageMiddleware) RotateConnectionDID(connectionID, signingKID, newDID string) error

RotateConnectionDID rotates the agent's DID on the connection under connectionID.

func (*DIDCommMessageMiddleware) Verify

func (h *DIDCommMessageMiddleware) Verify(senderDID, fromPrior string) (string, error)

Verify verifies a didcomm/v2 DID rotation.

  • senderDID: the DID of the sender of the message containing this DID Rotation, known from the envelope or from the message's `to` field.
  • fromPrior: the `from_prior` field of the rotated message.

Returns the sender's old DID (superseded by the new DID), if verification succeeds, or an error otherwise.

Jump to

Keyboard shortcuts

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