Documentation
¶
Index ¶
- func AtomicWriteFile(path string, data []byte, perm os.FileMode) error
- func ClientTLSConfig() (*tls.Config, error)
- func ConfigDir() (string, error)
- func Contains[T comparable](slice []T, item T) bool
- func DataDir() (string, error)
- func EnsureSecureToken() (string, error)
- func EnsureToken(path string) (string, error)
- func Filter[T any](slice []T, predicate func(T) bool) []T
- func FindFirst[T any](slice []T, predicate func(T) bool) (T, bool)
- func FormatDuration(d time.Duration) string
- func GroupBy[T any, K comparable](slice []T, keyFn func(T) K) map[K][]T
- func HomeDir() string
- func Map[T any, R any](slice []T, fn func(T) R) []R
- func ParseDuration(s string) (time.Duration, error)
- func RuntimeDir() (string, error)
- func SocketPath() (string, error)
- func StateDir() (string, error)
- func TLSConfig() (*tls.Config, error)
- func TokenPath() (string, error)
- func ValidateDuration(s string) error
- type SecureTokenManager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AtomicWriteFile ¶
AtomicWriteFile writes data to a file atomically using temp file + rename
func ClientTLSConfig ¶
ClientTLSConfig returns TLS config for client connections
func Contains ¶
func Contains[T comparable](slice []T, item T) bool
Contains checks if a slice contains a specific element
func EnsureSecureToken ¶
EnsureSecureToken ensures a token exists using secure storage
func EnsureToken ¶
func FindFirst ¶
FindFirst returns the first element matching the predicate, or zero value if none found
func FormatDuration ¶
FormatDuration formats a duration with appropriate units
func GroupBy ¶
func GroupBy[T any, K comparable](slice []T, keyFn func(T) K) map[K][]T
GroupBy groups slice elements by the result of the key function
func ParseDuration ¶
ParseDuration parses a duration string with support for days, weeks, months, years Supports: 1h, 30m, 45s, 2d, 1w, 3M, 1y, or combinations like "1d12h30m"
func RuntimeDir ¶
RuntimeDir returns the XDG-compliant runtime directory for op-authd
func SocketPath ¶
func ValidateDuration ¶
ValidateDuration checks if a duration string is valid
Types ¶
type SecureTokenManager ¶
type SecureTokenManager struct {
// contains filtered or unexported fields
}
SecureTokenManager handles token storage using OS keyring with file fallback
func NewSecureTokenManager ¶
func NewSecureTokenManager() (*SecureTokenManager, error)
NewSecureTokenManager creates a new secure token manager
func (*SecureTokenManager) DeleteToken ¶
func (stm *SecureTokenManager) DeleteToken() error
DeleteToken removes the token from both keyring and file
func (*SecureTokenManager) GetStorageLocation ¶
func (stm *SecureTokenManager) GetStorageLocation() string
GetStorageLocation returns information about where the token is stored
func (*SecureTokenManager) IsKeyringsSupported ¶
func (stm *SecureTokenManager) IsKeyringsSupported() bool
IsKeyringsSupported checks if OS keyring is available
func (*SecureTokenManager) RetrieveToken ¶
func (stm *SecureTokenManager) RetrieveToken() (string, error)
RetrieveToken retrieves the token from OS keyring with file fallback
func (*SecureTokenManager) StoreToken ¶
func (stm *SecureTokenManager) StoreToken(token string) error
StoreToken stores the token in OS keyring with file fallback