auth

package
v0.8.77 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: AGPL-3.0, AGPL-3.0-or-later, Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrUsernamesMismatch    warpnet.WarpError = "username doesn't exist"
	ErrAlreadyAuthenticated warpnet.WarpError = "already authenticated"
)
View Source
const (
	MinPasswordLength = 8
	MaxPasswordLength = 32

	ErrEmptyPassword             warpnet.WarpError = "empty password"
	ErrMinPasswordLength         warpnet.WarpError = "password must be at least 8 characters"
	ErrMaxPasswordLength         warpnet.WarpError = "password must be at least 32 characters"
	ErrPasswordUpperCaseRequired warpnet.WarpError = "password must have at least one uppercase letter"
	ErrPasswordLowerCaseRequired warpnet.WarpError = "password must have at least one lowercase letter"
	ErrPasswordDigitRequired     warpnet.WarpError = "password must have at least one digit"
	ErrPasswordSpecialRequired   warpnet.WarpError = "password must have at least one special character"
)
View Source
const DefaultUsername = "Anonymous"

DefaultUsername is the public name of a new profile: the login is half of the database and identity key secret, so it never becomes the profile name.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthPersistencyLayer

type AuthPersistencyLayer interface {
	Authenticate(username, password string) error
	SessionToken() string
	GetOwner() domain.Owner
	SetOwner(domain.Owner) (domain.Owner, error)
	PrivateKey() ed25519.PrivateKey
	Logout()
}

type AuthService

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

func NewAuthService

func NewAuthService(
	ctx context.Context,
	authRepo AuthPersistencyLayer,
	userRepo UserPersistencyLayer,
	authReady chan domain.AuthNodeInfo,
) *AuthService

func (*AuthService) AuthLogin

func (as *AuthService) AuthLogin(message event.LoginEvent, psk security.PSK) (authInfo event.LoginResponse, err error)

func (*AuthService) AuthLogout added in v0.6.175

func (as *AuthService) AuthLogout()

func (*AuthService) IsAuthenticated

func (as *AuthService) IsAuthenticated() bool

func (*AuthService) PrivateKey

func (as *AuthService) PrivateKey() ed25519.PrivateKey

func (*AuthService) Reset added in v0.7.179

func (as *AuthService) Reset()

Reset clears the authenticated guard so the same process can log in again after a logout. The remote node keeps its node running and reopens the database on the next login; the member app stops its node and raises a new one, so both call this once the logout has gone through.

func (*AuthService) Storage

func (as *AuthService) Storage() AuthPersistencyLayer

type UserPersistencyLayer

type UserPersistencyLayer interface {
	Create(user domain.User) (domain.User, error)
	Update(userId string, newUser domain.User) (domain.User, error)
}

Jump to

Keyboard shortcuts

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