handshake

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package handshake answers the GET some providers send before they will accept a callback address.

It shares an address with the inbound port and inverts its rule: a webhook is never rejected for what it says, and a handshake exists to be rejected. An address a stranger can confirm is an address anyone can point at their own provider, so a wrong token is refused and nothing is recorded either way.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Tokens Tokens
	Logger *slog.Logger
}

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

func New

func New(tenants Tenants, cfg Config) *Handler

func (*Handler) Answer

func (h *Handler) Answer(w http.ResponseWriter, r *http.Request)

func (*Handler) Register

func (h *Handler) Register(mux *http.ServeMux)

type Tenants

type Tenants interface {
	Tenant(ctx context.Context, slug string) (uuid.UUID, bool, error)
}

Declared here, by the side that consumes them, so this package depends on no storage.

type Tokens

type Tokens interface {
	// VerifyToken is the token a provider must offer, and whether one was
	// ever asked for. A provider that asked and whose token cannot be read
	// here answers ("", true).
	VerifyToken(tenant uuid.UUID, provider string) (token string, configured bool)
}

Declared here, by the side that consumes them, so this package depends on no storage.

Jump to

Keyboard shortcuts

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