handlers

package
v0.0.69 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2021 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Overview

Package handlers contains the API handers for the mailchain client.

Package handlers Mailchain API

All the information needed to talk to the API.

To raise see anything wrong? Raise an [issue](https://github.com/mailchain/mailchain/issues)

Schemes: https
BasePath: /api
Version: ~mailchain-version~

Consumes:
- application/json

Produces:
- application/json

swagger:meta

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteRead

func DeleteRead(store stores.State) func(w http.ResponseWriter, r *http.Request)

DeleteRead returns a handler

func FetchMessages added in v0.0.69

func FetchMessages(inbox stores.State, receivers map[string]mailbox.Receiver, ks keystore.Store) func(w http.ResponseWriter, r *http.Request)

func GetAddresses

func GetAddresses(ks keystore.Store) func(w http.ResponseWriter, r *http.Request)

GetAddresses returns a handler get spec.

func GetDocs

func GetDocs() func(w http.ResponseWriter, r *http.Request)

GetDocs returns a handler get spec

func GetEnvelope added in v0.0.42

func GetEnvelope(sent stores.Sent) func(w http.ResponseWriter, r *http.Request)

GetEnvelope returns the available envelopes.

func GetMessages

func GetMessages(inbox stores.State, cache stores.Cache, ks keystore.Store, deriveKeyOptions multi.OptionsBuilders) func(w http.ResponseWriter, r *http.Request)

GetMessages returns a handler get spec.

func GetProtocols added in v0.0.16

func GetProtocols(base *settings.Root) func(w http.ResponseWriter, r *http.Request)

GetProtocols returns a handler get spec

func GetPublicKey

func GetPublicKey(finders map[string]mailbox.PubKeyFinder) func(w http.ResponseWriter, r *http.Request)

GetPublicKey returns a handler get spec

func GetRead

func GetRead(store stores.State) func(w http.ResponseWriter, r *http.Request)

GetRead returns a handler get spec

func GetResolveAddress added in v0.0.29

func GetResolveAddress(resolvers map[string]nameservice.ReverseLookup) func(w http.ResponseWriter, r *http.Request)

GetResolveAddress returns a handler get spec

func GetResolveName added in v0.0.29

func GetResolveName(resolvers map[string]nameservice.ForwardLookup) func(w http.ResponseWriter, r *http.Request)

GetResolveName returns a handler get spec

func GetSpec

func GetSpec() func(w http.ResponseWriter, r *http.Request)

GetSpec returns a handler get spec

func GetVersion added in v0.0.35

func GetVersion() func(w http.ResponseWriter, r *http.Request)

GetVersion handler that the running version.

func PutRead

func PutRead(store stores.State) func(w http.ResponseWriter, r *http.Request)

PutRead returns a handler put spec

func SendMessage

func SendMessage(sent stores.Sent, senders map[string]sender.Message, ks keystore.Store,
	deriveKeyOptions multi.OptionsBuilders) func(w http.ResponseWriter, r *http.Request)

SendMessage handler http

Types

type GetAddressesItem added in v0.0.56

type GetAddressesItem struct {
	// Address value
	//
	// Required: true
	// example: 0x5602ea95540bee46d03ba335eed6f49d117eab95c8ab8b71bae2cdd1e564a761
	Value string `json:"value"`
	// Encoding method used for encoding the `address`
	//
	// Required: true
	// example: hex/0x-prefix
	Encoding string `json:"encoding"`
}

swagger:response // in: body

type GetAddressesRequest added in v0.0.38

type GetAddressesRequest struct {
	// Network to use when finding addresses.
	//
	// enum: mainnet,goerli,ropsten,rinkeby,local
	// in: query
	// required: true
	// example: goerli
	Network string `json:"network"`

	// Protocol to use when finding addresses.
	//
	// enum: ethereum, substrate
	// in: query
	// required: true
	// example: ethereum
	Protocol string `json:"protocol"`
}

GetAddressesRequest body swagger:parameters GetAddresses

type GetAddressesResponse

type GetAddressesResponse struct {
	// in: body
	Addresses []GetAddressesItem `json:"addresses"`
}

GetAddressesResponse Holds the response messages

swagger:response GetAddressesResponse

type GetEnvelopeResponse added in v0.0.42

type GetEnvelopeResponse struct {
	// in: body
	Body []GetEnvelopeResponseBodyElement
}

GetEnvelopeResponse envelope response

swagger:response GetEnvelopeResponse

type GetEnvelopeResponseBodyElement added in v0.0.51

type GetEnvelopeResponseBodyElement struct {
	// The envelope type
	// Required: true
	// example: 0x01
	Type string `json:"type"`
	// The envelope description
	// Required: true
	// example: Private Message Stored with MLI
	Description string `json:"description"`
}

GetEnvelopeResponseBodyElement response

swagger:model GetEnvelopeResponseBodyElement

type GetMessagesRequest

type GetMessagesRequest struct {
	// Address to use when looking for messages.
	//
	// in: query
	// required: true
	// example: 0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae
	// pattern: 0x[a-fA-F0-9]{40}
	Address string `json:"address"`

	// Network to use when looking for messages.
	//
	// enum: mainnet,goerli,ropsten,rinkeby,local
	// in: query
	// required: true
	// example: goerli
	Network string `json:"network"`

	// Protocol to use when looking for messages.
	//
	// enum: ethereum
	// in: query
	// required: true
	// example: ethereum
	Protocol string `json:"protocol"`
	// contains filtered or unexported fields
}

GetMessagesRequest get mailchain messages swagger:parameters GetMessages

type GetProtocolsProtocol added in v0.0.16

type GetProtocolsProtocol struct {
	// in: body
	Name string `json:"name"`
	// in: body
	Networks []Network `json:"networks"`
}

type GetProtocolsResponse added in v0.0.16

type GetProtocolsResponse struct {
	// in: body
	Protocols []GetProtocolsProtocol `json:"protocols"`
}

GetProtocolsResponse Holds the response messages

swagger:response GetProtocolsResponse

type GetPublicKeyRequest

type GetPublicKeyRequest struct {
	// Address to to use when performing public key lookup.
	//
	// in: query
	// required: true
	// example: 0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae
	// pattern: 0x[a-fA-F0-9]{40}
	Address string `json:"address"`

	// Network to use when performing public key lookup.
	//
	// enum: mainnet,goerli,ropsten,rinkeby,local
	// in: query
	// required: true
	// example: goerli
	Network string `json:"network"`

	// Protocol to use when performing public key lookup.
	//
	// enum: ethereum
	// in: query
	// required: true
	// example: ethereum
	Protocol string `json:"protocol"`
	// contains filtered or unexported fields
}

GetPublicKeyRequest pubic key from address request swagger:parameters GetPublicKey

type GetPublicKeyResponse

type GetPublicKeyResponse struct {
	// in: body
	Body GetPublicKeyResponseBody
}

GetPublicKeyResponse public key from address response

swagger:response GetPublicKeyResponse

type GetPublicKeyResponseBody

type GetPublicKeyResponseBody struct {
	// The public key encoded as per `public-key-encoding`
	//
	// Required: true
	// example: 0x79964e63752465973b6b3c610d8ac773fc7ce04f5d1ba599ba8768fb44cef525176f81d3c7603d5a2e466bc96da7b2443bef01b78059a98f45d5c440ca379463
	PublicKey string `json:"public-key"`

	// Encoding method used for encoding the `public-key`
	//
	// Required: true
	// example: hex/0x-prefix
	PublicKeyEncoding string `json:"public-key-encoding"`

	// Encoding method used for encoding the `public-key`
	//
	// Required: true
	// example: ["secp256k1", "sr25519", "ed25519"]
	PublicKeyKind string `json:"public-key-kind"`

	// Supported encryption methods for public keys.
	//
	// Required: true
	// example: ["aes256cbc", "nacl-ecdh", "noop"]
	SupportedEncryptionTypes []string `json:"supported-encryption-types"`
}

GetPublicKeyResponseBody body response

swagger:model GetPublicKeyResponseBody

type GetResolveAddressRequest added in v0.0.29

type GetResolveAddressRequest struct {
	// name to query to get address for
	//
	// in: path
	// required: true
	// example: 0x4ad2b251246aafc2f3bdf3b690de3bf906622c51
	Address string `json:"address"`

	// Network for the name to resolve
	//
	// enum: mainnet,goerli,ropsten,rinkeby,local
	// in: path
	// required: true
	// example: goerli
	Network string `json:"network"`

	// Protocol for the name to resolve
	//
	// enum: ethereum
	// in: path
	// required: true
	// example: ethereum
	Protocol string `json:"protocol"`
}

GetResolveAddressRequest pubic key from address request swagger:parameters GetResolveAddress

type GetResolveAddressResponse added in v0.0.29

type GetResolveAddressResponse struct {
	// in: body
	Body GetResolveAddressResponseBody
}

GetResolveAddressResponse address of resolved name

swagger:response GetResolveAddressResponse

type GetResolveAddressResponseBody added in v0.0.29

type GetResolveAddressResponseBody struct {
	// The resolved name
	//
	// Required: true
	// example: mailchain.eth
	Name string `json:"name"`

	// The RFC1035 status code describing the outcome of the lookup
	//
	// + 0 - No Error
	// + 1 - Format Error
	// + 2 - Server Failure
	// + 3 - Non-Existent Domain
	// + 4 - Not Implemented
	// + 5 - Query Refused
	//
	// Required: false
	// example: 3
	Status int `json:"status"`
}

GetResolveAddressResponseBody body response

swagger:model GetResolveAddressResponseBody

type GetResolveNameRequest added in v0.0.29

type GetResolveNameRequest struct {
	// name to query to get address for
	//
	// in: path
	// required: true
	// example: mailchain.eth
	Name string `json:"domain-name"`

	// Network for the name to resolve
	//
	// enum: mainnet,goerli,ropsten,rinkeby,local
	// in: path
	// required: true
	// example: goerli
	Network string `json:"network"`

	// Protocol for the name to resolve
	//
	// enum: ethereum
	// in: path
	// required: true
	// example: ethereum
	Protocol string `json:"protocol"`
}

GetResolveNameRequest pubic key from address request swagger:parameters GetResolveName

type GetResolveNameResponse added in v0.0.29

type GetResolveNameResponse struct {
	// in: body
	Body GetResolveNameResponseBody
}

GetResolveNameResponse address of resolved name

swagger:response GetResolveNameResponse

type GetResolveNameResponseBody added in v0.0.29

type GetResolveNameResponseBody struct {
	// The resolved address
	//
	// Required: true
	// example: 0x4ad2b251246aafc2f3bdf3b690de3bf906622c51
	Address string `json:"address"`

	// The rFC1035 status code describing the outcome of the lookup
	//
	// + 0 - No Error
	// + 1 - Format Error
	// + 2 - Server Failure
	// + 3 - Non-Existent Domain
	// + 4 - Not Implemented
	// + 5 - Query Refused
	//
	// Required: false
	// example: 3
	Status int `json:"status"`
}

GetResolveNameResponseBody body response

swagger:model GetResolveNameResponseBody

type GetVersionResponse added in v0.0.35

type GetVersionResponse struct {
	// in: body
	Body GetVersionResponseBody
}

GetVersionResponse version response

swagger:response GetVersionResponse

type GetVersionResponseBody added in v0.0.35

type GetVersionResponseBody struct {
	// The resolved version tag
	// Required: true
	// example: 1.0.0
	VersionTag string `json:"version"`
	// The resolved version commit
	// Required: true
	VersionCommit string `json:"commit"`
	// The resolved version release date
	// Required: true
	// example: 2019-09-04T21:59:26Z
	VersionDate string `json:"time"`
}

GetVersionResponseBody response

swagger:model GetVersionResponseBody

type Network added in v0.0.38

type Network struct {
	Name                      string `json:"name"`
	ID                        string `json:"id"`
	NameServiceDomainEnabled  bool   `json:"nameservice-domain-enabled"`
	NameServiceAddressEnabled bool   `json:"nameservice-address-enabled"`
}

type PostHeaders

type PostHeaders struct {
	// The sender of the message
	// required: true
	// example: Charlotte <5602ea95540bee46d03ba335eed6f49d117eab95c8ab8b71bae2cdd1e564a761@ropsten.ethereum>
	From string `json:"from"`
	// The recipient of the message
	// required: true
	// To: <4cb0a77b76667dac586c40cc9523ace73b5d772bd503c63ed0ca596eae1658b2@ropsten.ethereum>
	To string `json:"to"`
	// Reply to if the reply address is different to the from address.
	ReplyTo string `json:"reply-to"`
}

PostHeaders body swagger:model PostMessagesResponseHeaders

type PostMessage

type PostMessage struct {
	// Headers
	// required: true
	// in: body
	Headers *PostHeaders `json:"headers"`
	// Body of the mail message
	// required: true
	// example: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur maximus metus ante,
	// sit amet ullamcorper dui hendrerit ac. Sed vestibulum dui lectus, quis eleifend urna mollis eu.
	// Integer dictum metus ut sem rutrum aliquet.
	Body string `json:"body"`
	// Subject of the mail message
	// required: true
	// example: Hello world
	Subject string `json:"subject"`
	// Public key of the recipient to encrypt with
	// required: true
	PublicKey string `json:"public-key"`
	// Public key Encoding
	// required: true
	PublicKeyEncoding string `json:"public-key-encoding"`
	// Public key kind
	// require: true
	PublicKeyKind string `json:"public-key-kind"`
}

PostMessage body swagger:model PostMessagesResponseMessage

type PostRequest

type PostRequest struct {
	// Network to use when sending a message.
	//
	// enum: mainnet,goerli,ropsten,rinkeby,local
	// in: query
	// required: true
	// example: goerli
	Network string `json:"network"`

	// Protocol to use when sending a message.
	//
	// enum: ethereum
	// in: query
	// required: true
	// example: ethereum
	Protocol string `json:"protocol"`

	// Message to send
	// in: body
	// required: true
	Body PostRequestBody
}

PostRequest get mailchain inputs swagger:parameters SendMessage

type PostRequestBody

type PostRequestBody struct {
	// required: true
	Message PostMessage `json:"message"`

	// Envelope that should be used
	// required: true
	// enum: 0x01, 0x50
	Envelope string `json:"envelope"`
	// Encryption method name
	// required: true
	// enum: aes256cbc, nacl, noop
	EncryptionName string `json:"encryption-method-name"`
	// Message content-type provided by the client
	// required: false (default text/plain; charset=\"UTF-8\")
	// enum: 'text/plain; charset=\"UTF-8\"', 'text/html; charset=\"UTF-8\"'
	ContentType string `json:"content-type"`
	// contains filtered or unexported fields
}

PostRequestBody body swagger:model SendMessageRequestBody

type StatusOK

type StatusOK struct {
}

StatusOK Description of an StatusOK. swagger:response StatusOK

Jump to

Keyboard shortcuts

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