control

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: MIT, MIT Imports: 12 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package control is lys-secrets' login channel: a unix socket in the user's runtime directory through which lys-login's login and lock screens hand over the password they just verified, so the login collection unlocks with it, and through which a password change moves the login collection from the old password to the new. No password crosses D-Bus. Only processes of the same user may connect, checked with SO_PEERCRED.

Wire format: the client sends one request byte, then each of the request's passwords as a big-endian u32 length and the bytes (unlock: the password; rekey: the old password, then the new); the server answers one status byte.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotRunning    = errors.New("lys-secrets is not running")
	ErrWrongPassword = errors.New("lys-secrets: the password does not unlock the login collection")
)

Errors a client tells apart. ErrWrongPassword is also what a Login returns, or wraps, for a password that does not open the login collection.

Functions

func Listen

func Listen(path string) (*usersock.Listener, error)

Listen binds the socket at path in a 0700 directory, replacing a stale socket a dead server left.

func ReadPassword

func ReadPassword(r io.Reader) ([]byte, error)

ReadPassword reads a password whatever started the process wrote to an inherited descriptor (--unlock-fd): the whole stream, without a trailing newline.

func Rekey

func Rekey(path string, old, next []byte) error

Rekey asks the lys-secrets serving path to move the login collection from the password old to next, as a password change does. No server is ErrNotRunning; an old password that does not open the login collection, which next does not open either, is ErrWrongPassword.

func Serve

func Serve(ctx context.Context, ln *usersock.Listener, l Login)

Serve answers requests on ln until ctx ends.

func SocketPath

func SocketPath(env xdg.Env) (string, error)

SocketPath is $XDG_RUNTIME_DIR/lys-secrets/control as env resolves it, so a process may find the socket of a session other than its own; an error when XDG_RUNTIME_DIR holds no absolute path, since there is no other place the user's session agrees on.

func Unlock

func Unlock(path string, password []byte) error

Unlock hands password to the lys-secrets serving path. No server is ErrNotRunning; a password that does not open the login collection is ErrWrongPassword.

Types

type Login

type Login interface {
	// UnlockLogin unlocks it with the login password.
	UnlockLogin(password []byte) error
	// RekeyLogin moves it from the login password old to next.
	RekeyLogin(old, next []byte) error
}

Login is the login collection as the socket serves it; a password that does not open it is an error matching ErrWrongPassword.

Jump to

Keyboard shortcuts

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