Skip to content

io.systemd.AskPassword

An interface for interactively asking the user for a password

Property Value
Go package github.com/rossedman/sdvarlink/systemd/latest/askpassword
Socket /run/systemd/io.systemd.AskPassword
Available since systemd v258
Methods · types · errors 1 · 1 · 2

Methods

Ask

Interactively ask the user for a password, or answer from a previously cached entry

func (c *Client) Ask(ctx context.Context, in AskIn) (*AskOut, error)

Parameters

Field Type Description
message ?string The message to show when prompting for the password
keyname ?string The name for the kernel keyring entry used for caching
icon ?string The icon name to display, following the freedesktop.org icon naming specification
id ?string An recognizable id for the password prompt
timeoutUSec ?int Timeout in µs (relative, CLOCK_MONOTONIC; set to zero to only check cache and not query interactively; set to UINT64_MAX to disable relative timeout; if not set defaults to 90s)
untilUSec ?int Timeout in µs (absolute, CLOCK_MONOTONIC; if both timeoutUSec and untilUSec are specified the earlier of the two is used; set to zero to only check cache and not query interactively; leave unset or set to UINT64_MAX to disable absolute timeout)
acceptCached ?bool Whether to accept cached passwords from the kernel keyring
pushCache ?bool Whether to push acquired passwords into the kernel keyring
echo ?EchoMode Whether to give visual feedback when typing in the password
allowInteractiveAuthentication ?bool Controls whether interactive authentication (via polkit) shall be allowed. If unspecified defaults to false.

Reply

Field Type Description
passwords []string List of acquired passwords. This typically contains one entry, but might contain more in case multiple passwords were previously cached.

Types

EchoMode

Encodes whether to provide visual feedback as the password is typed in

Value Description
off Request that the password is prompted for without any visual feedback
on Show the password in plaintext as it is typed in
masked Provide visual feedback as the password is typed, but mask the password plaintext

Errors

Error Go type Description
NoPasswordAvailable NoPasswordAvailableError No password available, because none was provided in the cache, and no agent was asked
TimeoutReached TimeoutReachedError Query timeout reached, user did not provide a password in time