Documentation ¶
Overview ¶
Package clientconfig provides a way to configure SDK client.
Index ¶
Constants ¶
const ( // DefaultCommitment is the default commitment policy for the client. DefaultCommitment = suite.CommitmentPolicyRequireEncryptRequireDecrypt // DefaultMaxEDK is the default maximum number of encrypted data keys that can be // used to encrypt or decrypt a single message. DefaultMaxEDK = 10 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientConfig ¶
type ClientConfig struct {
// contains filtered or unexported fields
}
ClientConfig is the configuration for the client.
func NewConfig ¶
func NewConfig() (*ClientConfig, error)
NewConfig returns a new client configuration with the default options.
func NewConfigWithOpts ¶
func NewConfigWithOpts(optFns ...ConfigOptionFunc) (*ClientConfig, error)
NewConfigWithOpts returns a new client configuration with the provided options. The options are passed as ConfigOptionFunc functions, which modify the ConfigOptions struct.
The default values for the configuration options are as follows:
- CommitmentPolicy: DefaultCommitment
- MaxEncryptedDataKeys: DefaultMaxEDK
Example usage:
cfg, err := NewConfigWithOpts( WithCommitmentPolicy(suite.CommitmentPolicyRequireEncryptAllowDecrypt), WithMaxEncryptedDataKeys(5), )
func (ClientConfig) CommitmentPolicy ¶
func (c ClientConfig) CommitmentPolicy() suite.CommitmentPolicy
CommitmentPolicy returns the commitment policy for the client.
func (ClientConfig) MaxEncryptedDataKeys ¶
func (c ClientConfig) MaxEncryptedDataKeys() int
MaxEncryptedDataKeys returns the maximum number of encrypted data keys that can be used in a single message.
type ConfigOptionFunc ¶
type ConfigOptionFunc func(o *ConfigOptions) error
ConfigOptionFunc is a function that sets a configuration option.
func WithCommitmentPolicy ¶
func WithCommitmentPolicy(policy suite.CommitmentPolicy) ConfigOptionFunc
WithCommitmentPolicy returns a ConfigOptionFunc that sets the commitment policy for the client.
func WithMaxEncryptedDataKeys ¶
func WithMaxEncryptedDataKeys(maxEncryptedDataKeys int) ConfigOptionFunc
WithMaxEncryptedDataKeys returns a ConfigOptionFunc that sets the maximum number of encrypted data keys that can be used in a single message.
type ConfigOptions ¶
type ConfigOptions struct { // CommitmentPolicy is the commitment policy for the client. CommitmentPolicy suite.CommitmentPolicy // MaxEncryptedDataKeys is the maximum number of encrypted data keys that can be used in a single message. MaxEncryptedDataKeys int }
ConfigOptions is a holder of the configuration options for the client.