authtest

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package authtest has keyrings for tests, so that no test ever reaches the keyring of the machine it runs on. Clearing the environment isn't enough for that: the D-Bus library behind the Secret Service finds the session bus at /run/user/<uid>/bus whatever the environment says.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoSecretService = errors.New("The name org.freedesktop.secrets was not provided by any .service files")

ErrNoSecretService is what the Secret Service's absence looks like.

Functions

This section is empty.

Types

type FileKeyring

type FileKeyring struct {
	Path string
	Err  error
}

FileKeyring is a keyring in a JSON file, for tests that run the CLI as separate processes: what `auth login` stores, the next command finds.

func (FileKeyring) Delete

func (k FileKeyring) Delete(service, user string) error

func (FileKeyring) Get

func (k FileKeyring) Get(service, user string) (string, error)

func (FileKeyring) Set

func (k FileKeyring) Set(service, user, secret string) error

type Keyring

type Keyring struct {
	Err error
	// contains filtered or unexported fields
}

Keyring is a keyring in memory. With Err set, every call fails with it, as the real one does when no Secret Service is running.

func (*Keyring) Delete

func (k *Keyring) Delete(service, user string) error

func (*Keyring) Get

func (k *Keyring) Get(service, user string) (string, error)

func (*Keyring) Secret

func (k *Keyring) Secret(service, user string) (string, bool)

Secret returns what the keyring holds for service and user, for a test to check.

func (*Keyring) Set

func (k *Keyring) Set(service, user, secret string) error

Jump to

Keyboard shortcuts

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