Documentation ¶
Overview ¶
Package fabsdk enables client usage of a Hyperledger Fabric network.
Index ¶
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 ¶
func WithConfig ¶
func WithConfig(config core.Config) core.ConfigProvider
WithConfig converts a Config interface to a ConfigProvider. This is a helper function for those who already loaded the config prior to instantiating the SDK.
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(cp core.ConfigProvider, opts ...Option) (*FabricSDK, error)
New initializes the SDK based on the set of options provided. configProvider 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) 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 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.