Documentation ¶
Overview ¶
Package fabsdk enables client usage of a Hyperledger Fabric network.
Index ¶
- Variables
- type ContextOption
- type FabricSDK
- type Option
- func WithCorePkg(core sdkApi.CoreProviderFactory) Option
- func WithCryptoSuiteConfig(cryptoConfigs ...interface{}) Option
- func WithEndpointConfig(endpointConfigs ...interface{}) Option
- func WithIdentityConfig(identityConfigs ...interface{}) Option
- func WithLoggerPkg(logger api.LoggerProvider) Option
- func WithMSPPkg(msp sdkApi.MSPProviderFactory) Option
- func WithServicePkg(service sdkApi.ServiceProviderFactory) Option
Constants ¶
This section is empty.
Variables ¶
var ErrAnonymousIdentity = errors.New("missing credentials")
ErrAnonymousIdentity is returned when options for identity creation don't include neither username nor identity
Functions ¶
This section is empty.
Types ¶
type ContextOption ¶
type ContextOption func(s *identityOptions) error
ContextOption provides parameters for creating a session (primarily from a fabric identity/user)
func WithIdentity ¶
func WithIdentity(signingIdentity msp.SigningIdentity) ContextOption
WithIdentity uses a pre-constructed identity object as the credential for the session
func WithUser ¶
func WithUser(username string) ContextOption
WithUser uses the named user to load the identity
type FabricSDK ¶
type FabricSDK struct {
// contains filtered or unexported fields
}
FabricSDK provides access (and context) to clients being managed by the SDK.
func New ¶
func New(configProvider core.ConfigProvider, opts ...Option) (*FabricSDK, error)
New initializes the SDK based on the set of options provided. ConfigOptions provides the application configuration.
func (*FabricSDK) ChannelContext ¶
func (sdk *FabricSDK) ChannelContext(channelID string, options ...ContextOption) contextApi.ChannelProvider
ChannelContext creates and returns channel context
func (*FabricSDK) Close ¶
func (sdk *FabricSDK) Close()
Close frees up caches and connections being maintained by the SDK
func (*FabricSDK) Config ¶
func (sdk *FabricSDK) Config() (core.ConfigBackend, error)
Config returns config backend used by all SDK config types
func (*FabricSDK) Context ¶
func (sdk *FabricSDK) Context(options ...ContextOption) contextApi.ClientProvider
Context creates and returns context client which has all the necessary providers
type Option ¶
type Option func(opts *options) error
Option configures the SDK.
func WithCorePkg ¶
func WithCorePkg(core sdkApi.CoreProviderFactory) Option
WithCorePkg injects the core implementation into the SDK.
func WithCryptoSuiteConfig ¶
func WithCryptoSuiteConfig(cryptoConfigs ...interface{}) Option
WithCryptoSuiteConfig injects a CryptoSuiteConfig interface to the SDK it accepts either a full interface of CryptoSuiteConfig or a list of sub interfaces each implementing one (or more) function(s) of CryptoSuiteConfig
func WithEndpointConfig ¶
func WithEndpointConfig(endpointConfigs ...interface{}) Option
WithEndpointConfig injects a EndpointConfig interface to the SDK it accepts either a full interface of EndpointConfig or a list of sub interfaces each implementing one (or more) function(s) of EndpointConfig
func WithIdentityConfig ¶
func WithIdentityConfig(identityConfigs ...interface{}) Option
WithIdentityConfig injects a IdentityConfig interface to the SDK it accepts either a full interface of IdentityConfig or a list of sub interfaces each implementing one (or more) function(s) of IdentityConfig
func WithLoggerPkg ¶
func WithLoggerPkg(logger api.LoggerProvider) Option
WithLoggerPkg injects the logger implementation into the SDK.
func WithMSPPkg ¶
func WithMSPPkg(msp sdkApi.MSPProviderFactory) Option
WithMSPPkg injects the MSP implementation into the SDK.
func WithServicePkg ¶
func WithServicePkg(service sdkApi.ServiceProviderFactory) Option
WithServicePkg injects the service implementation into the SDK.