tss

package
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 19, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AlgorithmECDSA = "ecdsa"
	AlgorithmEdDSA = "eddsa"

	CurveSecp256k1 = "secp256k1"
	CurveEd25519   = "ed25519"

	DerivationSchemeBIP32Secp256k1 = "bip32_secp256k1"
	DerivationSchemeBIP32Public    = "bip32_public"
	DerivationSchemeSLIP10Ed25519  = "slip10_ed25519"

	PublicKeyFormatUncompressedHex = "uncompressed_hex"
)
View Source
const (
	ShareStatusActive   = coreshares.StatusActive
	ShareStatusDisabled = coreshares.StatusDisabled
)

Variables

View Source
var (
	ErrDerivationContextRequired   = corederivation.ErrDerivationContextRequired
	ErrInvalidDerivationContext    = corederivation.ErrInvalidDerivationContext
	ErrUnsupportedDerivationScheme = corederivation.ErrUnsupportedDerivationScheme
	ErrDerivationPathInvalid       = corederivation.ErrDerivationPathInvalid
	ErrDerivationContextMismatch   = corederivation.ErrDerivationContextMismatch
	ErrChainCodeMissing            = corederivation.ErrChainCodeMissing
	ErrChainCodeInvalid            = corederivation.ErrChainCodeInvalid
	ErrDerivedSigningUnsupported   = corederivation.ErrDerivedSigningUnsupported
	ErrUnsupportedAlgorithmCurve   = corederivation.ErrUnsupportedAlgorithmCurve
)
View Source
var (
	ErrInvalidSessionDescriptor = errors.New("invalid session descriptor")
	ErrLocalPartyRequired       = errors.New("local party id is required")
	ErrTransportRequired        = errors.New("transport is required")
	ErrKeyIDRequired            = errors.New("key id is required")
	ErrDigestMissing            = errors.New("digest is required")
	ErrMissingDKGPublicKey      = errors.New("dkg result missing public key")
	ErrMissingDKGAddress        = errors.New("dkg result missing address")
)
View Source
var (
	ErrShareNotFound         = coreshares.ErrShareNotFound
	ErrShareDisabled         = coreshares.ErrShareDisabled
	ErrInvalidSharePayload   = coreshares.ErrInvalidSharePayload
	ErrVaultUnavailable      = coreshares.ErrVaultUnavailable
	ErrVaultPermissionDenied = coreshares.ErrVaultPermissionDenied
	ErrVaultWriteFailed      = coreshares.ErrVaultWriteFailed
	ErrVaultReadFailed       = coreshares.ErrVaultReadFailed
	ErrMetadataMismatch      = coreshares.ErrMetadataMismatch
	ErrUnsupportedVersion    = coreshares.ErrUnsupportedVersion
)
View Source
var ErrNilRunner = tssservice.ErrNilRunner

Functions

func DerivationContextHashV1 added in v0.2.2

func DerivationContextHashV1(in DerivationContext) (string, error)

func DeriveECDSAChildPublicKey added in v0.2.2

func DeriveECDSAChildPublicKey(accountPublicKey string, chainCode []byte, ctx DerivationContext) (string, error)

func MarshalKeyMaterial added in v0.2.2

func MarshalKeyMaterial(material ECDSAKeyMaterial) ([]byte, error)

Types

type DKGDerivationMaterial added in v0.2.2

type DKGDerivationMaterial struct {
	ChainCode        string
	DerivationScheme string
}

type DKGOutput added in v0.2.0

type DKGOutput = tssservice.DKGOutput

type DKGSessionDescriptor added in v0.2.2

type DKGSessionDescriptor struct {
	SessionID string
	OrgID     string
	KeyID     string
	Parties   []string
	Threshold uint32
	Algorithm string
	Curve     string
}

type DKGSessionRequest

type DKGSessionRequest struct {
	Session            DKGSessionDescriptor
	LocalPartyID       string
	DerivationMaterial *DKGDerivationMaterial
	Transport          Transport
}

func (DKGSessionRequest) Validate

func (r DKGSessionRequest) Validate() error

type DerivationContext added in v0.2.2

