users

package
v1.0.0-alpha.24 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DialectFromConfig

func DialectFromConfig(raw map[string]any) string

DialectFromConfig returns the sole configured database dialect name, or "" if unset.

func Import

func Import(ctx context.Context, v2Pool service.StatementPool, hashValidator crypto.HashValidator, dialect string, paths []string) error

Import loads bootstrap users from JSON files into the database. dialect is the configured database dialect name (e.g. "postgres"); used to reject unsupported backends.

func Validate

func Validate(doc *Document, hashValidator crypto.HashValidator) error

Validate checks a parsed document and password hash encoding.

Types

type Document

type Document struct {
	Header         Header                                  `json:"header"`
	Attributes     map[domain.AttributeKey]json.RawMessage `json:"attributes"`
	Authenticators map[domain.AttributeKey]json.RawMessage `json:"authenticators"`
}

Document is the on-disk shape for a single bootstrap user (one file per user).

func ParseFile

func ParseFile(path string) (*Document, error)

ParseFile reads and decodes a bootstrap user JSON file.

type Header struct {
	ProjectID string `json:"project_id"`
	TeamID    string `json:"team_id,omitempty"`
	SchemaURL string `json:"schema_url"`
	ID        string `json:"id"`
}

Header holds users-table metadata.

type PasswordAuthenticator

type PasswordAuthenticator struct {
	EncodedHash    string `json:"encoded_hash"`
	ChangeRequired bool   `json:"change_required"`
}

PasswordAuthenticator is the only supported authenticator for bootstrap import.

Jump to

Keyboard shortcuts

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