protocol

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2023 License: Apache-2.0, MIT Imports: 4 Imported by: 6

Documentation

Overview

Package protocol defines core protocol messages

Index

Constants

View Source
const (

	// AuthorizationRequestMessageType defines auth request type of the communication protocol
	AuthorizationRequestMessageType iden3comm.ProtocolMessage = iden3comm.Iden3Protocol + "authorization/1.0/request"
	// AuthorizationResponseMessageType defines auth response type of the communication protocol
	AuthorizationResponseMessageType iden3comm.ProtocolMessage = iden3comm.Iden3Protocol + "authorization/1.0/response"
)
View Source
const (

	// CredentialIssuanceRequestMessageType accepts request for credential creation
	CredentialIssuanceRequestMessageType iden3comm.ProtocolMessage = iden3comm.Iden3Protocol + "credentials/1.0/issuance-request"

	// CredentialFetchRequestMessageType is type for request of credential generation
	CredentialFetchRequestMessageType iden3comm.ProtocolMessage = iden3comm.Iden3Protocol + "credentials/1.0/fetch-request"

	// CredentialOfferMessageType is type of message with credential offering
	CredentialOfferMessageType iden3comm.ProtocolMessage = iden3comm.Iden3Protocol + "credentials/1.0/offer"

	// CredentialIssuanceResponseMessageType is type for message with a credential issuance
	CredentialIssuanceResponseMessageType iden3comm.ProtocolMessage = iden3comm.Iden3Protocol + "credentials/1.0/issuance-response"

	// CredentialStatusUpdateMessageType is type for message with a credential status update
	CredentialStatusUpdateMessageType iden3comm.ProtocolMessage = iden3comm.Iden3Protocol + "credentials/1.0/status-update"
)
View Source
const (
	// ProofGenerationRequestMessageType is type for request of proof generation
	ProofGenerationRequestMessageType iden3comm.ProtocolMessage = iden3comm.Iden3Protocol + "proofs/1.0/request"
	// ProofGenerationResponseMessageType is type for response of proof generation
	ProofGenerationResponseMessageType iden3comm.ProtocolMessage = iden3comm.Iden3Protocol + "proofs/1.0/response"
)
View Source
const (
	// RevocationStatusRequestMessageType is type for request of revocation status
	RevocationStatusRequestMessageType iden3comm.ProtocolMessage = iden3comm.Iden3Protocol + "revocation/1.0/request-status"
	// RevocationStatusResponseMessageType is type for response with a revocation status
	RevocationStatusResponseMessageType iden3comm.ProtocolMessage = iden3comm.Iden3Protocol + "revocation/1.0/status"
)
View Source
const (
	// ContractInvokeRequestMessageType defines contract invoke request type of the communication protocol
	ContractInvokeRequestMessageType iden3comm.ProtocolMessage = iden3comm.Iden3Protocol + "proofs/1.0/contract-invoke-request"
)
View Source
const (
	// DeviceRegistrationRequestMessageType defines device registration request type of the communication protocol
	DeviceRegistrationRequestMessageType iden3comm.ProtocolMessage = iden3comm.Iden3Protocol + "devices/1.0/registration"
)
View Source
const (
	// MessageFetchRequestMessageType defines message fetch request type of the communication protocol.
	MessageFetchRequestMessageType iden3comm.ProtocolMessage = iden3comm.Iden3Protocol + "messages/1.0/fetch"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthorizationMessageResponseBody

type AuthorizationMessageResponseBody struct {
	DIDDoc  json.RawMessage              `json:"did_doc,omitempty"`
	Message string                       `json:"message,omitempty"`
	Scope   []ZeroKnowledgeProofResponse `json:"scope"`
}

AuthorizationMessageResponseBody is struct the represents authorization response data

type AuthorizationRequestMessage

type AuthorizationRequestMessage struct {
	ID       string                          `json:"id"`
	Typ      iden3comm.MediaType             `json:"typ,omitempty"`
	Type     iden3comm.ProtocolMessage       `json:"type"`
	ThreadID string                          `json:"thid,omitempty"`
	Body     AuthorizationRequestMessageBody `json:"body,omitempty"`

	From string `json:"from,omitempty"`
	To   string `json:"to,omitempty"`
}

AuthorizationRequestMessage is struct the represents iden3message authorization request

type AuthorizationRequestMessageBody

type AuthorizationRequestMessageBody struct {
	CallbackURL string                      `json:"callbackUrl"`
	Reason      string                      `json:"reason,omitempty"`
	Message     string                      `json:"message,omitempty"`
	DIDDoc      json.RawMessage             `json:"did_doc,omitempty"`
	Scope       []ZeroKnowledgeProofRequest `json:"scope"`
}

AuthorizationRequestMessageBody is body for authorization request

type AuthorizationResponseMessage

type AuthorizationResponseMessage struct {
	ID       string                           `json:"id"`
	Typ      iden3comm.MediaType              `json:"typ,omitempty"`
	Type     iden3comm.ProtocolMessage        `json:"type"`
	ThreadID string                           `json:"thid,omitempty"`
	Body     AuthorizationMessageResponseBody `json:"body,omitempty"`

	From string `json:"from,omitempty"`
	To   string `json:"to,omitempty"`
}

AuthorizationResponseMessage is struct the represents iden3message authorization response

type ContractInvokeRequestMessage added in v1.0.0

type ContractInvokeRequestMessage struct {
	ID       string                           `json:"id"`
	Typ      iden3comm.MediaType              `json:"typ,omitempty"`
	Type     iden3comm.ProtocolMessage        `json:"type"`
	ThreadID string                           `json:"thid,omitempty"`
	Body     ContractInvokeRequestMessageBody `json:"body,omitempty"`

	From string `json:"from,omitempty"`
	To   string `json:"to,omitempty"`
}

ContractInvokeRequestMessage is struct the represents iden3message contract invoke request

type ContractInvokeRequestMessageBody added in v1.0.0

type ContractInvokeRequestMessageBody struct {
	Reason          string                      `json:"reason,omitempty"`
	Message         string                      `json:"message,omitempty"`
	TransactionData TransactionData             `json:"transaction_data"`
	DIDDoc          json.RawMessage             `json:"did_doc,omitempty"`
	Scope           []ZeroKnowledgeProofRequest `json:"scope"`
}

ContractInvokeRequestMessageBody is body for contract invoke request

type CredentialFetchRequestMessage

type CredentialFetchRequestMessage struct {
	ID       string                            `json:"id"`
	Typ      iden3comm.MediaType               `json:"typ,omitempty"`
	Type     iden3comm.ProtocolMessage         `json:"type"`
	ThreadID string                            `json:"thid,omitempty"`
	Body     CredentialFetchRequestMessageBody `json:"body,omitempty"`

	From string `json:"from,omitempty"`
	To   string `json:"to,omitempty"`
}

CredentialFetchRequestMessage represent Iden3message for credential fetch request

type CredentialFetchRequestMessageBody

type CredentialFetchRequestMessageBody struct {
	ID string `json:"id"`
}

CredentialFetchRequestMessageBody is msg body for fetch request

type CredentialIssuanceMessage

type CredentialIssuanceMessage struct {
	ID       string                    `json:"id"`
	Typ      iden3comm.MediaType       `json:"typ,omitempty"`
	Type     iden3comm.ProtocolMessage `json:"type"`
	ThreadID string                    `json:"thid,omitempty"`

	Body IssuanceMessageBody `json:"body,omitempty"`

	From string `json:"from,omitempty"`
	To   string `json:"to,omitempty"`
}

CredentialIssuanceMessage represent Iden3message for credential issuance

type CredentialIssuanceRequestMessage

type CredentialIssuanceRequestMessage struct {
	ID       string                    `json:"id"`
	Typ      iden3comm.MediaType       `json:"typ,omitempty"`
	Type     iden3comm.ProtocolMessage `json:"type"`
	ThreadID string                    `json:"thid,omitempty"`

	Body CredentialIssuanceRequestMessageBody `json:"body,omitempty"`

	From string `json:"from,omitempty"`
	To   string `json:"to,omitempty"`
}

CredentialIssuanceRequestMessage represent Iden3message for credential request

type CredentialIssuanceRequestMessageBody

type CredentialIssuanceRequestMessageBody struct {
	Schema     Schema          `json:"schema"`
	Data       json.RawMessage `json:"data"`
	Expiration int64           `json:"expiration"`
}

CredentialIssuanceRequestMessageBody represents data for credential issuance request

type CredentialOffer

type CredentialOffer struct {
	ID          string `json:"id"`
	Description string `json:"description"`
}

CredentialOffer is structure to fetch credential

type CredentialStatusUpdateMessage added in v1.1.0

type CredentialStatusUpdateMessage struct {
	ID       string                    `json:"id"`
	Typ      iden3comm.MediaType       `json:"typ,omitempty"`
	Type     iden3comm.ProtocolMessage `json:"type"`
	ThreadID string                    `json:"thid,omitempty"`

	Body CredentialStatusUpdateMessageBody `json:"body,omitempty"`

	From string `json:"from,omitempty"`
	To   string `json:"to,omitempty"`
}

CredentialStatusUpdateMessage represents credential status update message

type CredentialStatusUpdateMessageBody added in v1.1.0

type CredentialStatusUpdateMessageBody struct {
	ID     string `json:"id"`
	Reason string `json:"reason"`
}

CredentialStatusUpdateMessageBody the structure that represents the body of credential status update message

type CredentialsOfferMessage

type CredentialsOfferMessage struct {
	ID       string                    `json:"id"`
	Typ      iden3comm.MediaType       `json:"typ,omitempty"`
	Type     iden3comm.ProtocolMessage `json:"type"`
	ThreadID string                    `json:"thid,omitempty"`

	Body CredentialsOfferMessageBody `json:"body,omitempty"`

	From string `json:"from,omitempty"`
	To   string `json:"to,omitempty"`
}

CredentialsOfferMessage represent Iden3message for credential offer

type CredentialsOfferMessageBody

type CredentialsOfferMessageBody struct {
	URL         string            `json:"url"`
	Credentials []CredentialOffer `json:"credentials"`
}

CredentialsOfferMessageBody is struct the represents offer message

type DeviceRegistrationRequestMessage

type DeviceRegistrationRequestMessage struct {
	ID       string                    `json:"id"`
	Typ      iden3comm.MediaType       `json:"typ,omitempty"`
	Type     iden3comm.ProtocolMessage `json:"type"`
	ThreadID string                    `json:"thid,omitempty"`

	Body DeviceRegistrationRequestMessageBody `json:"body,omitempty"`

	From string `json:"from,omitempty"`
	To   string `json:"to,omitempty"`
}

DeviceRegistrationRequestMessage represent Iden3message for register device request

type DeviceRegistrationRequestMessageBody

type DeviceRegistrationRequestMessageBody struct {
	AppID     string `json:"app_id"`
	PushToken string `json:"push_token"`
}

DeviceRegistrationRequestMessageBody is struct the represents body for register device request request

type IssuanceMessageBody

type IssuanceMessageBody struct {
	Credential verifiable.W3CCredential `json:"credential"`
}

IssuanceMessageBody is struct the represents message when credential is issued

type MessageFetchRequestMessage

type MessageFetchRequestMessage struct {
	ID       string                    `json:"id"`
	Typ      iden3comm.MediaType       `json:"typ,omitempty"`
	Type     iden3comm.ProtocolMessage `json:"type"`
	ThreadID string                    `json:"thid,omitempty"`

	Body MessageFetchRequestMessageBody `json:"body,omitempty"`

	From string `json:"from,omitempty"`
	To   string `json:"to,omitempty"`
}

MessageFetchRequestMessage represent Iden3message for message fetch request.

type MessageFetchRequestMessageBody

type MessageFetchRequestMessageBody struct {
	ID string `json:"id"`
}

MessageFetchRequestMessageBody is struct the represents body for message fetch request.

type ProofGenerationRequestMessage

type ProofGenerationRequestMessage struct {
	ID       string                    `json:"id"`
	Typ      iden3comm.MediaType       `json:"typ,omitempty"`
	Type     iden3comm.ProtocolMessage `json:"type"`
	ThreadID string                    `json:"thid,omitempty"`

	Body ProofGenerationRequestMessageBody `json:"body,omitempty"`

	From string `json:"from,omitempty"`
	To   string `json:"to,omitempty"`
}

ProofGenerationRequestMessage is struct the represents body for proof generation request

type ProofGenerationRequestMessageBody

type ProofGenerationRequestMessageBody struct {
	Scope []ZeroKnowledgeProofRequest `json:"scope"`
}

ProofGenerationRequestMessageBody is struct the represents body for proof generation request

type ProofGenerationResponseMessage

type ProofGenerationResponseMessage struct {
	ID       string                    `json:"id"`
	Typ      iden3comm.MediaType       `json:"typ,omitempty"`
	Type     iden3comm.ProtocolMessage `json:"type"`
	ThreadID string                    `json:"thid,omitempty"`

	Body ResponseMessageBody `json:"body,omitempty"`

	From string `json:"from,omitempty"`
	To   string `json:"to,omitempty"`
}

ProofGenerationResponseMessage is struct the represents body for proof generation request

type ResponseMessageBody

type ResponseMessageBody struct {
	Scope []ZeroKnowledgeProofResponse `json:"scope"`
}

ResponseMessageBody is struct the represents request for revocation status

type RevocationStatusRequestMessage

type RevocationStatusRequestMessage struct {
	ID       string                             `json:"id"`
	Typ      iden3comm.MediaType                `json:"typ,omitempty"`
	Type     iden3comm.ProtocolMessage          `json:"type"`
	ThreadID string                             `json:"thid,omitempty"`
	Body     RevocationStatusRequestMessageBody `json:"body,omitempty"`

	From string `json:"from,omitempty"`
	To   string `json:"to,omitempty"`
}

RevocationStatusRequestMessage is struct the represents body for proof generation request

type RevocationStatusRequestMessageBody

type RevocationStatusRequestMessageBody struct {
	RevocationNonce uint64 `json:"revocation_nonce"`
}

RevocationStatusRequestMessageBody is struct the represents request for revocation status

type RevocationStatusResponseMessage

type RevocationStatusResponseMessage struct {
	ID       string                    `json:"id"`
	Typ      iden3comm.MediaType       `json:"typ,omitempty"`
	Type     iden3comm.ProtocolMessage `json:"type"`
	ThreadID string                    `json:"thid,omitempty"`

	Body RevocationStatusResponseMessageBody `json:"body,omitempty"`

	From string `json:"from,omitempty"`
	To   string `json:"to,omitempty"`
}

RevocationStatusResponseMessage is struct the represents body for proof generation request

type RevocationStatusResponseMessageBody

type RevocationStatusResponseMessageBody struct {
	verifiable.RevocationStatus
}

RevocationStatusResponseMessageBody is struct the represents request for revocation status

type Schema

type Schema struct {
	Hash string `json:"hash,omitempty"`
	URL  string `json:"url"`
	Type string `json:"type"`
}

Schema represents location and type where it's stored

type TransactionData added in v1.0.0

type TransactionData struct {
	ContractAddress string `json:"contract_address"`
	MethodID        string `json:"method_id"`
	ChainID         int    `json:"chain_id"`
	Network         string `json:"network"`
}

TransactionData represents structure for on chain verification

type ZeroKnowledgeProofRequest

type ZeroKnowledgeProofRequest struct {
	ID        uint32                 `json:"id"` // unique request id
	CircuitID string                 `json:"circuitId"`
	Optional  *bool                  `json:"optional,omitempty"`
	Query     map[string]interface{} `json:"query"`
}

ZeroKnowledgeProofRequest represents structure of zkp request object

type ZeroKnowledgeProofResponse

type ZeroKnowledgeProofResponse struct {
	ID                     uint32          `json:"id"` // unique id to present unique proof request
	CircuitID              string          `json:"circuitId"`
	VerifiablePresentation json.RawMessage `json:"vp,omitempty"`
	types.ZKProof
}

ZeroKnowledgeProofResponse represents structure of zkp response

Jump to

Keyboard shortcuts

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