Documentation
¶
Index ¶
- Variables
- func GetLocalMspConfig(dir string, cfg *factory.FactoryOpts, id string) (*pmsp.MSPConfig, error)
- func GetLocalMspConfigWithType(dir string, cfg *factory.FactoryOpts, id, mspType string) (*pmsp.MSPConfig, error)
- func GetVerifyingMspConfig(dir, id, mspType string) (*pmsp.MSPConfig, error)
- func ProviderTypeToString(id ProviderType) string
- func SetupCSPKeystoreConfig(cfg *factory.FactoryOpts, keystoreDir string) *factory.FactoryOpts
- type CSPNewOpts
- type Configuration
- type Identity
- type IdentityDeserializer
- type IdentityIdentifier
- type MSP
- type MSPManager
- type MSPVersion
- type NewOpts
- type NodeOUs
- type OUIdentifier
- type OrganizationalUnitIdentifiersConfiguration
- type ProviderType
- type SigningIdentity
Constants ¶
This section is empty.
Variables ¶
View Source
var Options = map[string]NewOpts{ ProviderTypeToString(CSP): &CSPNewOpts{Version: MSPv1_0}, }
Functions ¶
func GetLocalMspConfig ¶
func GetLocalMspConfigWithType ¶
func GetLocalMspConfigWithType(dir string, cfg *factory.FactoryOpts, id, mspType string) (*pmsp.MSPConfig, error)
GetLocalMspConfigWithType 方法的第四个参数目前仅支持 "csp"。
func GetVerifyingMspConfig ¶
GetVerifyingMspConfig 方法的第三个参数目前仅支持 "csp"。
func ProviderTypeToString ¶
func ProviderTypeToString(id ProviderType) string
func SetupCSPKeystoreConfig ¶
func SetupCSPKeystoreConfig(cfg *factory.FactoryOpts, keystoreDir string) *factory.FactoryOpts
Types ¶
type CSPNewOpts ¶
type CSPNewOpts struct {
Version MSPVersion
}
func (*CSPNewOpts) GetVersion ¶
func (co *CSPNewOpts) GetVersion() MSPVersion
type Configuration ¶
type Configuration struct {
// OrganizationalUnitIdentifiers 是 OUs 列表。如果设置了此值,则 MSP 将认为只有包含这些 OUs 中的至少一个的标识才是有效的。
OrganizationalUnitIdentifiers []*OrganizationalUnitIdentifiersConfiguration `yaml:"OrganizationalUnitIdentifiers,omitempty"`
// NodeOUs 使 MSP 能够根据身份的 OU 区分 clients、peers 和 orderers。
NodeOUs *NodeOUs `yaml:"NodeOUs,omitempty"`
}
Configuration 表示 MSP 可以配备的附件配置。默认情况下,此配置存储在一个 yaml 文件中
type Identity ¶
type Identity interface {
// ExpiresAt 返回身份的过期时间。
ExpiresAt() time.Time
// GetIdentifier 获取身份标识。
GetIdentifier() *IdentityIdentifier
// GetMSPIdentifier 获取 msp 的标识符。
GetMSPIdentifier() string
// Validate 验证身份的正确性。
Validate() error
// GetOrganizationalUnits 返回与此身份关联的组织单元。
GetOrganizationalUnits() []*OUIdentifier
// Anonymous 返回此身份是否是匿名的。
Anonymous() bool
// Verify 验证给定消息和签名的正确性。
Verify(msg []byte, signature []byte) error
// Serialize 将身份信息序列化成字节数组。
Serialize() ([]byte, error)
// SatisfiesPrinciple 检查此身份实例是否与 MSPPrinciple 中提供的描述匹配。
SatisfiesPrinciple(principal *pmsp.MSPPrinciple) error
}
type IdentityDeserializer ¶
type IdentityIdentifier ¶
IdentityIdentifier 表示身份标识,由 msp_id 和自己的身份 id 组成。
type MSP ¶
type MSP interface {
IdentityDeserializer
Setup(config *pmsp.MSPConfig) error
GetVersion() MSPVersion
// GetType 目前只会返回 "csp"。
GetType() ProviderType
GetIdentifier() string
GetDefaultSigningIdentity() (SigningIdentity, error)
// GetTLSRootCerts 返回此 MSP 的根 TLS 证书。
GetTLSRootCerts() [][]byte
// GetTLSIntermediateCerts 返回此 MSP 的 TLS 中级证书。
GetTLSIntermediateCerts() [][]byte
// Validate 验证给定的身份是否合法。
Validate(id Identity) error
// SatisfiesPrinciple 检查给定的身份实例是否与给定的 MSPPrinciple 中提供的描述匹配。
SatisfiesPrinciple(id Identity, principal *pmsp.MSPPrinciple) error
}
type MSPManager ¶
type MSPManager interface {
IdentityDeserializer
Setup(msps []MSP) error
GetMSPs() map[string]MSP
}
func NewMSPManager ¶
func NewMSPManager() MSPManager
type NewOpts ¶
type NewOpts interface {
GetVersion() MSPVersion
}
type NodeOUs ¶
type NodeOUs struct {
Enable bool `yaml:"Enable,omitempty"`
// ClientOUIdentifier 规定了如何根据 OU 识别 clients。
ClientOUIdentifier *OrganizationalUnitIdentifiersConfiguration `yaml:"ClientOUIdentifier,omitempty"`
// PeerOUIdentifier 规定了如何根据 OU 识别 peers。
PeerOUIdentifier *OrganizationalUnitIdentifiersConfiguration `yaml:"PeerOUIdentifier,omitempty"`
// AdminOUIdentifier 规定了如何根据 OU 识别 admins。
AdminOUIdentifier *OrganizationalUnitIdentifiersConfiguration `yaml:"AdminOUIdentifier,omitempty"`
// OrdererOUIdentifier 规定了如何根据 OU 识别 orderers。
OrdererOUIdentifier *OrganizationalUnitIdentifiersConfiguration `yaml:"OrdererOUIdentifier,omitempty"`
}
NodeOUs 包含关于如何根据 OUs 区分客户端、对等端和订购方的信息。如果通过将 Enabled 设置为 true 强制执行该检查,则 MSP 将认为一 个身份是有效的,如果它是客户端、peer 端或 orderer 的身份。一个身份标识应该只有这些特殊 OUs 中的一个。
type OUIdentifier ¶
type OUIdentifier struct {
// CertifiersIdentifier 一连串证书链的标识符(哈希值),由同一个机构签发的不同证书,
// 所计算出来的 CertifiersIdentifier 是一样的。
CertifiersIdentifier []byte
// OrganizationalUnitIdentifier 组织单元标识符。
OrganizationalUnitIdentifier string
}
OUIdentifier 组织单元的身份标识符。
Source Files
¶
Click to show internal directories.
Click to hide internal directories.