fix: shared renamed to pkg, formatting changes
This commit is contained in:
16
pkg/plugin/definition/publisher.go
Normal file
16
pkg/plugin/definition/publisher.go
Normal file
@@ -0,0 +1,16 @@
|
||||
package definition
|
||||
|
||||
import "context"
|
||||
|
||||
// Publisher defines the general publisher interface for messaging plugins.
|
||||
type Publisher interface {
|
||||
// Publish sends a message (as a byte slice) using the underlying messaging system.
|
||||
Publish(ctx context.Context, msg []byte) error
|
||||
|
||||
Close() error // Important for releasing resources.
|
||||
}
|
||||
|
||||
type PublisherProvider interface {
|
||||
// New initializes a new publisher instance with the given configuration.
|
||||
New(ctx context.Context, config map[string]string) (Publisher, error)
|
||||
}
|
||||
22
pkg/plugin/definition/signVerifier.go
Normal file
22
pkg/plugin/definition/signVerifier.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package definition
|
||||
|
||||
import "context"
|
||||
|
||||
// Verifier defines the method for verifying signatures.
|
||||
type Verifier interface {
|
||||
// Verify checks the validity of the signature for the given body.
|
||||
Verify(ctx context.Context, body []byte, header []byte, publicKeyBase64 string) (bool, error)
|
||||
Close() error // Close for releasing resources
|
||||
}
|
||||
|
||||
// VerifierProvider initializes a new Verifier instance with the given config.
|
||||
type VerifierProvider interface {
|
||||
// New creates a new Verifier instance based on the provided config.
|
||||
New(ctx context.Context, config map[string]string) (Verifier, func() error, error)
|
||||
}
|
||||
|
||||
// PublicKeyManager is the interface for key management plugin.
|
||||
type PublicKeyManager interface {
|
||||
// PublicKey retrieves the public key for the given subscriberID and keyID.
|
||||
PublicKey(ctx context.Context, subscriberID string, keyID string) (string, error)
|
||||
}
|
||||
24
pkg/plugin/definition/signer.go
Normal file
24
pkg/plugin/definition/signer.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package definition
|
||||
|
||||
import "context"
|
||||
|
||||
// Signer defines the method for signing.
|
||||
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)
|
||||
Close() error // Close for releasing resources
|
||||
}
|
||||
|
||||
// SignerProvider initializes a new signer instance with the given config.
|
||||
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)
|
||||
}
|
||||
|
||||
// PrivateKeyManager is the interface for key management plugin.
|
||||
type PrivateKeyManager interface {
|
||||
// PrivateKey retrieves the private key for the given subscriberID and keyID.
|
||||
PrivateKey(ctx context.Context, subscriberID string, keyID string) (string, error)
|
||||
}
|
||||
Reference in New Issue
Block a user