msp

package
v0.0.0-...-84f2696 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2021 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildIdentityConfigFromOptions

func BuildIdentityConfigFromOptions(opts ...interface{}) (msp.IdentityConfig, error)

BuildIdentityConfigFromOptions will return an IdentityConfig instance pre-built with Optional interfaces provided in fabsdk's WithConfigIdentity(opts...) call

func ConfigFromBackend

func ConfigFromBackend(coreBackend ...core.ConfigBackend) (msp.IdentityConfig, error)

ConfigFromBackend returns identity config implementation of given backend

func IsIdentityConfigFullyOverridden

func IsIdentityConfigFullyOverridden(c *IdentityConfigOptions) bool

IsIdentityConfigFullyOverridden will return true if all of the argument's sub interfaces is not nil (ie IdentityConfig interface not fully overridden)

func NewFileCertStore

func NewFileCertStore(cryptoConfigMSPPath string) (core.KVStore, error)

NewFileCertStore ...

func NewFileKeyStore

func NewFileKeyStore(cryptoConfigMSPPath string) (core.KVStore, error)

NewFileKeyStore loads keys stored in the cryptoconfig directory layout. This function will detect if private keys are stored in v1 or v2 format.

func UpdateMissingOptsWithDefaultConfig

func UpdateMissingOptsWithDefaultConfig(c *IdentityConfigOptions, d msp.IdentityConfig) msp.IdentityConfig

UpdateMissingOptsWithDefaultConfig will verify if any functions of the IdentityConfig were not updated with fabsdk's WithConfigIdentity(opts...) call, then use default IdentityConfig interface for these functions instead

Types

type CAClientImpl

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

CAClientImpl implements api/msp/CAClient

func NewCAClient

func NewCAClient(orgName string, ctx contextApi.Client, opts ...CAClientOption) (*CAClientImpl, error)

NewCAClient creates a new CA CAClient instance

func (*CAClientImpl) AddAffiliation

func (c *CAClientImpl) AddAffiliation(request *api.AffiliationRequest) (*api.AffiliationResponse, error)

AddAffiliation adds a new affiliation to the server

func (*CAClientImpl) CreateIdentity

func (c *CAClientImpl) CreateIdentity(request *api.IdentityRequest) (*api.IdentityResponse, error)

CreateIdentity create a new identity with the Fabric CA server. An enrollment secret is returned which can then be used, along with the enrollment ID, to enroll a new identity.

Parameters:
request holds info about identity

Returns:
Return identity info including secret

func (*CAClientImpl) Enroll

func (c *CAClientImpl) Enroll(request *api.EnrollmentRequest) error

Enroll a registered user in order to receive a signed X509 certificate. A new key pair is generated for the user. The private key and the enrollment certificate issued by the CA are stored in SDK stores. They can be retrieved by calling IdentityManager.GetSigningIdentity().

enrollmentID The registered ID to use for enrollment enrollmentSecret The secret associated with the enrollment ID

func (*CAClientImpl) GetAffiliation

func (c *CAClientImpl) GetAffiliation(affiliation, caname string) (*api.AffiliationResponse, error)

GetAffiliation returns information about the requested affiliation

func (*CAClientImpl) GetAllAffiliations

func (c *CAClientImpl) GetAllAffiliations(caname string) (*api.AffiliationResponse, error)

GetAllAffiliations returns all affiliations that the caller is authorized to see

func (*CAClientImpl) GetAllIdentities

func (c *CAClientImpl) GetAllIdentities(caname string) ([]*api.IdentityResponse, error)

GetAllIdentities returns all identities that the caller is authorized to see

Returns:
Response containing identities

func (*CAClientImpl) GetCAInfo

func (c *CAClientImpl) GetCAInfo() (*api.GetCAInfoResponse, error)

GetCAInfo returns generic CA information

func (*CAClientImpl) GetIdentity

func (c *CAClientImpl) GetIdentity(id, caname string) (*api.IdentityResponse, error)

GetIdentity retrieves identity information.

Parameters:
id is required identity id

Returns:
Returns identity information

func (*CAClientImpl) ModifyAffiliation

func (c *CAClientImpl) ModifyAffiliation(request *api.ModifyAffiliationRequest) (*api.AffiliationResponse, error)

ModifyAffiliation renames an existing affiliation on the server

func (*CAClientImpl) ModifyIdentity

