Documentation
¶
Index ¶
- Variables
- func ValidateCfg(cfg *Config) error
- type Config
- type SimpleKeyMgr
- func (skm *SimpleKeyMgr) DeleteKeyset(ctx context.Context, keyID string) error
- func (skm *SimpleKeyMgr) GenerateKeyset() (*model.Keyset, error)
- func (skm *SimpleKeyMgr) InsertKeyset(ctx context.Context, keyID string, keys *model.Keyset) error
- func (skm *SimpleKeyMgr) Keyset(ctx context.Context, keyID string) (*model.Keyset, error)
- func (skm *SimpleKeyMgr) LookupNPKeys(ctx context.Context, subscriberID, uniqueKeyID string) (string, string, error)
Constants ¶
This section is empty.
Variables ¶
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") // ErrNilRegistryLookup indicates that the registry lookup implementation is nil. ErrNilRegistryLookup = errors.New("registry lookup implementation cannot be nil") // ErrKeysetNotFound indicates that the requested keyset was not found. ErrKeysetNotFound = errors.New("keyset not found") // ErrInvalidConfig indicates that the configuration is invalid. ErrInvalidConfig = errors.New("invalid configuration") // ErrKeyExpiredOrRevoked indicates that the matched subscriber's key exists but // is no longer usable (registry status EXPIRED, UNSUBSCRIBED, or INVALID_SSL). ErrKeyExpiredOrRevoked = errors.New("subscriber key is expired or revoked") )
Functions ¶
func ValidateCfg ¶
ValidateCfg validates the SimpleKeyManager configuration.
Types ¶
type Config ¶
type Config struct {
SubscriberID string `yaml:"subscriberId" json:"subscriberId"`
KeyID string `yaml:"keyId" json:"keyId"`
SigningPrivateKey string `yaml:"signingPrivateKey" json:"signingPrivateKey"`
SigningPublicKey string `yaml:"signingPublicKey" json:"signingPublicKey"`
EncrPrivateKey string `yaml:"encrPrivateKey" json:"encrPrivateKey"`
EncrPublicKey string `yaml:"encrPublicKey" json:"encrPublicKey"`
}
Config holds configuration parameters for SimpleKeyManager.
type SimpleKeyMgr ¶
type SimpleKeyMgr struct {
Registry definition.RegistryLookup
// contains filtered or unexported fields
}
SimpleKeyMgr provides methods for managing cryptographic keys using configuration.
func New ¶
func New(ctx context.Context, registryLookup definition.RegistryLookup, cfg *Config) (*SimpleKeyMgr, func() error, error)
New creates a new SimpleKeyMgr instance with the provided registry lookup and configuration.
func (*SimpleKeyMgr) DeleteKeyset ¶
func (skm *SimpleKeyMgr) DeleteKeyset(ctx context.Context, keyID string) error
DeleteKeyset deletes the keyset for the given key ID from memory.
func (*SimpleKeyMgr) GenerateKeyset ¶
func (skm *SimpleKeyMgr) GenerateKeyset() (*model.Keyset, error)
GenerateKeyset generates a new signing (Ed25519) and encryption (X25519) key pair.
func (*SimpleKeyMgr) InsertKeyset ¶
InsertKeyset stores the given keyset in memory under the specified key ID.
func (*SimpleKeyMgr) LookupNPKeys ¶
func (skm *SimpleKeyMgr) LookupNPKeys(ctx context.Context, subscriberID, uniqueKeyID string) (string, string, error)
LookupNPKeys retrieves the signing and encryption public keys for the given subscriber ID and unique key ID.
A zero-result lookup and a matched-but-unusable-status subscriber are both AUT_* authentication failures, so both are returned already classified as *model.SignValidationErr — the caller (signvalidator's validateSignStep) propagates this as-is; it does not need to know keymanager's own sentinel errors to build the correct NACK code.