Documentation
¶
Index ¶
- Variables
- func GetVaultClient(ctx context.Context, vaultAddr string) (*vault.Client, error)
- func ValidateCfg(cfg *Config) error
- type Config
- type KeyMgr
- func (km *KeyMgr) DeleteKeyset(ctx context.Context, keyID string) error
- func (km *KeyMgr) GenerateKeyset() (*model.Keyset, error)
- func (km *KeyMgr) InsertKeyset(ctx context.Context, keyID string, keys *model.Keyset) error
- func (km *KeyMgr) Keyset(ctx context.Context, keyID string) (*model.Keyset, error)
- func (km *KeyMgr) LookupNPKeys(ctx context.Context, subscriberID, uniqueKeyID string) (string, string, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrEmptyKeyID indicates that the provided key ID is empty. ErrEmptyKeyID = errors.New("invalid request: keyID cannot be empty") // ErrNilKeySet indicates that the provided keyset is nil. ErrNilKeySet = errors.New("keyset cannot be nil") // ErrEmptySubscriberID indicates that the provided subscriber ID is empty. ErrEmptySubscriberID = errors.New("invalid request: subscriberID cannot be empty") // ErrEmptyUniqueKeyID indicates that the provided unique key ID is empty. ErrEmptyUniqueKeyID = errors.New("invalid request: uniqueKeyID cannot be empty") // ErrSubscriberNotFound indicates that no subscriber was found with the provided credentials. ErrSubscriberNotFound = errors.New("no subscriber found with given credentials") // ErrNilCache indicates that the cache implementation is nil. ErrNilCache = errors.New("cache implementation cannot be nil") // ErrNilRegistryLookup indicates that the registry lookup implementation is nil. ErrNilRegistryLookup = errors.New("registry lookup implementation cannot be nil") )
View Source
var NewVaultClient = vault.NewClient
NewVaultClient creates a new Vault client instance. This function is exported for testing purposes.
Functions ¶
func GetVaultClient ¶
GetVaultClient creates and authenticates a Vault client using AppRole.
func ValidateCfg ¶
ValidateCfg validates the Vault configuration and sets default KV version if missing.
Types ¶
type KeyMgr ¶
type KeyMgr struct { VaultClient *vault.Client Registry definition.RegistryLookup Cache definition.Cache KvVersion string SecretPath string }
KeyMgr provides methods for managing cryptographic keys using Vault.
func New ¶
func New(ctx context.Context, cache definition.Cache, registryLookup definition.RegistryLookup, cfg *Config) (*KeyMgr, func() error, error)
New creates a new KeyMgr instance with the provided configuration, cache, and registry lookup.
func (*KeyMgr) DeleteKeyset ¶
DeleteKeyset deletes the private keys for the given key ID from Vault.
func (*KeyMgr) GenerateKeyset ¶
GenerateKeyset generates a new signing (Ed25519) and encryption (X25519) key pair.
func (*KeyMgr) InsertKeyset ¶
InsertKeyset stores the given keyset in Vault under the specified key ID.
Click to show internal directories.
Click to hide internal directories.