Skip to content

Commit

Permalink
fixup! Idemix MSP Folder Structure incompatible with what Fabric expe…
Browse files Browse the repository at this point in the history
…cts hyperledger#303

Signed-off-by: Angelo De Caro <[email protected]>
  • Loading branch information
adecaro authored and denyeart committed Jun 28, 2022
1 parent acea746 commit 29e083e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 13 additions & 1 deletion lib/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"encoding/hex"
"encoding/json"
"fmt"
"github.com/hyperledger/fabric-protos-go/msp"
"io/ioutil"
"net"
"net/http"
Expand Down Expand Up @@ -944,7 +945,18 @@ func (c *Client) verifyIdemixCredential() error {
signerConfig := &idemixcred.SignerConfig{}
err = json.Unmarshal(credfileBytes, signerConfig)
if err != nil {
return errors.Wrapf(err, "Failed to unmarshal signer config from %s", c.idemixCredFile)
// try proto
idemixSignerConfig := &msp.IdemixMSPSignerConfig{}
err = proto.Unmarshal(credfileBytes, idemixSignerConfig)
if err != nil {
return errors.Wrapf(err, "Failed to unmarshal signer config from %s", c.idemixCredFile)
}
signerConfig.Cred = idemixSignerConfig.Cred
signerConfig.Sk = idemixSignerConfig.Sk
signerConfig.CredentialRevocationInformation = idemixSignerConfig.CredentialRevocationInformation
signerConfig.EnrollmentID = idemixSignerConfig.EnrollmentId
signerConfig.Role = int(idemixSignerConfig.Role)
signerConfig.OrganizationalUnitIdentifier = idemixSignerConfig.OrganizationalUnitIdentifier
}

cred := new(idemix.Credential)
Expand Down
2 changes: 2 additions & 0 deletions lib/client/credential/idemix/credential.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ func (cred *Credential) Store() error {
return err
}
caSignerConfig := val.(*SignerConfig)

// Store the MSP signer config as Fabric expects
mspSignerConfig := &m.IdemixMSPSignerConfig{
Cred: caSignerConfig.Cred,
Sk: caSignerConfig.Sk,
Expand Down

0 comments on commit 29e083e

Please sign in to comment.