code: func (ccpack *SignedCDSPackage) InitFromBuffer(buf []byte) (*ChaincodeData, error) {
  	//incase ccpack is reused
  	ccpack.reset()
  
  	env := &common.Envelope{}
  	err := proto.Unmarshal(buf, env)
  	if err != nil {
  		return nil, fmt.Errorf("failed to unmarshal envelope from bytes")
  	}
  	cHdr, sDepSpec, err := ccpackage.ExtractSignedCCDepSpec(env)
  	if err != nil {
  		return nil, err
  	}
  
  	if cHdr.Type != int32(common.HeaderType_CHAINCODE_PACKAGE) {
  		return nil, fmt.Errorf("invalid type of envelope for chaincode package")
  	}
  
  	depSpec := &pb.ChaincodeDeploymentSpec{}
  	err = proto.Unmarshal(sDepSpec.ChaincodeDeploymentSpec, depSpec)
  	if err != nil {
  		return nil, fmt.Errorf("error getting deployment spec")
  	}
  
  	databytes, id, data, err := ccpack.getCDSData(sDepSpec)
  	if err != nil {
  		return nil, err
  	}
  
  	ccpack.buf = buf
  	ccpack.sDepSpec = sDepSpec
  	ccpack.depSpec = depSpec
  	ccpack.env = env
  	ccpack.data = data
  	ccpack.datab = databytes
  	ccpack.id = id
  
  	return ccpack.GetChaincodeData(), nil
  }
docs: //InitFromBuffer sets the buffer if valid and returns ChaincodeData