callbacks service draft

This commit is contained in:
Stephan D
2026-02-28 10:10:26 +01:00
parent b7900d3beb
commit 0f28f2d088
71 changed files with 5212 additions and 446 deletions

View File

@@ -0,0 +1,54 @@
package managedkey
import (
"context"
"math/big"
"github.com/ethereum/go-ethereum/core/types"
"github.com/tech/sendico/pkg/mlogger"
)
// Config describes how to connect to Vault for managed wallet keys.
type Config struct {
Address string `mapstructure:"address" yaml:"address"`
TokenEnv string `mapstructure:"token_env" yaml:"token_env"`
Namespace string `mapstructure:"namespace" yaml:"namespace"`
MountPath string `mapstructure:"mount_path" yaml:"mount_path"`
KeyPrefix string `mapstructure:"key_prefix" yaml:"key_prefix"`
}
// ManagedWalletKey captures metadata returned after key provisioning.
type ManagedWalletKey struct {
KeyID string
Address string
PublicKey string
}
// Material contains key material loaded from Vault.
type Material struct {
PrivateKey string
PublicKey string
Address string
Network string
}
// Service defines managed key operations shared by gateways.
type Service interface {
CreateManagedWalletKey(ctx context.Context, walletRef, network string) (*ManagedWalletKey, error)
SignEVMTransaction(ctx context.Context, keyID string, tx *types.Transaction, chainID *big.Int) (*types.Transaction, error)
LoadKeyMaterial(ctx context.Context, keyID string) (*Material, error)
BuildKeyID(network, walletRef string) string
}
// Options configure managed key service creation.
type Options struct {
Logger mlogger.Logger
Config Config
Component string
DefaultKeyPrefix string
}
// New creates a managed wallet key service backed by Vault KV.
func New(opts Options) (Service, error) {
return newService(opts)
}