code: func (x *XC) DecryptStream(ctx context.Context, ciphertext io.Reader, plaintext io.Writer) error {
  	dec := binary.NewDecoder(ciphertext)
  
  	// read version
  	ver := 0
  	if err := dec.Decode(&ver); err != nil {
  		return err
  	}
  	if ver != 0x1 {
  		return fmt.Errorf("wrong version")
  	}
  	// read header
  	header := &xcpb.Header{}
  	if err := dec.Decode(header); err != nil {
  		return err
  	}
  
  	// try to find a suiteable decryption key in the header
  	sk, err := x.decryptSessionKey(ctx, header)
  	if err != nil {
  		return err
  	}
  
  	var secretKey [32]byte
  	copy(secretKey[:], sk)
  
  	// read body
  	num := 0
  	var buf []byte
  	br := &byteReader{ciphertext}
  	for {
  		l, err := stdbin.ReadUvarint(br)
  		if err != nil {
  			if err == io.EOF {
  				return nil
  			}
  			return err
  		}
  		buf = make([]byte, l)
  		n, err := br.Read(buf)
  		if err := x.decryptChunk(secretKey, num, buf[:n], plaintext); err != nil {
  			return err
  		}
  		if err != nil {
  			if err == io.EOF {
  				return nil
  			}
  			return err
  		}
  		num++
  	}
  }
docs: // DecryptStream decrypts an stream encrypted with EncryptStream