code: func (c *Credential) Sign(key handlers.IssuerSecretKey, credentialRequest []byte, attributes []bccsp.IdemixAttribute) (res []byte, err error) {
  	defer func() {
  		if r := recover(); r != nil {
  			res = nil
  			err = errors.Errorf("failure [%s]", r)
  		}
  	}()
  
  	iisk, ok := key.(*IssuerSecretKey)
  	if !ok {
  		return nil, errors.Errorf("invalid issuer secret key, expected *Big, got [%T]", key)
  	}
  
  	cr := &cryptolib.CredRequest{}
  	err = proto.Unmarshal(credentialRequest, cr)
  	if err != nil {
  		return nil, errors.Wrap(err, "failed unmarshalling credential request")
  	}
  
  	attrValues := make([]*FP256BN.BIG, len(attributes))
  	for i := 0; i < len(attributes); i++ {
  		switch attributes[i].Type {
  		case bccsp.IdemixBytesAttribute:
  			attrValues[i] = cryptolib.HashModOrder(attributes[i].Value.([]byte))
  		case bccsp.IdemixIntAttribute:
  			attrValues[i] = FP256BN.NewBIGint(attributes[i].Value.(int))
  		default:
  			return nil, errors.Errorf("attribute type not allowed or supported [%v] at position [%d]", attributes[i].Type, i)
  		}
  	}
  
  	cred, err := cryptolib.NewCredential(iisk.SK, cr, attrValues, c.NewRand())
  	if err != nil {
  		return nil, errors.WithMessage(err, "failed creating new credential")
  	}
  
  	return proto.Marshal(cred)
  }
docs: // Sign produces an idemix credential. It takes in input the issuer secret key,
  // a serialised  credential request, and a list of attribute values.
  // Notice that attributes should not contain attributes whose type is IdemixHiddenAttribute
  // cause the credential needs to carry all the attribute values.