func (c *CAClientImpl) ModifyIdentity(request *api.IdentityRequest) (*api.IdentityResponse, error)

ModifyIdentity modifies identity with the Fabric CA server.

Parameters:
request holds info about identity

Returns:
Return modified identity info

func (*CAClientImpl) Reenroll

func (c *CAClientImpl) Reenroll(request *api.ReenrollmentRequest) error

Reenroll an enrolled user in order to obtain a new signed X509 certificate

func (*CAClientImpl) Register

func (c *CAClientImpl) Register(request *api.RegistrationRequest) (string, error)

Register a User with the Fabric CA request: Registration Request Returns Enrolment Secret

func (*CAClientImpl) RemoveAffiliation

func (c *CAClientImpl) RemoveAffiliation(request *api.AffiliationRequest) (*api.AffiliationResponse, error)

RemoveAffiliation removes an existing affiliation from the server

func (*CAClientImpl) RemoveIdentity

func (c *CAClientImpl) RemoveIdentity(request *api.RemoveIdentityRequest) (*api.IdentityResponse, error)

RemoveIdentity removes identity from the Fabric CA server.

Parameters:
request holds info about identity to be removed

Returns:
Return removed identity info

func (*CAClientImpl) Revoke

Revoke a User with the Fabric CA registrar: The User that is initiating the revocation request: Revocation Request

type CAClientOption

type CAClientOption func(*caClientOption) error

CAClientOption describes a functional parameter for NewCAClient

func WithCAInstance

func WithCAInstance(caID string) CAClientOption

WithCAInstance allows for specifying optional CA name (within the CA server instance)

type CAConfig

type CAConfig struct {
	ID          string
	URL         string
	GRPCOptions map[string]interface{}
	TLSCACerts  endpoint.MutualTLSConfig
	Registrar   msp.EnrollCredentials
	CAName      string
}

CAConfig defines a CA configuration in identity config

type CertFileUserStore

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

CertFileUserStore stores each user in a separate file. Only user's enrollment cert is stored, in pem format. File naming is <user>@<org>-cert.pem

func NewCertFileUserStore

func NewCertFileUserStore(path string) (*CertFileUserStore, error)

NewCertFileUserStore creates a new instance of CertFileUserStore

func NewCertFileUserStore1

func NewCertFileUserStore1(store core.KVStore) (*CertFileUserStore, error)

NewCertFileUserStore1 creates a new instance of CertFileUserStore

func (*CertFileUserStore) Delete

Delete deletes a User from store

func (*CertFileUserStore) Load

Load returns the User stored in the store for a key.

func (*CertFileUserStore) Store

func (s *CertFileUserStore) Store(user *msp.UserData) error

Store stores a User into store

type ClientConfig

type ClientConfig struct {
	Organization    string
	Logging         logApi.LoggingType
	CryptoConfig    msp.CCType
	TLSCerts        ClientTLSConfig
	CredentialStore msp.CredentialStoreType
}

ClientConfig defines client configuration in identity config

type ClientTLSConfig

type ClientTLSConfig struct {
	//Client TLS information
	Client         endpoint.TLSKeyPair
	SystemCertPool bool
}

ClientTLSConfig defines client TLS configuration in identity config

type IdentityConfig

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

IdentityConfig represents the identity configuration for the client

func (*IdentityConfig) CAClientCert

func (c *IdentityConfig) CAClientCert(caID string) ([]byte, bool)

CAClientCert read configuration for the fabric CA client cert bytes for given org

func (*IdentityConfig) CAClientKey

func (c *IdentityConfig) CAClientKey(caID string) ([]byte, bool)

CAClientKey read configuration for the fabric CA client key bytes for given org

func (*IdentityConfig) CAConfig

func (c *IdentityConfig) CAConfig(caID string) (*msp.CAConfig, bool)

CAConfig returns the CA configuration.

func (*IdentityConfig) CAKeyStorePath

func (c *IdentityConfig) CAKeyStorePath() string

CAKeyStorePath returns the same path as KeyStorePath() without the 'keystore' directory added. This is done because the fabric-ca-client adds this to the path

func (*IdentityConfig) CAServerCerts

func (c *IdentityConfig) CAServerCerts(caID string) ([][]byte, bool)

CAServerCerts Read configuration option for the server certificates will send a list of cert bytes for given org

func (*IdentityConfig) Client

