Documentation
¶
Index ¶
- type Cache
- type CacheProvider
- type Decrypter
- type DecrypterProvider
- type Encrypter
- type EncrypterProvider
- type KeyManager
- type KeyManagerProvider
- type MiddlewareProvider
- type OtelSetupMetricsProvider
- type Publisher
- type PublisherProvider
- type RegistryLookup
- type RegistryLookupProvider
- type Router
- type RouterProvider
- type SchemaValidator
- type SchemaValidatorProvider
- type SignValidator
- type SignValidatorProvider
- type Signer
- type SignerProvider
- type Step
- type StepProvider
- type TransportWrapper
- type TransportWrapperProvider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache interface {
// Get retrieves a value from the cache based on the given key.
Get(ctx context.Context, key string) (string, error)
// Set stores a value in the cache with the given key and TTL (time-to-live) in seconds.
Set(ctx context.Context, key, value string, ttl time.Duration) error
// Delete removes a value from the cache based on the given key.
Delete(ctx context.Context, key string) error
// Clear removes all values from the cache.
Clear(ctx context.Context) error
}
Cache defines the general cache interface for caching plugins.
type CacheProvider ¶
type CacheProvider interface {
// New initializes a new cache instance with the given configuration.
New(ctx context.Context, config map[string]string) (Cache, func() error, error)
}
CacheProvider interface defines the contract for managing cache instances.
type Decrypter ¶
type Decrypter interface {
// Decrypt decrypts the given body using the provided privateKeyBase64 and publicKeyBase64.
Decrypt(ctx context.Context, encryptedData string, privateKeyBase64, publicKeyBase64 string) (string, error)
}
Decrypter defines the methods for decryption.
type DecrypterProvider ¶
type DecrypterProvider interface {
// New creates a new decrypter instance based on the provided config.
New(ctx context.Context, config map[string]string) (Decrypter, func() error, error)
}
DecrypterProvider initializes a new decrypter instance with the given config.
type Encrypter ¶
type Encrypter interface {
// Encrypt encrypts the given body using the provided privateKeyBase64 and publicKeyBase64.
Encrypt(ctx context.Context, data string, privateKeyBase64, publicKeyBase64 string) (string, error)
}
Encrypter defines the methods for encryption.
type EncrypterProvider ¶
type EncrypterProvider interface {
// New creates a new encrypter instance based on the provided config.
New(ctx context.Context, config map[string]string) (Encrypter, func() error, error)
}
EncrypterProvider initializes a new encrypter instance with the given config.
type KeyManager ¶
type KeyManager interface {
GenerateKeyset() (*model.Keyset, error)
InsertKeyset(ctx context.Context, keyID string, keyset *model.Keyset) error
Keyset(ctx context.Context, keyID string) (*model.Keyset, error)
LookupNPKeys(ctx context.Context, subscriberID, uniqueKeyID string) (signingPublicKey string, encrPublicKey string, err error)
DeleteKeyset(ctx context.Context, keyID string) error
}
KeyManager defines the interface for key management operations/methods.
type KeyManagerProvider ¶
type KeyManagerProvider interface {
New(context.Context, Cache, RegistryLookup, map[string]string) (KeyManager, func() error, error)
}
KeyManagerProvider initializes a new signer instance.
type MiddlewareProvider ¶
type OtelSetupMetricsProvider ¶ added in v1.3.0
type OtelSetupMetricsProvider interface {
// New initializes a new telemetry provider instance with the given configuration.
New(ctx context.Context, config map[string]string) (*telemetry.Provider, func() error, error)
}
OtelSetupMetricsProvider encapsulates initialization of OpenTelemetry metrics providers. Implementations wire exporters and return a Provider that the core application can manage.
type Publisher ¶
type Publisher interface {
// Publish sends a message (as a byte slice) using the underlying messaging system.
Publish(context.Context, string, []byte) error
}
Publisher defines the general publisher interface for messaging plugins.
type PublisherProvider ¶
type PublisherProvider interface {
// New initializes a new publisher instance with the given configuration.
New(ctx context.Context, config map[string]string) (Publisher, func() error, error)
}
PublisherProvider is the interface for creating new Publisher instances.
type RegistryLookup ¶
type RegistryLookup interface {
// looks up Registry entry to obtain public keys to validate signature of the incoming message
Lookup(ctx context.Context, req *model.Subscription) ([]model.Subscription, error)
}
type RegistryLookupProvider ¶
type RegistryLookupProvider interface {
New(context.Context, map[string]string) (RegistryLookup, func() error, error)
}
RegistryLookupProvider initializes a new registry lookup instance.
type Router ¶
type Router interface {
// Route determines the routing destination based on the request context.
Route(ctx context.Context, url *url.URL, body []byte) (*model.Route, error)
}
Router defines the interface for routing requests.
type RouterProvider ¶
type RouterProvider interface {
New(ctx context.Context, config map[string]string) (Router, func() error, error)
}
RouterProvider initializes the a new Router instance with the given config.
type SchemaValidator ¶
type SchemaValidator interface {
Validate(ctx context.Context, url *url.URL, payload []byte) error
}
SchemaValidator interface for schema validation.
type SchemaValidatorProvider ¶
type SchemaValidatorProvider interface {
New(ctx context.Context, config map[string]string) (SchemaValidator, func() error, error)
}
SchemaValidatorProvider interface for creating validators.
type SignValidator ¶
type SignValidator interface {
// Validate checks the validity of the signature for the given body.
Validate(ctx context.Context, body []byte, header string, publicKeyBase64 string) error
}
SignValidator defines the method for verifying signatures.
type SignValidatorProvider ¶
type SignValidatorProvider interface {
// New creates a new Verifier instance based on the provided config.
New(ctx context.Context, config map[string]string) (SignValidator, func() error, error)
}
SignValidatorProvider initializes a new Verifier instance with the given config.
type Signer ¶
type Signer interface {
// Sign generates a signature for the given body and privateKeyBase64.
// The signature is created with the given timestamps: createdAt (signature creation time)
// and expiresAt (signature expiration time).
Sign(ctx context.Context, body []byte, privateKeyBase64 string, createdAt, expiresAt int64) (string, error)
}
Signer defines the method for signing.
type SignerProvider ¶
type SignerProvider interface {
// New creates a new signer instance based on the provided config.
New(ctx context.Context, config map[string]string) (Signer, func() error, error)
}
SignerProvider initializes a new signer instance with the given config.
type Step ¶
type Step interface {
Run(ctx *model.StepContext) error
}
type StepProvider ¶
type TransportWrapper ¶ added in v1.3.0
type TransportWrapper interface {
// Wrap takes a base transport and returns a new transport that wraps it.
Wrap(base http.RoundTripper) http.RoundTripper
}
TransportWrapper is a plugin that wraps an http.RoundTripper, allowing modification of outbound requests (like adding auth).
type TransportWrapperProvider ¶ added in v1.3.0
type TransportWrapperProvider interface {
New(ctx context.Context, config map[string]any) (TransportWrapper, func(), error)
}
TransportWrapperProvider defines the factory for a TransportWrapper.