services

package
v0.3.12 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2026 License: AGPL-3.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTokenNotFound = fmt.Errorf("token: %w", utils.ErrHttpNotFound)

Functions

func NewSessionService

func NewSessionService() middlewares.SessionService

Types

type EdDSAKeyStrategy

type EdDSAKeyStrategy struct{}

func (*EdDSAKeyStrategy) Export

func (s *EdDSAKeyStrategy) Export(privateKey any) (string, error)

func (*EdDSAKeyStrategy) Generate

func (s *EdDSAKeyStrategy) Generate(clockService clock.Service) (KeyPair, error)

func (*EdDSAKeyStrategy) Import

func (s *EdDSAKeyStrategy) Import(serializedPrivateKey string) (any, any, error)

type KeyAlgorithmStrategy

type KeyAlgorithmStrategy interface {
	Generate(clockService clock.Service) (KeyPair, error)
	Import(serializedPrivateKey string) (any, any, error)
	Export(privateKey any) (string, error)
}

func GetKeyStrategy

func GetKeyStrategy(algorithm config.SigningAlgorithm) KeyAlgorithmStrategy

type KeyCache

type KeyCache caching.Cache[string, KeyPair]

type KeyPair

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

func (*KeyPair) Algorithm

func (k *KeyPair) Algorithm() config.SigningAlgorithm

func (*KeyPair) CreatedAt

func (k *KeyPair) CreatedAt() time.Time

func (*KeyPair) ExpiresAt

func (k *KeyPair) ExpiresAt() time.Time

func (*KeyPair) GetKid

func (k *KeyPair) GetKid() string

func (*KeyPair) PrivateKey

func (k *KeyPair) PrivateKey() any

func (*KeyPair) PrivateKeyBytes

func (k *KeyPair) PrivateKeyBytes() []byte

func (*KeyPair) PublicKey

func (k *KeyPair) PublicKey() any

func (*KeyPair) PublicKeyBytes

func (k *KeyPair) PublicKeyBytes() []byte

func (*KeyPair) RotatesAt

func (k *KeyPair) RotatesAt() time.Time

type KeyService

type KeyService interface {
	Generate(clockService clock.Service, virtualServerName string, algorithm config.SigningAlgorithm) (KeyPair, error)
	GetKey(virtualServerName string, algorithm config.SigningAlgorithm) (KeyPair, error)
}

func NewKeyService

func NewKeyService(cache KeyCache, store KeyStore) KeyService

type KeyStore

type KeyStore interface {
	Get(virtualServerName string, algorithm config.SigningAlgorithm, kid string) (*KeyPair, error)
	GetAll(virtualServerName string) ([]KeyPair, error)
	GetAllForAlgorithm(virtualServerName string, algorithm config.SigningAlgorithm) ([]KeyPair, error)
	Add(virtualServerName string, keyPair KeyPair) error
	Remove(virtualServerName string, algorithm config.SigningAlgorithm, kid string) error
}

func NewDirectoryKeyStore

func NewDirectoryKeyStore() KeyStore

func NewMemoryKeyStore

func NewMemoryKeyStore() KeyStore

func NewVaultKeyStore

func NewVaultKeyStore(addr, token, mountPath, prefix string) (KeyStore, error)

type MailService

type MailService interface {
	Send(m ...*gomail.Message) error
}

func NewMailService

func NewMailService() MailService

type RSAKeyStrategy

type RSAKeyStrategy struct{}

func (*RSAKeyStrategy) Export

func (s *RSAKeyStrategy) Export(privateKey any) (string, error)

func (*RSAKeyStrategy) Generate

func (s *RSAKeyStrategy) Generate(service clock.Service) (KeyPair, error)

func (*RSAKeyStrategy) Import

func (s *RSAKeyStrategy) Import(serializedPrivateKey string) (any, any, error)

type TemplateService

type TemplateService interface {
	Template(ctx context.Context, virtualServerId uuid.UUID, templateType repositories.TemplateType, data any) (string, error)
}

func NewTemplateService

func NewTemplateService() TemplateService

type TokenService

type TokenService interface {
	GenerateAndStoreToken(ctx context.Context, tokenType TokenType, value string, expiration time.Duration) (string, error)
	UpdateToken(ctx context.Context, tokenType TokenType, token string, value string, expiration time.Duration) error
	GetToken(ctx context.Context, tokenType TokenType, token string) (string, error)
	DeleteToken(ctx context.Context, tokenType TokenType, token string) error
	StoreToken(ctx context.Context, tokenType TokenType, token string, value string, expiration time.Duration) error
}

func NewTokenService

func NewTokenService() TokenService

type TokenType

type TokenType string
const (
	EmailVerificationTokenType TokenType = "email_verification"
	LoginSessionTokenType      TokenType = "login_session"
	OidcCodeTokenType          TokenType = "oidc_code"
	OidcRefreshTokenTokenType  TokenType = "oidc_refresh_token"
	OidcDeviceCodeTokenType    TokenType = "oidc_device_code"
	OidcUserCodeTokenType      TokenType = "oidc_user_code"
)

func (TokenType) Key

func (t TokenType) Key(token string) string

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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