models

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Possible handshake types
	HANDSHAKE_TYPE_PERSONAL = 0
	HANDSHAKE_TYPE_SIGNUP   = 1
	HANDSHAKE_TYPE_SERVER   = 2

	// Possible handshake statuses
	HANDSHAKE_STATUS_ACCEPTED = 0
	HANDSHAKE_STATUS_REVOKED  = 1
	HANDSHAKE_STATUS_PENDING  = 2

	// Possbile handshake signup sub types
	HANDSHAKE_SIGNUP_SUBTYPE_TRANSACTIONAL = 0
	HANDSHAKE_SIGNUP_SUBTYPE_PRODUCT       = 1
	HANDSHAKE_SIGNUP_SUBTYPE_SECURITY      = 2
	HANDSHAKE_SIGNUP_SUBTYPE_PROMOTION     = 3
	HANDSHAKE_SIGNUP_SUBTYPE_NEWSLETTER    = 4
	HANDSHAKE_SIGNUP_SUBTYPE_REQUEST       = 5
	HANDSHAKE_SIGNUP_SUBTYPE_OTHER         = 6

	// Possible handshake levels
	HANDSHAKE_LEVEL_NONE         = 0
	HANDSHAKE_LEVEL_RECAPTCHAV3  = 1
	HANDSHAKE_LEVEL_POH          = 2 // proof of humanity
	HANDSHAKE_LEVEL_FACE_TO_FACE = 3 // face to face created handshake

	// Possible signatures schemes
	HANDSHAKE_SIGNATURE_SCHEME_EdDSA_X25519 = 0
)
View Source
const (
	// Possible protocols
	PROTOCOL_HTTPS = "https"
	PROTOCOL_PROTO = "proto"

	PROTOCOL_PURPOSE_REST_API = "restapi"
	PROTOCOL_PURPOSE_EXCHANGE = "exchange"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Handshake

type Handshake struct {
	Content     HandshakeContent `json:"content"`     // handshake content
	Signature   string           `json:"signature"`   // signature of the handshake
	CborPayload string           `json:"cborPayload"` // cbor payload of the handshake
}

type HandshakeContent added in v0.2.1

type HandshakeContent struct {
	HandshakeID          string                `json:"handshakeId,omitempty"`         // handshake ID
	OriginServer         HandshakeOriginServer `json:"originServer,omitempty"`        // origin server
	SignupSubType        *int                  `json:"signupSubType,omitempty"`       // handshake signup sub type
	SignupRules          *HandshakeSignupRules `json:"signupRules,omitempty"`         // handshake signup rules
	Status               int                   `json:"status"`                        // handshake status
	Level                int                   `json:"level"`                         // handshake level
	OwnerPublicKeyBase64 string                `json:"ownerPublicKey"`                // owner public key of the owner of the handshake
	OwnerAddressHex      string                `json:"ownerAddress"`                  // mailio address of the owner of the handshake
	SenderAddress        string                `json:"senderSha512Address,omitempty"` // senders scrypted email address or mailio address
	Signature            string                `json:"signature,omitempty"`           // owners signature of the handshake
	Type                 int                   `json:"type,omitempty"`                // handshake type
	SignatureScheme      int                   `json:"signatureScheme"`               // handshake signature scheme
	Created              int64                 `json:"timestamp"`                     // timestamp of the handshake
}

* Basic handshake structure which can be passed onto clients

Handshake is a struct that represents a handshake between two Mailio users or a Mailio user and a Mailio server

func HandshakeContentProtoToStruct added in v0.1.3

func HandshakeContentProtoToStruct(proto *v1.HandshakeContent) *HandshakeContent

type HandshakeHeader added in v0.1.5

type HandshakeHeader struct {
	SignatureScheme         string    `json:"signatureScheme"`
	EmailLookupScryptScheme string    `json:"emailScryptLookupScheme"`
	Created                 time.Time `json:"created"`
}

type HandshakeLookup added in v0.1.5

type HandshakeLookup struct {
	HandshakeID       string `json:"handshakeId,omitempty"`
	ScryptLookupEmail string `json:"scryptLookupEmail,omitempty"`
	Address           string `json:"address,omitempty"`
}

type HandshakeOriginServer

type HandshakeOriginServer struct {
	Domain     string `json:"domain,omitempty"`     // domain of the server
	P2PAddress string `json:"p2pAddress,omitempty"` // P2P address of the server
	ServerIP   string `json:"serverIp,omitempty"`   // server IP address
}

type HandshakeRequest added in v0.1.5

type HandshakeRequest struct {
	Header HandshakeHeader   `json:"header"`
	Lookup []HandshakeLookup `json:"lookup"`
}

func HandshakeRequestProtoToStruct added in v0.1.4

func HandshakeRequestProtoToStruct(protos []*v1.HandshakeRequest) ([]*HandshakeRequest, error)

converts a list of handshake request protos to a list of handshake request structs

type HandshakeSignupRules

type HandshakeSignupRules struct {
	FrequencyMinutes int64 `json:"frequencyMinutes"` // frequency of the signup requests in seconds
}

type ServerCapabilities

type ServerCapabilities struct {
	EmailDomains                     []string          `json:"emailDomains,omitempty"`                                     // supported email domains
	SupportedProtocols               []*ServerProtocol `json:"supportedProtocols" validate:"required,min=2"`               // list of supported protocols (at least REST and Proto protocols)
	MaximumMessageSizeBytes          int64             `json:"maximumMessageSizeBytes" validate:"required,min=1"`          // maximum message size in bytes
	MaximumSingleAttachmentSizeBytes int64             `json:"maximumSingleAttachmentSizeBytes" validate:"required,min=1"` // maximum single attachment size in bytes
}

ServerCapabilites

type ServerProtocol

type ServerProtocol struct {
	Name    string `json:"name,omitempty"`                                     // name of the protocol
	Version string `json:"version" validate:"required"`                        // version of the protocol
	Type    string `json:"type" validate:"required,oneof=https proto"`         // type of the protocol
	Purpose string `json:"purpose" validate:"required,oneof=restapi exchange"` // purpose of the protocol
}

Protocol description, purpose and version

Jump to

Keyboard shortcuts

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