type DerivationContext struct {
	ProfileID         string
	ProfileTemplateID string
	Chain             string
	Algorithm         string
	Curve             string
	Scheme            string
	PublicKeyFormat   string
	AccountPath       string
	ChildPath         string
	FullPath          string
	AddressEncoding   string
	ExpectedAddress   string
	DerivedPublicKey  string
	Descriptor        string
	DescriptorVersion uint32
	ProfileVersion    uint32
	KeyVersion        uint32
}

func NormalizeDerivationContext added in v0.2.2

func NormalizeDerivationContext(in DerivationContext) (DerivationContext, error)

type ECDSAKeyMaterial added in v0.2.2

type ECDSAKeyMaterial = coreshares.ECDSAKeyMaterial

func UnmarshalKeyMaterial added in v0.2.2

func UnmarshalKeyMaterial(blob []byte) (ECDSAKeyMaterial, error)

type KeyMaterialMeta added in v0.2.2

type KeyMaterialMeta = coreshares.KeyMaterialMeta

type PreParamsConfig

type PreParamsConfig struct {
	Enabled             bool
	TargetSize          int
	MaxConcurrency      int
	GenerateTimeout     time.Duration
	AcquireTimeout      time.Duration
	RetryBackoff        time.Duration
	SyncFallbackOnEmpty bool
	FileCacheEnabled    bool
	FileCacheDir        string
}

func DefaultPreParamsConfig

func DefaultPreParamsConfig() PreParamsConfig

func LoadPreParamsConfigFromEnv

func LoadPreParamsConfigFromEnv() PreParamsConfig

type PreParamsSource added in v0.2.0

type PreParamsSource interface {
	Acquire(ctx context.Context) (*ecdsakeygen.LocalPreParams, error)
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewBnbService

func NewBnbService(logger *slog.Logger, opts ...ServiceOption) *Service

func (*Service) ECDSAAddress

func (s *Service) ECDSAAddress(key string) (string, error)

func (*Service) ExportECDSASignature

func (s *Service) ExportECDSASignature(key string) (common.SignatureData, error)

func (*Service) RunDKGSession

func (s *Service) RunDKGSession(ctx context.Context, req DKGSessionRequest) (DKGOutput, error)

func (*Service) RunSignSession

func (s *Service) RunSignSession(ctx context.Context, req SignSessionRequest) error

func (*Service) Snapshot

func (s *Service) Snapshot() Snapshot

func (*Service) StartPreParamsPool

func (s *Service) StartPreParamsPool(ctx context.Context) error

func (*Service) StopPreParamsPool

func (s *Service) StopPreParamsPool() error

type ServiceOption added in v0.2.0

type ServiceOption func(*serviceOptions)

func WithMetrics added in v0.2.0

func WithMetrics(metrics bnbutils.Metrics) ServiceOption

func WithPreParamsConfig added in v0.2.0

func WithPreParamsConfig(cfg PreParamsConfig) ServiceOption

func WithPreParamsSource added in v0.2.0

func WithPreParamsSource(source PreParamsSource) ServiceOption

func WithShareStore added in v0.2.0

func WithShareStore(store ShareStore) ServiceOption

type SessionDescriptor

type SessionDescriptor = DKGSessionDescriptor

type ShareCipher

type ShareCipher interface {
	Encrypt(ctx context.Context, plaintext []byte) ([]byte, error)
	Decrypt(ctx context.Context, ciphertext []byte) ([]byte, error)
}

type ShareMeta

type ShareMeta = coreshares.ShareMeta

type ShareStore

type ShareStore = coreshares.Store

type SignSessionDescriptor added in v0.2.2

type SignSessionDescriptor struct {
	SessionID string
	OrgID     string
	KeyID     string
	Parties   []string
	Threshold uint32
	Algorithm string
	Curve     string
	Chain     string
}

type SignSessionRequest

type SignSessionRequest struct {
	Session           SignSessionDescriptor
	LocalPartyID      string
	Digest            []byte
	DerivationContext *DerivationContext
	Transport         Transport
}

func (SignSessionRequest) Validate

func (r SignSessionRequest) Validate() error

type Snapshot

type Snapshot = tssservice.Snapshot

type StoredShare

type StoredShare = coreshares.StoredShare

type Transport

type Transport = coretransport.FrameTransport

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL