Versions in this module Expand all Collapse all v1 v1.23.4 Jan 27, 2026 v1.23.3 Jan 27, 2026 v1.23.2 Jan 26, 2026 Changes in this version + var ErrInvalidKey = fmt.Errorf("invalid key") + var ErrKeyNotFound = fmt.Errorf("key not found") + func DecodeBase64(s string) ([]byte, error) + func EncodeBase64(data []byte) string + func GetJSON[T any](ctx context.Context, store StorageBackend, key string) (*T, error) + func SetJSON(ctx context.Context, store StorageBackend, key string, value any) error + type BadgerConfig struct + Compression bool + Dir string + EncryptionKey []byte + InMemory bool + SyncWrites bool + type BadgerStore struct + func NewBadgerStore(cfg *BadgerConfig) (*BadgerStore, error) + func (s *BadgerStore) BeginTx(ctx context.Context) (Transaction, error) + func (s *BadgerStore) Close() error + func (s *BadgerStore) Delete(ctx context.Context, key string) error + func (s *BadgerStore) Exists(ctx context.Context, key string) (bool, error) + func (s *BadgerStore) Get(ctx context.Context, key string) ([]byte, error) + func (s *BadgerStore) List(ctx context.Context, prefix string) ([]string, error) + func (s *BadgerStore) Scan(ctx context.Context, prefix string, fn func(key string, value []byte) error) error + func (s *BadgerStore) Set(ctx context.Context, key string, value []byte) error + func (s *BadgerStore) SetWithTTL(ctx context.Context, key string, value []byte, ttl time.Duration) error + type Config struct + Compression bool + DataDir string + InMemory bool + RootKey []byte + Store StorageBackend + type EncryptedData struct + Data []byte + KeyID string + KeyVersion int + type KMS struct + func New(cfg *Config) (*KMS, error) + func (k *KMS) Close() error + func (k *KMS) CreateSecret(ctx context.Context, name string, value []byte, opts *SecretOptions) (*Secret, error) + func (k *KMS) Decrypt(ctx context.Context, ciphertext []byte) ([]byte, error) + func (k *KMS) DeleteKey(ctx context.Context, keyID string) error + func (k *KMS) DeleteSecret(ctx context.Context, secretID string) error + func (k *KMS) Encrypt(ctx context.Context, keyID string, plaintext []byte) ([]byte, error) + func (k *KMS) GenerateKey(ctx context.Context, name string, keyType KeyType, usage KeyUsage, ...) (*Key, error) + func (k *KMS) GetKey(ctx context.Context, keyID string) (*Key, error) + func (k *KMS) GetKeyByName(ctx context.Context, name string) (*Key, error) + func (k *KMS) GetPublicKey(ctx context.Context, keyID string) ([]byte, error) + func (k *KMS) GetSecret(ctx context.Context, secretID string) (*Secret, error) + func (k *KMS) GetSecretValue(ctx context.Context, secretID string) ([]byte, error) + func (k *KMS) ListKeys(ctx context.Context, prefix string) ([]*Key, error) + func (k *KMS) ListSecrets(ctx context.Context, env, path string) ([]*Secret, error) + func (k *KMS) Sign(ctx context.Context, keyID string, data []byte) ([]byte, error) + func (k *KMS) UpdateSecret(ctx context.Context, secretID string, newValue []byte) (*Secret, error) + func (k *KMS) Verify(ctx context.Context, keyID string, data, signature []byte) (bool, error) + type Key struct + Created time.Time + Description string + ExpiresAt *time.Time + ID string + Metadata map[string]string + Name string + OrgID string + ProjectID string + ShareHolders []string + Status KeyStatus + Threshold int + TotalShares int + Type KeyType + Updated time.Time + Usage KeyUsage + Version int + type KeyMaterial struct + Created time.Time + EncryptedKey []byte + EncryptedPrivate []byte + KeyID string + Nonce []byte + PublicKey []byte + Version int + type KeyOptions struct + Description string + ExpiresIn time.Duration + Metadata map[string]string + OrgID string + ProjectID string + type KeyStatus string + const KeyStatusActive + const KeyStatusDeleted + const KeyStatusInactive + const KeyStatusPending + type KeyType string + const KeyTypeAES256 + const KeyTypeECDSAP256 + const KeyTypeECDSAP384 + const KeyTypeEdDSA + const KeyTypeRSA3072 + const KeyTypeRSA4096 + type KeyUsage string + const KeyUsageEncryptDecrypt + const KeyUsageMPC + const KeyUsageSignVerify + type KmsKey struct + Description string + EncryptionAlgorithm string + ID string + IsDisabled bool + KeyUsage string + Name string + OrgID string + ProjectID string + Version int + type MPCChain string + const MPCChainArbitrum + const MPCChainAvalanche + const MPCChainBNB + const MPCChainBase + const MPCChainBitcoin + const MPCChainEthereum + const MPCChainLux + const MPCChainOptimism + const MPCChainPolygon + const MPCChainSolana + type MPCKeyType string + const MPCKeyTypeECDSA + const MPCKeyTypeEdDSA + const MPCKeyTypeTaproot + type MPCManager struct + func NewMPCManager(kms *KMS) *MPCManager + func (m *MPCManager) CreateSigningRequest(ctx context.Context, walletID string, chain MPCChain, rawTransaction []byte, ...) (*MPCSigningRequest, error) + func (m *MPCManager) CreateWallet(ctx context.Context, name string, keyType MPCKeyType, ...) (*MPCWallet, error) + func (m *MPCManager) GetKeyShare(ctx context.Context, walletID, nodeID string) ([]byte, error) + func (m *MPCManager) GetNode(ctx context.Context, nodeID string) (*MPCNode, error) + func (m *MPCManager) GetSigningRequest(ctx context.Context, requestID string) (*MPCSigningRequest, error) + func (m *MPCManager) GetWallet(ctx context.Context, walletID string) (*MPCWallet, error) + func (m *MPCManager) ListNodes(ctx context.Context) ([]*MPCNode, error) + func (m *MPCManager) ListPendingSigningRequests(ctx context.Context, walletID string) ([]*MPCSigningRequest, error) + func (m *MPCManager) ListWallets(ctx context.Context) ([]*MPCWallet, error) + func (m *MPCManager) RegisterNode(ctx context.Context, name, endpoint string, port int, publicKey []byte, ...) (*MPCNode, error) + func (m *MPCManager) SetFinalSignature(ctx context.Context, requestID string, finalSig []byte) error + func (m *MPCManager) SetWalletPublicKey(ctx context.Context, walletID string, publicKey []byte, ...) error + func (m *MPCManager) StoreKeyShare(ctx context.Context, walletID, nodeID string, encryptedShare []byte) error + func (m *MPCManager) SubmitPartialSignature(ctx context.Context, requestID, nodeID string, partialSig []byte) (*MPCSigningRequest, error) + func (m *MPCManager) UpdateNodeStatus(ctx context.Context, nodeID, status string) error + type MPCNode struct + Created time.Time + Endpoint string + ID string + LastSeen time.Time + Metadata map[string]string + Name string + OrgID string + Port int + PublicKey []byte + Status string + type MPCSigningRequest struct + Chain MPCChain + CollectedSigs int + Created time.Time + ExpiresAt time.Time + FinalSignature []byte + ID string + Message []byte + Metadata map[string]string + RawTransaction []byte + RequiredSigs int + Signatures map[string][]byte + Status SigningStatus + WalletID string + type MPCWallet struct + ChainAddresses map[MPCChain]string + Created time.Time + ID string + KeyType MPCKeyType + Metadata map[string]string + Name string + OrgID string + ParticipantIDs []string + ProjectID string + PublicKey []byte + Status KeyStatus + Threshold int + TotalParties int + Updated time.Time + type NodeOptions struct + Metadata map[string]string + OrgID string + type Secret struct + Created time.Time + Environment string + ID string + KeyID string + Metadata map[string]string + Name string + Nonce []byte + OrgID string + Path string + ProjectID string + Tags []string + Updated time.Time + Value []byte + Version int + type SecretOptions struct + Environment string + KeyID string + Metadata map[string]string + OrgID string + Path string + ProjectID string + Tags []string + type SecretResponse struct + Environment string + ID string + SecretKey string + SecretPath string + SecretValue string + Type string + Version int + type Server struct + func NewServer(kms *KMS, cfg *ServerConfig) *Server + func (s *Server) Start() error + func (s *Server) Stop(ctx context.Context) error + type ServerConfig struct + APIKey string + Addr string + CORSOrigins []string + EnableMPC bool + EnableSecrets bool + MaxHeaderBytes int + ReadTimeout time.Duration + WriteTimeout time.Duration + func DefaultServerConfig() *ServerConfig + type SigningOptions struct + ExpiresIn time.Duration + Message []byte + Metadata map[string]string + type SigningStatus string + const SigningStatusCollecting + const SigningStatusComplete + const SigningStatusExpired + const SigningStatusFailed + const SigningStatusPending + type StorageBackend interface + BeginTx func(ctx context.Context) (Transaction, error) + Close func() error + Delete func(ctx context.Context, key string) error + Exists func(ctx context.Context, key string) (bool, error) + Get func(ctx context.Context, key string) ([]byte, error) + List func(ctx context.Context, prefix string) ([]string, error) + Scan func(ctx context.Context, prefix string, fn func(key string, value []byte) error) error + Set func(ctx context.Context, key string, value []byte) error + SetWithTTL func(ctx context.Context, key string, value []byte, ttl time.Duration) error + type Transaction interface + Commit func() error + Delete func(key string) error + Get func(key string) ([]byte, error) + Rollback func() error + Set func(key string, value []byte) error + type WalletOptions struct + Metadata map[string]string + OrgID string + ProjectID string