accessor

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2023 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithAttribute

func WithAttribute(name, value string) option

WithAttribute adds an attribute to the schema representing the cache. Storage supports up to 2 attributes.

func WithLabel

func WithLabel(label string) option

WithLabel sets a label on the schema representing the cache. The default label is "MSALCache".

Types

type Accessor

type Accessor interface {
	Delete(context.Context) error
	Read(context.Context) ([]byte, error)
	Write(context.Context, []byte) error
}

Accessor accesses data storage.

type Storage

type Storage struct {
	// contains filtered or unexported fields
}

Storage uses libsecret to store data with a DBus Secret Service such as GNOME Keyring or KDE Wallet. The Service must be unlocked before Storage can access it. Unlocking typically requires user interaction, and some systems may be unable to unlock the Service in a headless environment such as an SSH session.

func New

func New(name string, opts ...option) (*Storage, error)

New is the constructor for Storage. "name" is the name of the secret schema.

func (*Storage) Delete

func (s *Storage) Delete(context.Context) error

Delete deletes the stored data, if any exists.

func (*Storage) Read

func (s *Storage) Read(context.Context) ([]byte, error)

Read returns data stored according to the secret schema or, if no such data exists, a nil slice and nil error.

func (*Storage) Write

func (s *Storage) Write(_ context.Context, data []byte) error

Write stores cache data.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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