identity

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MSPAdminCertsPath           = `admincerts`
	MSPCaCertsPath              = `cacerts`
	MSPIntermediateCertsPath    = `intermediatecerts`
	MSPTLSCaCertsPath           = `tlscacerts`
	MSPTLSIntermediateCertsPath = `tlsintermediatecerts`
	MSPKeystorePath             = "keystore"
	MSPSignCertsPath            = "signcerts"
	MSPUsersCertsPath           = "user"
	MSPOuCertsPath              = "ou"
	MspConfigFile               = "config.yaml"
)

Variables

View Source
var (
	ErrNoPEMContent = errors.New("no pem content")
	ErrKeyNotFound  = errors.New("key not found")
)
View Source
var (
	ErrNoFilesInDirectory = errors.New(`no files in directory`)
)

Functions

func AdminCertsPath

func AdminCertsPath(mspPath string) string

func Certificate

func Certificate(certRaw []byte) (*x509.Certificate, error)

func CertificatesFromPath

func CertificatesFromPath(certDir string) ([]*x509.Certificate, error)

func FabricMSPConfigFromPath

func FabricMSPConfigFromPath(mspID, mspDir string) (*mspproto.FabricMSPConfig, error)

func FirstFromPath

func FirstFromPath(mspID string, certDir, keyDir string) (*identity, error)

func FromBytes

func FromBytes(mspId string, certRaw []byte, keyRaw []byte) (*identity, error)

func FromBytesWithoutSigning

func FromBytesWithoutSigning(mspId string, certRaw []byte) (*identity, error)

func FromCertKeyPath

func FromCertKeyPath(mspId string, certPath string, keyPath string) (api.Identity, error)

func Key

func Key(keyRaw []byte) (interface{}, error)

Key parses raw key bytes

func KeyForCert

func KeyForCert(certRaw []byte, keyDir string) (interface{}, error)

KeyForCert returns private key for certificate from keyDir

func KeyPairForCert

func KeyPairForCert(certRaw []byte, keyDir string) (*x509.Certificate, interface{}, error)

func KeystorePath

func KeystorePath(mspPath string) string

func ListFromPath

func ListFromPath(mspID string, certDir, keyDir string) ([]api.Identity, error)

func New

func New(mspId string, cert *x509.Certificate, privateKey interface{}) *identity

func PEMEncode

func PEMEncode(certRaw []byte) []byte

func SerializedCertName

func SerializedCertName(path string, pos int) string

func SignCertsPath

func SignCertsPath(mspPath string) string

func SignerFromMSPPath

func SignerFromMSPPath(mspId string, mspPath string) (*identity, error)

Types

type MSP

type MSP interface {
	GetMSPIdentifier() string
	MSPConfig() *mspproto.FabricMSPConfig

	Signer() api.Identity
	Admins() []api.Identity
	Users() []api.Identity
	AdminOrSigner() api.Identity
}

type MSPConfig

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

func MSPFromConfig

func MSPFromConfig(fabricMspConfig *mspproto.FabricMSPConfig) (*MSPConfig, error)

MSPFromConfig created msp config from msp.FabricMSPConfig

func MSPFromPath

func MSPFromPath(mspID, mspPath string, opts ...MSPOpt) (*MSPConfig, error)

MSPFromPath loads msp config from filesystem

func MustMSPFromPath

func MustMSPFromPath(mspID, mspPath string, opts ...MSPOpt) *MSPConfig

func (*MSPConfig) AdminOrSigner

func (m *MSPConfig) AdminOrSigner() api.Identity

AdminOrSigner - returns admin identity if exists, in another case return msp. installation, fetching cc list should happen from admin identity if there is admin identity, use it. in another case - try with msp identity

func (*MSPConfig) Admins

func (m *MSPConfig) Admins() []api.Identity

func (*MSPConfig) GetMSPIdentifier

func (m *MSPConfig) GetMSPIdentifier() string

func (*MSPConfig) MSPConfig

func (m *MSPConfig) MSPConfig() *mspproto.FabricMSPConfig

func (*MSPConfig) Serialize

func (m *MSPConfig) Serialize() (MSPFiles, error)

func (*MSPConfig) Signer

func (m *MSPConfig) Signer() api.Identity

func (*MSPConfig) Users

func (m *MSPConfig) Users() []api.Identity

type MSPFiles

type MSPFiles map[string][]byte

func SerializeMSP

func SerializeMSP(fabricMSPConfig *mspproto.FabricMSPConfig) (MSPFiles, error)

func (MSPFiles) Add

func (mc MSPFiles) Add(path string, file []byte)

func (MSPFiles) Merge

func (mc MSPFiles) Merge(files MSPFiles)

func (MSPFiles) MergeToPath

func (mc MSPFiles) MergeToPath(mergePath string, files MSPFiles)

type MSPOpt

type MSPOpt func(opts *MSPOpts)

func WithAdminMSPPath

func WithAdminMSPPath(adminMSPPath string) MSPOpt

func WithSignCert added in v0.8.3

func WithSignCert(signCert []byte) MSPOpt

func WithSignCertPath

func WithSignCertPath(signCertPath string) MSPOpt

func WithSignKey added in v0.8.3

func WithSignKey(signKey []byte) MSPOpt

func WithSignKeyPath

func WithSignKeyPath(signKeyPath string) MSPOpt

func WithSkipConfig

func WithSkipConfig() MSPOpt

type MSPOpts

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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