Documentation
¶
Overview ¶
Package fingerprint verifies the human's finger on the machine's reader through fprintd, for the console's approvals in desktop mode.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNoMatch = errors.New("fingerprint: no match") ErrTimeout = errors.New("fingerprint: no finger within the deadline") ErrBusy = errors.New("fingerprint: reader in use") // ErrWrongOwner: the fprintd name is held by a process of another uid // than expected. NewFprintd wraps it together with ErrUnavailable; // callers that treat "unavailable" as "no reader" must refuse on this // one first: a rogue service is not an absent reader. ErrWrongOwner = errors.New("fingerprint: fprintd runs as an unexpected account") ErrNotEnrolled = errors.New("fingerprint: no finger enrolled for the console account") )
Functions ¶
This section is empty.
Types ¶
type Fake ¶
type Fake struct {
// Results are returned by successive Verify calls; nil past the end.
Results []error
// EnrolledN and EnrolledErr answer Enrolled.
EnrolledN int
EnrolledErr error
// Calls counts Verify calls; Ready counts onReady calls.
Calls, Ready int
// Block makes Verify wait for ctx; the result is then ErrTimeout when
// the deadline passed, ctx.Err() otherwise.
Block bool
// NeverReady returns the result without calling onReady (a reader that
// was never claimed: busy, unavailable).
NeverReady bool
}
Fake is a scripted Verifier for tests.
type Fprintd ¶
type Fprintd struct {
// contains filtered or unexported fields
}
Fprintd verifies through the fprintd service on the system bus.
func NewFprintd ¶
NewFprintd connects, activates fprintd if needed and resolves the default device. ErrUnavailable wraps every failure: no bus, no fprintd, no reader, wrong owner.
type Options ¶
type Options struct {
// Address overrides the system bus (tests). Empty: dbus.SystemBus.
Address string
// User is the account whose prints must match. Required.
User string
// OwnerUID is the uid the name owner must run as; -1 disables the check.
OwnerUID int
}
Options configures NewFprintd. Zero values: the system bus, the name owner must run as uid 0. User is required: an empty User is an error.
type Verifier ¶
type Verifier interface {
// Verify blocks until a print enrolled for the console account matches,
// ctx ends (ErrTimeout when its deadline passed, ctx.Err() otherwise),
// or the reader fails (ErrNoMatch, ErrUnavailable, ErrBusy). onReady,
// when not nil, runs once the reader is claimed: the caller prompts the
// human then, never before, so that a finger is never offered to a
// reader another process holds.
Verify(ctx context.Context, onReady func()) error
// Enrolled is the number of prints enrolled for the console account.
Enrolled(ctx context.Context) (int, error)
}
Verifier is what the console asks for a fingerprint.
Click to show internal directories.
Click to hide internal directories.