func (c *IdentityConfig) Client() *msp.ClientConfig

Client returns the Client config

func (*IdentityConfig) CredentialStorePath

func (c *IdentityConfig) CredentialStorePath() string

CredentialStorePath returns the user store path

func (*IdentityConfig) TLSCACertPool

func (c *IdentityConfig) TLSCACertPool() commtls.CertPool

TLSCACertPool returns the configured cert pool.

type IdentityConfigOptions

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

IdentityConfigOptions represents IdentityConfig interface with overridable interface functions if a function is not overridden, the default IdentityConfig implementation will be used.

type IdentityManager

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

IdentityManager implements fab/IdentityManager

func NewIdentityManager

func NewIdentityManager(orgName string, userStore msp.UserStore, cryptoSuite core.CryptoSuite, endpointConfig fab.EndpointConfig) (*IdentityManager, error)

NewIdentityManager creates a new instance of IdentityManager

func (*IdentityManager) CreateSigningIdentity

func (mgr *IdentityManager) CreateSigningIdentity(opts ...msp.SigningIdentityOption) (msp.SigningIdentity, error)

CreateSigningIdentity creates a signing identity with the given options

func (*IdentityManager) GetSigningIdentity

func (mgr *IdentityManager) GetSigningIdentity(id string) (msp.SigningIdentity, error)

GetSigningIdentity returns a signing identity for the given id

func (*IdentityManager) GetUser

func (mgr *IdentityManager) GetUser(username string) (*User, error)

GetUser returns a user for the given user name

func (*IdentityManager) NewUser

func (mgr *IdentityManager) NewUser(userData *msp.UserData) (*User, error)

NewUser creates a User instance

type MatchConfig

type MatchConfig struct {
	Pattern string

	// these are used for hostname mapping
	URLSubstitutionExp                  string
	SSLTargetOverrideURLSubstitutionExp string
	MappedHost                          string

	// this is used for Name mapping instead of hostname mappings
	MappedName string

	//IgnoreEndpoint option to exclude given entity from any kind of search or from entity list
	IgnoreEndpoint bool
}

MatchConfig contains match pattern and substitution pattern for pattern matching of network configured hostnames or channel names with static config

type MemoryKeyStore

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

MemoryKeyStore is in-memory implementation of BCCSP key store

func NewMemoryKeyStore

func NewMemoryKeyStore(password []byte) *MemoryKeyStore

NewMemoryKeyStore creates a new MemoryKeyStore instance

func (*MemoryKeyStore) GetKey

func (s *MemoryKeyStore) GetKey(ski []byte) (bccsp.Key, error)

GetKey returns a key for the provided SKI

func (*MemoryKeyStore) ReadOnly

func (s *MemoryKeyStore) ReadOnly() bool

ReadOnly returns always false

func (*MemoryKeyStore) StoreKey

func (s *MemoryKeyStore) StoreKey(key bccsp.Key) error

StoreKey stores a key

type MemoryUserStore

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

MemoryUserStore is in-memory implementation of UserStore

func NewMemoryUserStore

func NewMemoryUserStore() *MemoryUserStore

NewMemoryUserStore creates a new MemoryUserStore instance

func (*MemoryUserStore) Load

Load loads a user from store

func (*MemoryUserStore) Store

func (s *MemoryUserStore) Store(user *msp.UserData) error

Store stores a user into store

type User

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

User is a representation of a Fabric user

func (*User) EnrollmentCertificate

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

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

func (*User) Identifier

func (u *User) Identifier() *msp.IdentityIdentifier

Identifier returns user identifier

func (*User) PrivateKey

func (u *User) PrivateKey() core.Key

PrivateKey returns the crypto suite representation of the private key

func (*User) PublicVersion

func (u *User) PublicVersion() msp.Identity

PublicVersion returns the public parts of this identity

func (*User) Serialize

func (u *User) Serialize() ([]byte, error)

Serialize converts an identity to bytes

func (*User) Sign

func (u *User) Sign(msg []byte) ([]byte, error)

Sign the message

func (*User) Verify

func (u *User) Verify(msg []byte, sig []byte) error

Verify a signature over some message using this identity as reference

Directories

Path Synopsis
test
mockmspapi
Package mockmspapi is a generated GoMock package.
Package mockmspapi is a generated GoMock package.

Jump to

Keyboard shortcuts

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