Documentation
¶
Overview ¶
Package local provides a keystore based on a local directory.
Index ¶
- Constants
- func DefaultAPIKeysDir() string
- func DefaultEncryptionKeysDir() string
- func DeprecatedDefaultAPIKeysDir() string
- type Store
- func (s *Store[T, M]) Load(name string) (T, error)
- func (s *Store[T, M]) MetadataFile(name string) string
- func (s *Store[T, M]) PrivateKeyFile(name string) string
- func (s *Store[T, M]) PublicKeyFile(name string) string
- func (s *Store[T, M]) SetAPIKeysDirectory(keysPath string) (err error)
- func (s *Store[T, M]) SetEncryptionKeysDirectory(keysPath string) (err error)
- func (s *Store[T, M]) Store(name string, keypair common.IKey[M]) error
Constants ¶
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 ¶
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]) MetadataFile ¶
MetadataFile returns the filename for the metadata of the given key name.
func (*Store[T, M]) PrivateKeyFile ¶
PrivateKeyFile returns the filename for the private key of the given name.
func (*Store[T, M]) PublicKeyFile ¶
PublicKeyFile returns the filename for the public key of the given name.
func (*Store[T, M]) SetAPIKeysDirectory ¶
SetAPIKeysDirectory sets the clifs root directory, ensuring its existence and writability.
func (*Store[T, M]) SetEncryptionKeysDirectory ¶
SetEncryptionKeysDirectory sets the clifs root directory, ensuring its existence and writability.