mocks

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Enroll

func Enroll(w http.ResponseWriter, req *http.Request)

Enroll user

func NewMockConfig

func NewMockConfig(CAServerURL string) apiconfig.Config

NewMockConfig ...

func Reenroll

func Reenroll(w http.ResponseWriter, req *http.Request)

Reenroll user

func Register

func Register(w http.ResponseWriter, req *http.Request)

Register user

func StartFabricCAMockServer

func StartFabricCAMockServer(address string) error

StartFabricCAMockServer Start fabric ca mock server

Types

type MockConfig

type MockConfig struct {
	CAServerURL string
}

MockConfig ...

func (*MockConfig) CAClientCertPath

func (c *MockConfig) CAClientCertPath(org string) (string, error)

CAClientCertPath Read configuration option for the fabric CA client cert file

func (*MockConfig) CAClientCertPem

func (c *MockConfig) CAClientCertPem(org string) (string, error)

CAClientCertPem Read configuration option for the fabric CA client cert from a string

func (*MockConfig) CAClientKeyPath

func (c *MockConfig) CAClientKeyPath(org string) (string, error)

CAClientKeyPath Read configuration option for the fabric CA client key file

func (*MockConfig) CAClientKeyPem

func (c *MockConfig) CAClientKeyPem(org string) (string, error)

CAClientKeyPem Read configuration option for the fabric CA client key from a string

func (*MockConfig) CAConfig

func (c *MockConfig) CAConfig(org string) (*apiconfig.CAConfig, error)

CAConfig return ca configuration

func (*MockConfig) CAKeyStorePath

func (c *MockConfig) CAKeyStorePath() string

CAKeyStorePath ...

func (*MockConfig) CAServerCertPaths

func (c *MockConfig) CAServerCertPaths(org string) ([]string, error)

CAServerCertPaths Read configuration option for the server certificate files

func (*MockConfig) CAServerCertPems

func (c *MockConfig) CAServerCertPems(org string) ([]string, error)

CAServerCertPems Read configuration option for the server certificate embedded pems

func (*MockConfig) ChannelConfig

func (c *MockConfig) ChannelConfig(name string) (*apiconfig.ChannelConfig, error)

ChannelConfig returns the channel configuration

func (*MockConfig) ChannelOrderers

func (c *MockConfig) ChannelOrderers(name string) ([]apiconfig.OrdererConfig, error)

ChannelOrderers returns a list of channel orderers

func (*MockConfig) ChannelPeers

func (c *MockConfig) ChannelPeers(name string) ([]apiconfig.ChannelPeer, error)

ChannelPeers returns the channel peers configuration

func (*MockConfig) Client

func (c *MockConfig) Client() (*apiconfig.ClientConfig, error)

Client returns the Client config

func (*MockConfig) CryptoConfigPath

func (c *MockConfig) CryptoConfigPath() string

CryptoConfigPath ...

func (*MockConfig) Ephemeral

func (c *MockConfig) Ephemeral() bool

Ephemeral flag

func (*MockConfig) IsSecurityEnabled

func (c *MockConfig) IsSecurityEnabled() bool

IsSecurityEnabled ...

func (*MockConfig) KeyStorePath

func (c *MockConfig) KeyStorePath() string

KeyStorePath ...

func (*MockConfig) MspID

func (c *MockConfig) MspID(org string) (string, error)

MspID ...

func (*MockConfig) NetworkConfig

func (c *MockConfig) NetworkConfig() (*apiconfig.NetworkConfig, error)

NetworkConfig not implemented

func (*MockConfig) NetworkPeers

func (c *MockConfig) NetworkPeers() ([]apiconfig.NetworkPeer, error)

NetworkPeers returns the mock network peers configuration

func (*MockConfig) OrdererConfig

func (c *MockConfig) OrdererConfig(name string) (*apiconfig.OrdererConfig, error)

OrdererConfig not implemented

func (*MockConfig) OrderersConfig

func (c *MockConfig) OrderersConfig() ([]apiconfig.OrdererConfig, error)

OrderersConfig returns a list of defined orderers

func (*MockConfig) PeerConfig

func (c *MockConfig) PeerConfig(org string, name string) (*apiconfig.PeerConfig, error)

PeerConfig Retrieves a specific peer from the configuration by org and name

func (*MockConfig) PeerMspID

func (c *MockConfig) PeerMspID(name string) (string, error)

PeerMspID not implemented

func (*MockConfig) PeersConfig

func (c *MockConfig) PeersConfig(org string) ([]apiconfig.PeerConfig, error)

PeersConfig Retrieves the fabric peers from the config file provided

func (*MockConfig) RandomOrdererConfig

func (c *MockConfig) RandomOrdererConfig() (*apiconfig.OrdererConfig, error)

