event

package
v0.0.0-...-4ff1bda Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package event defines the audit event sink for security-relevant auth events.

Index

Constants

View Source
const (
	TypeLoginSuccess   = "login.success"
	TypeLoginFailure   = "login.failure"
	TypeLockout        = "lockout"
	TypeTokenIssued    = "token.issued"
	TypeTokenRevoked   = "token.revoked"
	TypeSessionRevoked = "session.revoked"
)

Well-known event types.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Type     string
	UserID   string
	ClientID string
	IP       string
	At       time.Time
	Detail   map[string]any
}

Event is one security-relevant occurrence for audit/SIEM.

type Sink

type Sink interface {
	Emit(ctx context.Context, e Event)
}

Sink receives security-relevant events. Implementations must be non-blocking or buffer internally; Emit is called inline on request paths.

func Discard

func Discard() Sink

Discard returns a Sink that drops every event.

type SinkFunc

type SinkFunc func(ctx context.Context, e Event)

SinkFunc adapts a plain function to the Sink interface.

func (SinkFunc) Emit

func (f SinkFunc) Emit(ctx context.Context, e Event)

Emit implements Sink.

Jump to

Keyboard shortcuts

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