Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some debug information #339

Merged
merged 1 commit into from
Dec 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions lib/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -362,11 +362,11 @@ func (c *Client) handleX509Enroll(req *api.EnrollmentRequest) (*EnrollmentRespon
}

// Handles enrollment request for an Idemix credential
// 1. Sends a request with empty body to the /api/v1/idemix/credentail REST endpoint
// of the server to get a Nonce from the CA
// 2. Constructs a credential request using the nonce, CA's idemix public key
// 3. Sends a request with the CredentialRequest object in the body to the
// /api/v1/idemix/credentail REST endpoint to get a credential
// 1. Sends a request with empty body to the /api/v1/idemix/credentail REST endpoint
// of the server to get a Nonce from the CA
// 2. Constructs a credential request using the nonce, CA's idemix public key
// 3. Sends a request with the CredentialRequest object in the body to the
// /api/v1/idemix/credentail REST endpoint to get a credential
func (c *Client) handleIdemixEnroll(req *api.EnrollmentRequest) (*EnrollmentResponse, error) {
log.Debugf("Getting nonce from CA %s", req.CAName)
reqNet := &api.IdemixEnrollmentRequestNet{
Expand Down Expand Up @@ -616,6 +616,7 @@ func (c *Client) getIssuerPubKey(ipkBytes []byte) (*idemix.IssuerPublicKey, erro

// LoadMyIdentity loads the client's identity from disk
func (c *Client) LoadMyIdentity() (*Identity, error) {
log.Debugf("LoadMyIdentity ")
err := c.Init()
if err != nil {
return nil, err
Expand Down Expand Up @@ -886,14 +887,14 @@ func (c *Client) CheckEnrollment() error {
if err == nil {
x509Enrollment = true
}
err = c.checkIdemixEnrollment()
if err == nil {
err2 := c.checkIdemixEnrollment()
if err2 == nil {
idemixEnrollment = true
}
if x509Enrollment || idemixEnrollment {
return nil
}
log.Errorf("Enrollment check failed: %s", err.Error())
log.Errorf("Enrollment check failed: either because '%s' or '%s'", err.Error(), err2.Error())
return errors.New("Enrollment information does not exist. Please execute enroll command first. Example: fabric-ca-client enroll -u http://user:userpw@serverAddr:serverPort")
}

Expand All @@ -912,7 +913,7 @@ func (c *Client) checkX509Enrollment() error {
return nil
}
}
return errors.New("X509 enrollment information does not exist")
return fmt.Errorf("x509 enrollment information does not exist - certFile: %s keyFile: %s", c.certFile, c.keyFile)
}

// checkIdemixEnrollment returns an error if CA's Idemix public key and user's
Expand Down