Documentation
¶
Overview ¶
Package dashboardauth provides a bcrypt-backed SQLite store for the launcher dashboard password. The database contains a single row (id=1) with the bcrypt hash; no plaintext is ever persisted.
Index ¶
- Constants
- Variables
- type Store
- func (s *Store) Close() error
- func (s *Store) DBPath() string
- func (s *Store) InitializePassword(ctx context.Context, plain string) (bool, error)
- func (s *Store) IsInitialized(ctx context.Context) (bool, error)
- func (s *Store) SetPassword(ctx context.Context, plain string) error
- func (s *Store) VerifyPassword(ctx context.Context, plain string) (bool, error)
Constants ¶
const (
// DBFilename is the SQLite database file stored under the Compa home directory.
DBFilename = "launcher-auth.db"
)
Variables ¶
var ErrUnsupportedPlatform = errors.New("dashboard password store is unavailable on this platform")
ErrUnsupportedPlatform reports that the SQLite-backed password store is not available for the current target platform.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store holds a handle to the SQLite database that stores the bcrypt hash.
func New ¶
New opens (or creates) the database inside dir, using the package's canonical filename. This is the preferred constructor for most callers. Any error is wrapped with the resolved path so callers get actionable output.
func (*Store) InitializePassword ¶
InitializePassword stores plain as the first password. It reports false, changing nothing, when a password is stored already, so of two first-run setups racing each other exactly one succeeds.
func (*Store) IsInitialized ¶
IsInitialized reports whether a password hash has been stored.
func (*Store) SetPassword ¶
SetPassword hashes plain with bcrypt (cost 12) and stores (or replaces) it. The plaintext is never written to disk.