openvasp

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2025 License: MIT Imports: 14 Imported by: 1

Documentation

Index

Constants

View Source
const (
	APIVersionHeader        = "api-version"
	APIExtensionsHeader     = "api-extensions"
	RequestIdentifierHeader = "request-identifier"
	ContentTypeHeader       = "content-type"
)

OpenVASP Application Headers

View Source
const (
	APIVersion       = "3.1.0"
	ContentTypeValue = "application/json; charset=utf-8"
	MIMEJSON         = "application/json"
	MIMEPlainText    = "text/plain"
)

OpenVASP Application Header Values

View Source
const (
	SealedTRISAExtension   = "sealed-trisa-envelope"
	UnsealedTRISAExtension = "unsealed-trisa-envelope"
)

TRISA extensions

View Source
const (
	// Maximum size in bytes for a travel rule payload: 10MiB
	MaxPayloadSize = 1.049e+7
)

Variables

This section is empty.

Functions

func APIChecks

func APIChecks(next http.Handler) http.Handler

APIChecks is middleware that asserts that the headers in the TRP request are correct and valid, ensuring that the core protocol is implemented correctly.

func EnvelopeToPayload

func EnvelopeToPayload(env *envelope.Envelope) (*trp.Inquiry, error)

Convert a TRISA envelope to a TRP payload. If the envelope is sealed, then this returns a payload with the SealedTRISAEnvelope extension. If the envelope is unsealed, then this returns a payload with the UnsealedTRISAEnvelope extension. If the envelope is in the clear then this returns a standard TRP payload with no TRISA extensions.

func ParseTRPInfo

func ParseTRPInfo(r *http.Request) *trp.Info

Parse TRPInfo from the headers of an HTTP request. If any headers are not present, then the info is populated with assumed fields or empty values as appropriate. TODO: parse the LNURL from the URL rather than passing the raw URL.

func TransferConfirmation

func TransferConfirmation(handler ConfirmationHandler) http.Handler

func TransferInquiry

func TransferInquiry(handler InquiryHandler) http.Handler

Types

type ConfirmationHandler

type ConfirmationHandler interface {
	OnConfirmation(*trp.Confirmation) error
}

type InquiryHandler

type InquiryHandler interface {
	OnInquiry(*trp.Inquiry) (*trp.Resolution, error)
}

type SealedTRISAEnvelope

type SealedTRISAEnvelope struct {
	Envelope string `json:"envelope"`
}

The SealedTRISAEnvelope extension is used to faciliate the TRISA protocol by providing a JSON serialized version of the secure envelope that contains the transaction.

type TransactionPayload

type TransactionPayload struct {
	// Transaction ID on the blockchain or network.
	TxID string `json:"txid,omitempty"`

	// Crypto address of the originator and beneficiary.
	Originator  string `json:"originator,omitempty"`
	Beneficiary string `json:"beneficiary,omitempty"`

	// Amount and asset type of the transaction.
	Amount    float64 `json:"amount,omitempty"`
	AssetType string  `json:"asset_type,omitempty"`

	// The blockchain or network of the transaction.
	Network string `json:"network,omitempty"`

	// The RFC3339 timestamp of the transaction.
	Timestamp string `json:"timestamp,omitempty"`

	// Tags and extra JSON data about the transaction.
	Tag       string                 `json:"tag,omitempty"`
	ExtraJSON map[string]interface{} `json:"extra_json,omitempty"`
}

The TransactionPayload extension is used to provide information about the transaction on the blockchain or network so it can be linked to the identity information in the TRP payload.

type UnsealedTRISAEnvelope

type UnsealedTRISAEnvelope struct {
	// Transaction ID generated by the originator.
	Id string `json:"id"`

	// The encrypted payload containing the IVMS101 identity and generic transaction.
	Payload []byte `json:"payload"`

	// Encryption key used to encrypt the payload, in this struct the key is unencrypted.
	EncryptionKey       []byte `json:"encryption_key"`
	EncryptionAlgorithm string `json:"encryption_algorithm"`

	// HMAC of the payload to ensure integrity.
	HMAC          []byte `json:"hmac"`
	HMACSecret    []byte `json:"hmac_secret"`
	HMACAlgorithm string `json:"hmac_algorithm"`
}

The UnsealedTRISAEnvelope extension is used to provide an unsealed version of a secure envelope where the key is unencrypted, allowing any party to decrypt the payload and access the identity and transaction information.

Directories

Path Synopsis
extensions
discoverability
See: https://gitlab.com/OpenVASP/travel-rule-protocol/-/blob/master/extensions/discoverability.md
See: https://gitlab.com/OpenVASP/travel-rule-protocol/-/blob/master/extensions/discoverability.md
Helper functions for encoding and decoding (LNURLs) which are used to specify which VASP controls a specific virtual asset address.
Helper functions for encoding and decoding (LNURLs) which are used to specify which VASP controls a specific virtual asset address.
Helper functions for encoding and decoding Travel Addresses, which are used to specify which VASP controls a specific virtual asset address.
Helper functions for encoding and decoding Travel Addresses, which are used to specify which VASP controls a specific virtual asset address.
trp
v3
See: https://gitlab.com/OpenVASP/travel-rule-protocol/-/blob/master/core/specification.md
See: https://gitlab.com/OpenVASP/travel-rule-protocol/-/blob/master/core/specification.md

Jump to

Keyboard shortcuts

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