Documentation ¶
Overview ¶
Package keyring provides totp secret storage using keyring.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option interface { TOTPSecretProviderOption }
Option configures the services provided by the keyring package.
func WithLogger ¶
WithLogger sets the logger for the keyring package.
type TOTPSecretProvider ¶ added in v0.5.0
type TOTPSecretProvider struct {
// contains filtered or unexported fields
}
TOTPSecretProvider is a TOTP secret getter and setter that uses the keyring to store the TOTP secret.
func TOTPSecretFromKeyring ¶
func TOTPSecretFromKeyring(account string, opts ...TOTPSecretProviderOption) *TOTPSecretProvider
TOTPSecretFromKeyring returns a TOTP secret getter and setter that uses the keyring to store the TOTP secret.
func (*TOTPSecretProvider) DeleteTOTPSecret ¶ added in v0.5.0
func (s *TOTPSecretProvider) DeleteTOTPSecret(ctx context.Context) error
DeleteTOTPSecret deletes the TOTP secret in the keyring.
func (*TOTPSecretProvider) SetTOTPSecret ¶ added in v0.5.0
func (s *TOTPSecretProvider) SetTOTPSecret(ctx context.Context, secret otp.TOTPSecret, _ string) error
SetTOTPSecret persists the TOTP secret to the keyring.
func (*TOTPSecretProvider) TOTPSecret ¶ added in v0.5.0
func (s *TOTPSecretProvider) TOTPSecret(ctx context.Context) otp.TOTPSecret
TOTPSecret returns the TOTP secret from the keyring.
type TOTPSecretProviderOption ¶ added in v0.5.0
type TOTPSecretProviderOption interface {
// contains filtered or unexported methods
}
TOTPSecretProviderOption is an option to configure TOTPSecretProvider.
func WithStorage ¶
func WithStorage(storage secretstorage.Storage[otp.TOTPSecret]) TOTPSecretProviderOption
WithStorage sets the storage for the TOTP secret getter and setter.