code: func (c *fabricCAAdapter) CreateIdentity(key core.Key, cert []byte, request *api.IdentityRequest) (*api.IdentityResponse, error) {
  
  	logger.Debugf("Creating identity [%s:%s]", request.ID, request.Affiliation)
  
  	var attributes []caapi.Attribute
  	for i := range request.Attributes {
  		attributes = append(attributes, caapi.Attribute{Name: request.Attributes[i].Name, Value: request.Attributes[i].Value, ECert: request.Attributes[i].ECert})
  	}
  
  	// Create add identity request
  	req := caapi.AddIdentityRequest{
  		CAName:         request.CAName,
  		ID:             request.ID,
  		Affiliation:    request.Affiliation,
  		Attributes:     attributes,
  		Type:           request.Type,
  		MaxEnrollments: request.MaxEnrollments,
  		Secret:         request.Secret,
  	}
  
  	registrar, err := c.newIdentity(key, cert)
  	if err != nil {
  		return nil, errors.Wrap(err, "failed to create CA signing identity")
  	}
  
  	response, err := registrar.AddIdentity(&req)
  	if err != nil {
  		return nil, errors.Wrap(err, "failed to add identity")
  	}
  
  	return getIdentityResponse(response), nil
  }
docs: // CreateIdentity creates new identity
  // key: registrar private key
  // cert: registrar enrollment certificate