RandomOrdererConfig not implemented

func (*MockConfig) SecurityAlgorithm

func (c *MockConfig) SecurityAlgorithm() string

SecurityAlgorithm ...

func (*MockConfig) SecurityLevel

func (c *MockConfig) SecurityLevel() int

SecurityLevel ...

func (*MockConfig) SecurityProvider

func (c *MockConfig) SecurityProvider() string

SecurityProvider provider SW or PKCS11

func (*MockConfig) SecurityProviderLabel

func (c *MockConfig) SecurityProviderLabel() string

SecurityProviderLabel will be set only if provider is PKCS11

func (*MockConfig) SecurityProviderLibPath

func (c *MockConfig) SecurityProviderLibPath() string

SecurityProviderLibPath will be set only if provider is PKCS11

func (*MockConfig) SecurityProviderPin

func (c *MockConfig) SecurityProviderPin() string

SecurityProviderPin will be set only if provider is PKCS11

func (*MockConfig) SetTLSCACertPool

func (c *MockConfig) SetTLSCACertPool(pool *x509.CertPool)

SetTLSCACertPool ...

func (*MockConfig) SoftVerify

func (c *MockConfig) SoftVerify() bool

SoftVerify flag

func (*MockConfig) TLSCACertPool

func (c *MockConfig) TLSCACertPool(cert ...*x509.Certificate) (*x509.CertPool, error)

TLSCACertPool ...

func (*MockConfig) TLSClientCerts

func (c *MockConfig) TLSClientCerts() ([]tls.Certificate, error)

TLSClientCerts ...

func (*MockConfig) TcertBatchSize

func (c *MockConfig) TcertBatchSize() int

TcertBatchSize ...

func (*MockConfig) TimeoutOrDefault

func (c *MockConfig) TimeoutOrDefault(apiconfig.TimeoutType) time.Duration

TimeoutOrDefault not implemented

type MockKey

type MockKey struct {
}

MockKey mocks BCCSP key

func (*MockKey) Bytes

func (m *MockKey) Bytes() ([]byte, error)

Bytes ...

func (*MockKey) Private

func (m *MockKey) Private() bool

Private ...

func (*MockKey) PublicKey

func (m *MockKey) PublicKey() (bccsp.Key, error)

PublicKey ...

func (*MockKey) SKI

func (m *MockKey) SKI() []byte

SKI ...

func (*MockKey) Symmetric

func (m *MockKey) Symmetric() bool

Symmetric ...

type MockUser

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

MockUser ...

func NewMockUser

func NewMockUser(name string) *MockUser

NewMockUser ... *

  • Constructor for a user. *
  • @param {string} name - The user name

func (*MockUser) EnrollmentCertificate

func (u *MockUser) EnrollmentCertificate() []byte

EnrollmentCertificate ... *

  • Returns the underlying ECert representing this user’s identity.

func (*MockUser) GenerateTcerts

func (u *MockUser) GenerateTcerts(count int, attributes []string)

GenerateTcerts ... *

  • Gets a batch of TCerts to use for transaction. there is a 1-to-1 relationship between
  • TCert and Transaction. The TCert can be generated locally by the SDK using the user’s crypto materials.
  • @param {int} count how many in the batch to obtain
  • @param {[]string} attributes list of attributes to include in the TCert
  • @return {[]tcert} An array of TCerts

func (*MockUser) Identity

func (u *MockUser) Identity() ([]byte, error)

Identity returns MockUser's serialized identity

func (*MockUser) MspID

func (u *MockUser) MspID() string

MspID returns the MSP for this user

func (*MockUser) Name

func (u *MockUser) Name() string

Name ... *

  • Get the user name.
  • @returns {string} The user name.

func (*MockUser) PrivateKey

func (u *MockUser) PrivateKey() apicryptosuite.Key

PrivateKey ... *

  • deprecated.

func (*MockUser) Roles

func (u *MockUser) Roles() []string

Roles ... *

  • Get the roles.
  • @returns {[]string} The roles.

func (*MockUser) SetEnrollmentCertificate

func (u *MockUser) SetEnrollmentCertificate(cert []byte)

SetEnrollmentCertificate ... *

  • Set the user’s Enrollment Certificate.

func (*MockUser) SetMspID

func (u *MockUser) SetMspID(mspID string)

SetMspID sets the MSP for this user

func (*MockUser) SetPrivateKey

func (u *MockUser) SetPrivateKey(privateKey apicryptosuite.Key)

SetPrivateKey ... *

  • deprecated.

func (*MockUser) SetRoles

func (u *MockUser) SetRoles(roles []string)

SetRoles ... *

  • Set the roles.
  • @param roles {[]string} The roles.

Jump to

Keyboard shortcuts

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