identities

package
v0.0.0-...-f98e9bb Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2025 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FREE_IDENTITY_LIFETIME     = 10 * 24 * time.Hour // 10 days
	GARBAGE_COLLECTOR_INTERVAL = 2 * time.Minute
)

TODO: move this to a config value

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthenticatedIdentity

type AuthenticatedIdentity struct {
	IdentityId   *common.Ulid
	CredentialId *common.Ulid
}

type CredentialRecord

type CredentialRecord struct {
	Id string
}

type FreeIdentity

type FreeIdentity struct {
	IdentityId *common.Ulid
}

type IdentityRecord

type IdentityRecord struct {
	Id   string
	Name string
}

type IdentityRepository

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

func NewRepo

func (*IdentityRepository) CreateIdentity

func (repo *IdentityRepository) CreateIdentity(
	tx *sql.Tx,
	versionBy string,
	id string,
	name string,
) (*IdentityRecord, error)

func (*IdentityRepository) CreatePasswordCredential

func (repo *IdentityRepository) CreatePasswordCredential(
	tx *sql.Tx,
	versionBy string,
	identity string,
	hash []byte,
) (*CredentialRecord, error)

func (*IdentityRepository) DeleteExpiredFreeIdentities

func (repo *IdentityRepository) DeleteExpiredFreeIdentities(tx *sql.Tx, id string) error

func (*IdentityRepository) FindCredentialCount

func (repo *IdentityRepository) FindCredentialCount(tx *sql.Tx) (int, error)

func (*IdentityRepository) FindFreeIdentities

func (repo *IdentityRepository) FindFreeIdentities(tx *sql.Tx) ([]*IdentityRecord, error)

func (*IdentityRepository) FindFreeIdentityById

func (repo *IdentityRepository) FindFreeIdentityById(tx *sql.Tx, id string) (*IdentityRecord, error)

func (*IdentityRepository) FindIdentityById

func (repo *IdentityRepository) FindIdentityById(tx *sql.Tx, id string) (*IdentityRecord, error)

func (*IdentityRepository) FindPasswordCredentialByIdentityName

func (repo *IdentityRepository) FindPasswordCredentialByIdentityName(
	tx *sql.Tx,
	name string,
) (*PasswordCredentialRecord, error)

func (*IdentityRepository) UpdateIdentityName

func (repo *IdentityRepository) UpdateIdentityName(tx *sql.Tx, id string, name string) (*IdentityRecord, error)

type IdentityService

type IdentityService interface {
	EnsureInitialIdentity() error
	CreateFreeIdentity(session session.Session) (*FreeIdentity, error)
	AuthenticateByNameAndPassword(name string, password string) (*AuthenticatedIdentity, error)
	FindFreeIdentities(session session.Session) ([]*FreeIdentity, error)
	FindFreeIdentityById(session session.Session, id *common.Ulid) (*FreeIdentity, error)
	RegisterWithNameAndPassword(
		session session.Session,
		freeId *common.Ulid,
		name string,
		password string,
	) (*AuthenticatedIdentity, error)
	FindIdentityNameById(session session.Session, id *common.Ulid) (string, error)
}

type PasswordCredentialRecord

type PasswordCredentialRecord struct {
	Id       string
	Identity string
	Hash     []byte
}

Jump to

Keyboard shortcuts

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