Messaging

Operations about DIDComm messaging. DIDComm messages are addressed by DID using Dock's relay service.

The current most common use case for the messaging service is to send credentials and presentation requests to the Dock Wallet, but other clients can use it too.

Encrypt Message

In most cases you'll want to ensure the privacy of the message by encrypting it before sending.

Parameters

NameInTypeRequiredDescription

body

body

object

true

The recipients, sender and message

» type

body

string

false

none

» payload

body

object

true

none

» senderDid

body

string

true

none

» algorithm

body

string

false

none

» recipientDids

body

[oneOf]

true

none

Enumerated Values

ParameterValue

» algorithm

ECDH-1PU+A256KW

» algorithm

ECDH-ES+A256KW

Responses

StatusMeaningDescriptionSchema

200

Message has been encrypted, returning an encrypted DIDComm Message

400

Message failed to encrypt

402

Transaction limit reached or upgrade required to proceed

404

DID was not found

POST /messaging/encrypt REQUEST CURL
# You can also use wget
curl -X POST https://api-testnet.dock.io/messaging/encrypt \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'DOCK-API-TOKEN: API_KEY'
Body parameter
{
  "type": "https://didcomm.org/issue-credential/2.0/issue-credential",
  "payload": {
    "domain": "api.dock.io",
    "credentials": [{ ...vcJSON }]
  },
  "senderDid": "did:dock:xyz",
  "algorithm": "ECDH-1PU+A256KW",
  "recipientDids": [
    "did:dock:xyz"
  ]
}
200 Response
{
  "code": 0
}

Decrypt Message

Parameters

NameInTypeRequiredDescription

body

body

object

true

The JWM

» jwe

body

object

true

none

Responses

StatusMeaningDescriptionSchema

200

Message has been decrypted, returning a DIDComm message

400

Message failed to decrypt

402

Transaction limit reached or upgrade required to proceed

404

DID was not found

POST /messaging/decrypt REQUEST CURL
# You can also use wget
curl -X POST https://api-testnet.dock.io/messaging/decrypt \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'DOCK-API-TOKEN: API_KEY'
Body parameter
{
  "jwe": {}
}
200 Response
{
  "code": 0
}

Signing Messages

Signing a message helps to prove to the recipient that the message is valid and unaltered. The message will be signed as a Base64 encoded JWT.

Parameters

NameInTypeRequiredDescription

body

body

object

true

The message payload

» payload

body

object

true

none

» senderDid

body

string

true

none

» type

body

string

false

none

Responses

StatusMeaningDescriptionSchema

200

Message has been signed

400

Message failed to sign

402

Transaction limit reached or upgrade required to proceed

404

DID was not found

POST /messaging/sign REQUEST CURL
# You can also use wget
curl -X POST https://api-testnet.dock.io/messaging/sign \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'DOCK-API-TOKEN: API_KEY'
Body parameter
{
  "payload": {},
  "senderDid": "string",
  "type": "string"
}
200 Response
"eyJhRU...p6byJ9.eyJpZ...em8iXV19.RIHJunaOq0SnQqYjG...BXo4ozHjWAMfqR0czB0rR4emWF0MeWOCXXSJra4ttCFAQ"

Verifying a Message

Verify that the message is valid.

Parameters

NameInTypeRequiredDescription

body

body

object

true

The message payload

» jws

body

string

true

none

Responses

StatusMeaningDescriptionSchema

200

Message is verified

400

Message failed to verify

402

Transaction limit reached or upgrade required to proceed

404

DID was not found

POST /messaging/verify REQUEST CURL
# You can also use wget
curl -X POST https://api-testnet.dock.io/messaging/verify \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'DOCK-API-TOKEN: API_KEY'
Body parameter
{
  "jws": "string"
}
200 Response
{
	"verified": true,
	"payload": {
		"id": "14a31880-e864-11ed-ab4c-3f9fbca4f00d",
		"type": "https://example.com/protocols/lets_do_lunch/1.0/proposal",
		"created_time": 1682975205,
		"from": "did:example:alice",
		"body": {
			"some": "test-value"
		},
		"reply_to": [
			[
				"did:example:alice"
			]
		]
	}
}

Send Message

Sends a DIDComm message using our relay service and DID service endpoints, it also returns a URL for QR code scanning. Supports encrypted, plaintext and signed DIDComm messages. You can generate an encrypted DIDComm message by calling the /messaging/encrypt route.

The typ attribute must be a DIDComm type (i.e. starts with "application/didcomm").

Parameters

NameInTypeRequiredDescription

body

body

object

true

The message payload

» to

body

string

true

none

» message

body

Message

true

none

Responses

StatusMeaningDescriptionSchema

200

Message has been sent

400

Message failed to send

402

Transaction limit reached or upgrade required to proceed

404

DID was not found

POST /messaging/send REQUEST CURL
# You can also use wget
curl -X POST https://api-testnet.dock.io/messaging/send \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'DOCK-API-TOKEN: API_KEY'
Body parameter
{
  "to": "string",
  "message": {
    "typ": "string"
  }
}
200 Response
{
	"sent": true,
	"qrUrl": "didcomm://https://relay.dock.io/read/64502e3243455b67f93f95557"
}

Last updated