From 9e024e64de5e86e857fc65ba21eff7f9df043ef5 Mon Sep 17 00:00:00 2001 From: Nikita Neznaemov Date: Wed, 25 Oct 2023 11:51:41 +0300 Subject: [PATCH] bugfix/services-refactoring-1 --- identity/msp.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/identity/msp.go b/identity/msp.go index 7abc151..dcd457e 100644 --- a/identity/msp.go +++ b/identity/msp.go @@ -121,6 +121,18 @@ func MSPFromPath(mspID, mspPath string, opts ...MSPOpt) (*MSP, error) { mspInstance := &MSP{} + if len(mspOpts.signCert) != 0 && len(mspOpts.signKey) != 0 { + mspInstance.signer, err = NewSigningFromBytes(mspID, mspOpts.signCert, mspOpts.signKey) + if err != nil { + return nil, err + } + } else if mspOpts.signCertPath != "" && mspOpts.signKeyPath != "" { + mspInstance.signer, err = NewSigningFromFile(mspID, mspOpts.signCertPath, mspOpts.signKeyPath) + if err != nil { + return nil, err + } + } + // admin in separate msp path if mspOpts.adminMSPPath != `` { logger.Debug(`load admin identities from separate msp path`, @@ -157,7 +169,7 @@ func MSPFromPath(mspID, mspPath string, opts ...MSPOpt) (*MSP, error) { logger.Debug(`user identities loaded`, zap.Int(`num`, len(mspInstance.users))) } - if mspOpts.signCertsPath != `` { + if mspOpts.signCertsPath != `` && mspInstance.signer == nil { mspInstance.signer, err = FirstSigningFromPath(mspID, mspOpts.signCertsPath, mspOpts.keystorePath) if err != nil { return nil, fmt.Errorf(`read signer identity from=%s: %w`, mspOpts.signCertsPath, err)