local

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package local provides a keystore based on a local directory.

Index

Constants

View Source
const (
	// DefaultKeyName is the name of the default API key.
	DefaultKeyName = "default"
)

Variables

This section is empty.

Functions

func DefaultAPIKeysDir

func DefaultAPIKeysDir() string

DefaultAPIKeysDir returns the default directory for API key storage for the user's system.

func DefaultEncryptionKeysDir

func DefaultEncryptionKeysDir() string

DefaultEncryptionKeysDir returns the default directory for encryption key storage for the user's system.

func DeprecatedDefaultAPIKeysDir

func DeprecatedDefaultAPIKeysDir() string

DeprecatedDefaultAPIKeysDir checks the deprecated location of API keys on macOS; returns the full path if it exists on disk. `~/Library/Application Support/turnkey/keys/`.

Types

type Store

type Store[T common.IKey[M], M common.IMetadata] struct {
	// DefaultKeyName is the name of the key to use when none is specified.
	// Normally, this is simply "default".
	DefaultKeyName string

	// KeyDirectory is the directory in which all the keys and metadata are stored.
	// Normally, this will simply be the user/system default.
	KeyDirectory string
}

Store defines an api key Store using the local filesystem.

func New

func New[T common.IKey[M], M common.IMetadata]() *Store[T, M]

New provides a new local API key store. keyDirectory is optional, and if it is the empty string, the system default will be used.

func (*Store[T, M]) Load

func (s *Store[T, M]) Load(name string) (T, error)

Load implements store.Store.

func (*Store[T, M]) MetadataFile

func (s *Store[T, M]) MetadataFile(name string) string

MetadataFile returns the filename for the metadata of the given key name.

func (*Store[T, M]) PrivateKeyFile

func (s *Store[T, M]) PrivateKeyFile(name string) string

PrivateKeyFile returns the filename for the private key of the given name.

func (*Store[T, M]) PublicKeyFile

func (s *Store[T, M]) PublicKeyFile(name string) string

PublicKeyFile returns the filename for the public key of the given name.

func (*Store[T, M]) SetAPIKeysDirectory

func (s *Store[T, M]) SetAPIKeysDirectory(keysPath string) (err error)

SetAPIKeysDirectory sets the clifs root directory, ensuring its existence and writability.

func (*Store[T, M]) SetEncryptionKeysDirectory

func (s *Store[T, M]) SetEncryptionKeysDirectory(keysPath string) (err error)

SetEncryptionKeysDirectory sets the clifs root directory, ensuring its existence and writability.

func (*Store[T, M]) Store

func (s *Store[T, M]) Store(name string, keypair common.IKey[M]) error

Store implements store.Store.

Jump to

Keyboard shortcuts

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