Documentation ¶
Index ¶
- Variables
- func DistSigClientsDescriptionStr() string
- type ChannelAccountDBSignatureClient
- func (c *ChannelAccountDBSignatureClient) BatchInsert(ctx context.Context, number int) (publicKeys []string, err error)
- func (c *ChannelAccountDBSignatureClient) Delete(ctx context.Context, publicKey string) error
- func (c *ChannelAccountDBSignatureClient) NetworkPassphrase() string
- func (c *ChannelAccountDBSignatureClient) SignFeeBumpStellarTransaction(ctx context.Context, feeBumpStellarTx *txnbuild.FeeBumpTransaction, ...) (signedFeeBumpStellarTx *txnbuild.FeeBumpTransaction, err error)
- func (c *ChannelAccountDBSignatureClient) SignStellarTransaction(ctx context.Context, stellarTx *txnbuild.Transaction, ...) (signedStellarTx *txnbuild.Transaction, err error)
- func (c *ChannelAccountDBSignatureClient) Type() string
- type ChannelAccountDBSignatureClientOptions
- type DistributionAccountDBSignatureClient
- func (c *DistributionAccountDBSignatureClient) BatchInsert(ctx context.Context, number int) (publicKeys []string, err error)
- func (c *DistributionAccountDBSignatureClient) Delete(ctx context.Context, publicKey string) error
- func (c *DistributionAccountDBSignatureClient) NetworkPassphrase() string
- func (c *DistributionAccountDBSignatureClient) SignFeeBumpStellarTransaction(ctx context.Context, feeBumpStellarTx *txnbuild.FeeBumpTransaction, ...) (signedFeeBumpStellarTx *txnbuild.FeeBumpTransaction, err error)
- func (c *DistributionAccountDBSignatureClient) SignStellarTransaction(ctx context.Context, stellarTx *txnbuild.Transaction, publicKeys ...string) (signedStellarTx *txnbuild.Transaction, err error)
- func (c *DistributionAccountDBSignatureClient) Type() string
- type DistributionAccountDBSignatureClientOptions
- type DistributionAccountEnvOptions
- type DistributionAccountEnvSignatureClient
- func (c *DistributionAccountEnvSignatureClient) BatchInsert(ctx context.Context, number int) (publicKeys []string, err error)
- func (c *DistributionAccountEnvSignatureClient) Delete(ctx context.Context, publicKey string) error
- func (c *DistributionAccountEnvSignatureClient) NetworkPassphrase() string
- func (c *DistributionAccountEnvSignatureClient) SignFeeBumpStellarTransaction(ctx context.Context, feeBumpStellarTx *txnbuild.FeeBumpTransaction, ...) (signedFeeBumpStellarTx *txnbuild.FeeBumpTransaction, err error)
- func (c *DistributionAccountEnvSignatureClient) SignStellarTransaction(ctx context.Context, stellarTx *txnbuild.Transaction, ...) (signedStellarTx *txnbuild.Transaction, err error)
- func (c *DistributionAccountEnvSignatureClient) String() string
- func (c *DistributionAccountEnvSignatureClient) Type() string
- type DistributionAccountResolver
- type DistributionAccountResolverImpl
- func (r *DistributionAccountResolverImpl) DistributionAccount(ctx context.Context, tenantID string) (*schema.DistributionAccount, error)
- func (r *DistributionAccountResolverImpl) DistributionAccountFromContext(ctx context.Context) (*schema.DistributionAccount, error)
- func (r *DistributionAccountResolverImpl) HostDistributionAccount() string
- type DistributionAccountResolverOptions
- type SignatureClient
- type SignatureClientOptions
- type SignatureClientType
- type SignatureService
- type SignatureServiceOptions
Constants ¶
This section is empty.
Variables ¶
var DistSigClientsDescription = map[SignatureClientType]string{ DistributionAccountEnvSignatureClientType: "uses the the same distribution account for all tenants, as well as for the HOST, through the secret configured in DISTRIBUTION_SEED.", DistributionAccountDBSignatureClientType: "uses the one different distribution account private key per tenant, and stores them in the database, encrypted with the DISTRIBUTION_ACCOUNT_ENCRYPTION_PASSPHRASE.", }
var ErrDistributionAccountIsEmpty = fmt.Errorf("distribution account is empty")
var ErrUnsupportedCommand = fmt.Errorf("unsupported command for signature client")
Functions ¶
func DistSigClientsDescriptionStr ¶
func DistSigClientsDescriptionStr() string
Types ¶
type ChannelAccountDBSignatureClient ¶
type ChannelAccountDBSignatureClient struct {
// contains filtered or unexported fields
}
func NewChannelAccountDBSignatureClient ¶
func NewChannelAccountDBSignatureClient(opts ChannelAccountDBSignatureClientOptions) (*ChannelAccountDBSignatureClient, error)
NewChannelAccountDBSignatureClient returns a new instance of the ChannelAccountDB SignatureClient.
func (*ChannelAccountDBSignatureClient) BatchInsert ¶
func (*ChannelAccountDBSignatureClient) Delete ¶
func (c *ChannelAccountDBSignatureClient) Delete(ctx context.Context, publicKey string) error
func (*ChannelAccountDBSignatureClient) NetworkPassphrase ¶
func (c *ChannelAccountDBSignatureClient) NetworkPassphrase() string
func (*ChannelAccountDBSignatureClient) SignFeeBumpStellarTransaction ¶
func (c *ChannelAccountDBSignatureClient) SignFeeBumpStellarTransaction(ctx context.Context, feeBumpStellarTx *txnbuild.FeeBumpTransaction, stellarAccounts ...string) (signedFeeBumpStellarTx *txnbuild.FeeBumpTransaction, err error)
func (*ChannelAccountDBSignatureClient) SignStellarTransaction ¶
func (c *ChannelAccountDBSignatureClient) SignStellarTransaction(ctx context.Context, stellarTx *txnbuild.Transaction, stellarAccounts ...string) (signedStellarTx *txnbuild.Transaction, err error)
func (*ChannelAccountDBSignatureClient) Type ¶
func (c *ChannelAccountDBSignatureClient) Type() string
type ChannelAccountDBSignatureClientOptions ¶
type ChannelAccountDBSignatureClientOptions struct { NetworkPassphrase string DBConnectionPool db.DBConnectionPool EncryptionPassphrase string Encrypter utils.PrivateKeyEncrypter LedgerNumberTracker preconditions.LedgerNumberTracker }
func (*ChannelAccountDBSignatureClientOptions) Validate ¶
func (opts *ChannelAccountDBSignatureClientOptions) Validate() error
type DistributionAccountDBSignatureClient ¶
type DistributionAccountDBSignatureClient struct {
// contains filtered or unexported fields
}
func NewDistributionAccountDBSignatureClient ¶
func NewDistributionAccountDBSignatureClient(opts DistributionAccountDBSignatureClientOptions) (*DistributionAccountDBSignatureClient, error)
NewDistributionAccountDBSignatureClient returns a new instance of the DistributionAccountDB SignatureClient.
func (*DistributionAccountDBSignatureClient) BatchInsert ¶
func (*DistributionAccountDBSignatureClient) Delete ¶
func (c *DistributionAccountDBSignatureClient) Delete(ctx context.Context, publicKey string) error
func (*DistributionAccountDBSignatureClient) NetworkPassphrase ¶
func (c *DistributionAccountDBSignatureClient) NetworkPassphrase() string
func (*DistributionAccountDBSignatureClient) SignFeeBumpStellarTransaction ¶
func (c *DistributionAccountDBSignatureClient) SignFeeBumpStellarTransaction(ctx context.Context, feeBumpStellarTx *txnbuild.FeeBumpTransaction, publicKeys ...string) (signedFeeBumpStellarTx *txnbuild.FeeBumpTransaction, err error)
func (*DistributionAccountDBSignatureClient) SignStellarTransaction ¶
func (c *DistributionAccountDBSignatureClient) SignStellarTransaction(ctx context.Context, stellarTx *txnbuild.Transaction, publicKeys ...string) (signedStellarTx *txnbuild.Transaction, err error)
func (*DistributionAccountDBSignatureClient) Type ¶
func (c *DistributionAccountDBSignatureClient) Type() string
type DistributionAccountDBSignatureClientOptions ¶
type DistributionAccountDBSignatureClientOptions struct { NetworkPassphrase string DBConnectionPool db.DBConnectionPool EncryptionPassphrase string Encrypter utils.PrivateKeyEncrypter }
func (*DistributionAccountDBSignatureClientOptions) Validate ¶
func (opts *DistributionAccountDBSignatureClientOptions) Validate() error
type DistributionAccountEnvOptions ¶
type DistributionAccountEnvOptions struct { DistributionPrivateKey string NetworkPassphrase string }
func (DistributionAccountEnvOptions) String ¶
func (opts DistributionAccountEnvOptions) String() string
func (*DistributionAccountEnvOptions) Validate ¶
func (opts *DistributionAccountEnvOptions) Validate() error
type DistributionAccountEnvSignatureClient ¶
type DistributionAccountEnvSignatureClient struct {
// contains filtered or unexported fields
}
func NewDistributionAccountEnvSignatureClient ¶
func NewDistributionAccountEnvSignatureClient(opts DistributionAccountEnvOptions) (*DistributionAccountEnvSignatureClient, error)
NewDistributionAccountEnvSignatureClient returns a new DistributionAccountEnvSignatureClient instance
func (*DistributionAccountEnvSignatureClient) BatchInsert ¶
func (*DistributionAccountEnvSignatureClient) Delete ¶
func (c *DistributionAccountEnvSignatureClient) Delete(ctx context.Context, publicKey string) error
func (*DistributionAccountEnvSignatureClient) NetworkPassphrase ¶
func (c *DistributionAccountEnvSignatureClient) NetworkPassphrase() string
func (*DistributionAccountEnvSignatureClient) SignFeeBumpStellarTransaction ¶
func (c *DistributionAccountEnvSignatureClient) SignFeeBumpStellarTransaction(ctx context.Context, feeBumpStellarTx *txnbuild.FeeBumpTransaction, stellarAccounts ...string) (signedFeeBumpStellarTx *txnbuild.FeeBumpTransaction, err error)
func (*DistributionAccountEnvSignatureClient) SignStellarTransaction ¶
func (c *DistributionAccountEnvSignatureClient) SignStellarTransaction(ctx context.Context, stellarTx *txnbuild.Transaction, stellarAccounts ...string) (signedStellarTx *txnbuild.Transaction, err error)
func (*DistributionAccountEnvSignatureClient) String ¶
func (c *DistributionAccountEnvSignatureClient) String() string
func (*DistributionAccountEnvSignatureClient) Type ¶
func (c *DistributionAccountEnvSignatureClient) Type() string
type DistributionAccountResolver ¶
type DistributionAccountResolver interface { DistributionAccount(ctx context.Context, tenantID string) (*schema.DistributionAccount, error) DistributionAccountFromContext(ctx context.Context) (*schema.DistributionAccount, error) HostDistributionAccount() string }
DistributionAccountResolver is an interface that provides the distribution iven the provided keyword.
func NewDistributionAccountResolver ¶
func NewDistributionAccountResolver(config DistributionAccountResolverOptions) (DistributionAccountResolver, error)
type DistributionAccountResolverImpl ¶
type DistributionAccountResolverImpl struct {
// contains filtered or unexported fields
}
DistributionAccountResolverImpl is a DistributionAccountResolver that resolves the distribution account from the database.
func (*DistributionAccountResolverImpl) DistributionAccount ¶
func (r *DistributionAccountResolverImpl) DistributionAccount(ctx context.Context, tenantID string) (*schema.DistributionAccount, error)
DistributionAccount returns the tenant's distribution account stored in the database.
func (*DistributionAccountResolverImpl) DistributionAccountFromContext ¶
func (r *DistributionAccountResolverImpl) DistributionAccountFromContext(ctx context.Context) (*schema.DistributionAccount, error)
DistributionAccountFromContext returns the tenant's distribution account from the tenant object stored in the context provided.
func (*DistributionAccountResolverImpl) HostDistributionAccount ¶
func (r *DistributionAccountResolverImpl) HostDistributionAccount() string
HostDistributionAccount returns the host distribution account from the database.
type DistributionAccountResolverOptions ¶
type DistributionAccountResolverOptions struct { AdminDBConnectionPool db.DBConnectionPool HostDistributionAccountPublicKey string }
func (DistributionAccountResolverOptions) Validate ¶
func (c DistributionAccountResolverOptions) Validate() error
type SignatureClient ¶
type SignatureClient interface { NetworkPassphrase() string SignStellarTransaction(ctx context.Context, stellarTx *txnbuild.Transaction, stellarAccounts ...string) (signedStellarTx *txnbuild.Transaction, err error) SignFeeBumpStellarTransaction(ctx context.Context, feeBumpStellarTx *txnbuild.FeeBumpTransaction, stellarAccounts ...string) (signedFeeBumpStellarTx *txnbuild.FeeBumpTransaction, err error) BatchInsert(ctx context.Context, number int) (publicKeys []string, err error) Delete(ctx context.Context, publicKey string) error Type() string }
func NewSignatureClient ¶
func NewSignatureClient(sigType SignatureClientType, opts SignatureClientOptions) (SignatureClient, error)
type SignatureClientOptions ¶
type SignatureClientOptions struct { // Shared: NetworkPassphrase string // DistributionAccountEnv: DistributionPrivateKey string // DistributionAccountDB: DistAccEncryptionPassphrase string // ChannelAccountDB: ChAccEncryptionPassphrase string // *AccountDB: DBConnectionPool db.DBConnectionPool LedgerNumberTracker preconditions.LedgerNumberTracker Encrypter utils.PrivateKeyEncrypter // (optional) }
type SignatureClientType ¶
type SignatureClientType string
const ( ChannelAccountDBSignatureClientType SignatureClientType = "CHANNEL_ACCOUNT_DB" DistributionAccountEnvSignatureClientType SignatureClientType = "DISTRIBUTION_ACCOUNT_ENV" DistributionAccountDBSignatureClientType SignatureClientType = "DISTRIBUTION_ACCOUNT_DB" HostAccountEnvSignatureClientType SignatureClientType = "HOST_ACCOUNT_ENV" )
func AllSignatureClientTypes ¶
func AllSignatureClientTypes() []SignatureClientType
func DistributionSignatureClientTypes ¶
func DistributionSignatureClientTypes() []SignatureClientType
func ParseSignatureClientDistributionType ¶
func ParseSignatureClientDistributionType(sigClientType string) (SignatureClientType, error)
func ParseSignatureClientType ¶
func ParseSignatureClientType(sigClientType string) (SignatureClientType, error)
func (SignatureClientType) DistributionAccountType ¶
func (s SignatureClientType) DistributionAccountType() (schema.DistributionAccountType, error)
type SignatureService ¶
type SignatureService struct { ChAccountSigner SignatureClient DistAccountSigner SignatureClient HostAccountSigner SignatureClient DistributionAccountResolver // contains filtered or unexported fields }
func NewMockSignatureService ¶
func NewMockSignatureService(t mockConstructorTestingTNewMockSignatureService) ( sigService SignatureService, chAccSigClient *mocks.MockSignatureClient, distAccSigClient *mocks.MockSignatureClient, hostAccSigClient *mocks.MockSignatureClient, distAccResolver *mocks.MockDistributionAccountResolver, )
NewMockSignatureService is a constructor for the SignatureService with mock clients.
func NewSignatureService ¶
func NewSignatureService(opts SignatureServiceOptions) (SignatureService, error)
NewSignatureService creates a new signature service instance, given the distribution signer type and the options.
func (*SignatureService) NetworkPassphrase ¶
func (ss *SignatureService) NetworkPassphrase() string
func (*SignatureService) Validate ¶
func (s *SignatureService) Validate() error
type SignatureServiceOptions ¶
type SignatureServiceOptions struct { // Shared: NetworkPassphrase string // DistributionAccount: DistributionSignerType SignatureClientType // DistributionAccountEnv: DistributionPrivateKey string // DistributionAccountDB: DistAccEncryptionPassphrase string // ChannelAccountDB: ChAccEncryptionPassphrase string // *AccountDB: DBConnectionPool db.DBConnectionPool LedgerNumberTracker preconditions.LedgerNumberTracker Encrypter utils.PrivateKeyEncrypter // DistributionAccountResolver DistributionAccountResolver }