security

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package security contains CLI tooling for automated security analysis: performance regression gates, static-analysis scanner baselines, and related helper scripts.

What this package must NOT do

  • Be imported by library code — it exists solely as tooling.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConstantTimeEqual

func ConstantTimeEqual(a, b []byte) bool

func HOTPCode

func HOTPCode(secret []byte, counter int64, digits int, algorithm string) (string, error)

Types

type PasswordReport

type PasswordReport struct {
	Memory      uint32
	Time        uint32
	Parallelism uint8
	SaltLength  uint32
	KeyLength   uint32
}

type Report

type Report struct {
	ProductionMode               bool
	SigningAlgorithm             string
	ValidationMode               int
	StrictMode                   bool
	AccessTTL                    time.Duration
	RefreshTTL                   time.Duration
	Argon2                       PasswordReport
	TOTPEnabled                  bool
	BackupEnabled                bool
	DeviceBindingEnabled         bool
	RefreshRotationEnabled       bool
	RefreshReuseDetectionEnabled bool
	SessionCapsActive            bool
	RateLimitingActive           bool
	EmailVerificationActive      bool
	PasswordResetActive          bool
}

func BuildReport

func BuildReport(input ReportInput) Report

type ReportInput

type ReportInput struct {
	ProductionMode               bool
	SigningAlgorithm             string
	ValidationMode               int
	StrictMode                   bool
	AccessTTL                    time.Duration
	RefreshTTL                   time.Duration
	Password                     PasswordReport
	TOTPEnabled                  bool
	BackupCodeCount              int
	DeviceBindingEnabled         bool
	RefreshRotationEnabled       bool
	RefreshReuseDetectionEnabled bool
	EnableRefreshThrottle        bool
	EmailVerificationEnabled     bool
	PasswordResetEnabled         bool
	MaxSessionsPerUser           int
	MaxSessionsPerTenant         int
	EnforceSingleSession         bool
	ConcurrentLoginLimit         int
	MaxLoginAttempts             int
	LoginCooldownDuration        time.Duration
}

type TOTPConfig

type TOTPConfig struct {
	Issuer    string
	Period    int
	Digits    int
	Algorithm string
	Skew      int
}

type TOTPManager

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

func NewTOTPManager

func NewTOTPManager(cfg TOTPConfig) *TOTPManager

func (*TOTPManager) GenerateSecret

func (m *TOTPManager) GenerateSecret() ([]byte, string, error)

func (*TOTPManager) ProvisionURI

func (m *TOTPManager) ProvisionURI(secretBase32, account string) string

func (*TOTPManager) VerifyCode

func (m *TOTPManager) VerifyCode(secret []byte, code string, now time.Time) (bool, int64, error)

Jump to

Keyboard shortcuts

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