api

package
v0.0.0-...-3118640 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2023 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckAuth

func CheckAuth(verify mjwt.Verifier, aud string) func(cb AuthCallback) httprouter.Handle

CheckAuth validates the bearer token against a mjwt.Verifier and returns an error message or continues to the next handler

func MessageSender

func MessageSender(send Smtp) func(rw http.ResponseWriter, req *http.Request, params httprouter.Params, b AuthClaims)

MessageSender is the internal handler for `POST /message` requests the access token is already validated at this point

func SetupApiServer

func SetupApiServer(listen string, auth func(callback AuthCallback) httprouter.Handle, send Smtp, recv Imap) *http.Server

Types

type AuthCallback

type AuthCallback func(rw http.ResponseWriter, req *http.Request, params httprouter.Params, b AuthClaims)

type IcCallback

type IcCallback[T any] func(rw http.ResponseWriter, req *http.Request, params httprouter.Params, cli *imap.Client, t T)

type Imap

type Imap interface {
	MakeClient(user string) (*imap.Client, error)
}

type Smtp

type Smtp interface {
	Send(mail *sendmail.Mail) error
}

Jump to

Keyboard shortcuts

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