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 ¶
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") // 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") )
Functions ¶
func ValidateCfg ¶
ValidateCfg validates the SimpleKeyManager configuration.
Types ¶
type Config ¶
type Config struct {
NetworkParticipant string `yaml:"networkParticipant" json:"networkParticipant"`
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
Cache definition.Cache
// contains filtered or unexported fields
}
SimpleKeyMgr provides methods for managing cryptographic keys using configuration.
func New ¶
func New(ctx context.Context, cache definition.Cache, registryLookup definition.RegistryLookup, cfg *Config) (*SimpleKeyMgr, func() error, error)
New creates a new SimpleKeyMgr instance with the provided configuration, cache, and registry lookup.
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.
Click to show internal directories.
Click to hide internal directories.