directhttps

package
v0.0.0-...-692025b Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: GPL-3.0, GPL-3.0 Imports: 21 Imported by: 0

Documentation

Overview

Package directhttps provides the bounded HTTPS first-contact fallback. It is a carrier only: E2EE session authority and admission remain in the daemon.

Index

Constants

View Source
const (
	RequestSchema = "tos.messaging.https-delivery.v1"
	AckSchema     = "tos.messaging.https-delivery-ack.v1"
	IngressPath   = "/v1/tos-messenger/messages"
	MaxBodyBytes  = 2 << 20
	MaxAckBytes   = 64 << 10
	MaxClockSkew  = 5 * time.Minute
)

Variables

This section is empty.

Functions

func NewHandler

func NewHandler(config HandlerConfig) (http.Handler, error)

Types

type Ack

type Ack struct {
	Schema              string     `json:"schema"`
	EventID             string     `json:"event_id"`
	SessionID           string     `json:"session_id"`
	RecipientEndpointID string     `json:"recipient_messaging_endpoint_id"`
	RecipientDeviceID   string     `json:"recipient_device_id"`
	CiphertextDigest    string     `json:"ciphertext_digest"`
	Outcome             string     `json:"outcome"`
	Code                fault.Code `json:"code,omitempty"`
	AcceptedAtUnix      uint64     `json:"accepted_at_unix"`
	SignatureHex        string     `json:"endpoint_signature_hex"`
}

type HandlerConfig

type HandlerConfig struct {
	Receiver             Receiver
	Signer               crypto.Signer
	EndpointID, DeviceID string
	Now                  func() time.Time
}

type ReceiveResult

type ReceiveResult struct {
	Outcome string
	Code    fault.Code
}

type Receiver

type Receiver interface {
	ReceiveHTTPS(context.Context, dispatch.Message) (ReceiveResult, error)
}

type Sender

type Sender struct {
	Client  *http.Client
	Targets TargetResolver
	Now     func() time.Time
}

func (Sender) Send

func (s Sender) Send(ctx context.Context, message dispatch.Message) error

type Target

type Target struct {
	URL               string
	EndpointPublicKey ed25519.PublicKey
}

type TargetResolver

type TargetResolver interface {
	ResolveHTTPS(context.Context, string) (Target, error)
}

Jump to

Keyboard shortcuts

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