didcomm

package
v0.0.0-...-55a0270 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExchangeInvitation = "https://didcomm.org/didexchange/1.0/invitation"
	ExchangeRequest    = "https://didcomm.org/didexchange/1.0/request"
	ExchangeResponse   = "https://didcomm.org/didexchange/1.0/response"
	ExchangeComplete   = "https://didcomm.org/didexchange/1.0/complete"
	ExchangeProblem    = "https://didcomm.org/didexchange/1.0/problem_report"
)

Variables

This section is empty.

Functions

func VerifyAttachmentData

func VerifyAttachmentData(data Data, keyID string) error

VerifyAttachmentData takes in a DIDComm `Data` object along with a keyID to validate the data It is assumed that the data is a DID Document, which contains the key referenced by the parameter

Types

type Attachment

type Attachment struct {
	ID       string `json:"@id,omitempty"`
	MimeType string `json:"mime-type,omitempty"`
	Data     Data   `json:"data"`
}

Attachment is a structure used to attach Base64 encoded data to DIDComm messages. By convention, attachments, embedded or appended to json requests, have the key names that ends with the attachment decorator ("~attach"). Attachments can be signed (with JWS) or unsigned. Follows the Aries RFC 0017: Attachments protocol.

type Data

type Data struct {
	Base64 string `json:"base64"`
	JWS    *JWS   `json:"jws,omitempty"`
}

Data contains the base64 encoded data and an optional JWS.

func CreateAttachmentData

func CreateAttachmentData(keyID string, didDoc did.DIDDoc, key ed25519.PrivateKey) (*Data, error)

CreateAttachmentData takes a DID Document, and key and key id referenced in that document The attachment is a b64 encoded version of the did document in a detached JWS

type Exchange

type Exchange struct {
	ID              string      `json:"@id"`
	Type            []string    `json:"@type"`
	Thread          Thread      `json:"~thread,omitempty"`
	Label           string      `json:"label,omitempty"`
	ServiceEndpoint did.URI     `json:"serviceEndpoint,omitempty"`
	KID             string      `json:"kid,omitempty"`
	DID             did.DID     `json:"did,omitempty"`
	Attachment      Attachment  `json:"did_doc~attach,omitempty"`
	LogoURL         did.URI     `json:"logoUrl,omitempty"`
	ConnectionName  string      `json:"connectionName,omitempty"`
	ContactURL      did.URI     `json:"contactUrl,omitempty"`
	ProblemCode     ProblemCode `json:"problemCode,omitempty"`
	Explain         string      `json:"explain,omitempty"`
}

func CreateExchangeComplete

func CreateExchangeComplete(input ExchangeCompleteInput) (*Exchange, error)

func CreateExchangeInvitation

func CreateExchangeInvitation(input ExchangeInvitationInput) (*Exchange, error)

func CreateExchangeProblem

func CreateExchangeProblem(input ExchangeProblemInput) (*Exchange, error)

func CreateExchangeRequest

func CreateExchangeRequest(input ExchangeRequestResponseInput) (*Exchange, error)

func CreateExchangeResponse

func CreateExchangeResponse(input ExchangeRequestResponseInput) (*Exchange, error)

type ExchangeCompleteInput

type ExchangeCompleteInput struct {
	Label          string
	ParentThreadID string `validate:"required"`
}

type ExchangeInvitationInput

type ExchangeInvitationInput struct {
	AdditionalContexts []string
	Label              string
	KID                string  `validate:"required"`
	ServiceEndpoint    did.URI `validate:"required"`
	LogoURL            did.URI `validate:"required"`
	ConnectionName     string  `validate:"required"`
	ContactURL         did.URI `validate:"required"`
}

type ExchangeProblemInput

type ExchangeProblemInput struct {
	Label          string
	ParentThreadID string      `validate:"required"`
	ProblemCode    ProblemCode `validate:"required"`
	Explain        string      `validate:"required"`
}

type ExchangeRequestResponseInput

type ExchangeRequestResponseInput struct {
	AdditionalContexts []string
	Label              string
	DID                did.DID `validate:"required"`
	LogoURL            did.URI `validate:"required"`
	ConnectionName     string  `validate:"required"`
	ContactURL         did.URI `validate:"required"`
	ParentThreadID     string  `validate:"required"`
	AttachmentData     Data    `validate:"required"`
}

type JWS

type JWS struct {
	Header    map[string]interface{} `json:"header"`
	Protected string                 `json:"protected"`
	Signature string                 `json:"signature"`
}

JWS Structure is JWS (RFC 7515) format and used for signing data.

func (*JWS) SetKID

func (jws *JWS) SetKID(kid string)

type Metadata

type Metadata struct {
	Comment string `json:"comment,omitempty"`
	Type    string `json:"type,omitempty"`
	ID      string `json:"id,omitempty"`
}

type ProblemCode

type ProblemCode string
const (
	RequestNotAccepted      ProblemCode = "request_not_accepted"
	RequestProcessingError  ProblemCode = "request_processing_error"
	ResponseNotAccepted     ProblemCode = "response_not_accepted"
	ResponseProcessingError ProblemCode = "response_processing_error"
)

type Thread

type Thread struct {
	ThreadID       string `json:"thid,omitempty"`
	ParentThreadID string `json:"pthid,omitempty"`
}

Jump to

Keyboard shortcuts

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