Use ``get_quote`` instead (deprecated).
(
self,
report_data: str | bytes,
hash_algorithm: str | None = None,
)
| 679 | return GetTlsKeyResponse(**result) |
| 680 | |
| 681 | async def tdx_quote( |
| 682 | self, |
| 683 | report_data: str | bytes, |
| 684 | hash_algorithm: str | None = None, |
| 685 | ) -> GetQuoteResponse: |
| 686 | """Use ``get_quote`` instead (deprecated).""" |
| 687 | emit_deprecation_warning( |
| 688 | "tdx_quote is deprecated, please use get_quote instead" |
| 689 | ) |
| 690 | |
| 691 | if not report_data or not isinstance(report_data, (bytes, str)): |
| 692 | raise ValueError("report_data can not be empty") |
| 693 | |
| 694 | report_bytes: bytes = ( |
| 695 | report_data.encode() if isinstance(report_data, str) else report_data |
| 696 | ) |
| 697 | hex_data = binascii.hexlify(report_bytes).decode() |
| 698 | |
| 699 | if hash_algorithm == "raw": |
| 700 | if len(hex_data) > 128: |
| 701 | raise ValueError( |
| 702 | "Report data is too large, it should less then 64 bytes when hash_algorithm is raw." |
| 703 | ) |
| 704 | if len(hex_data) < 128: |
| 705 | hex_data = hex_data.zfill(128) |
| 706 | |
| 707 | payload = {"report_data": hex_data, "hash_algorithm": hash_algorithm or "raw"} |
| 708 | |
| 709 | result = await self._send_rpc_request("TdxQuote", payload) |
| 710 | |
| 711 | if "error" in result: |
| 712 | raise RuntimeError(result["error"]) |
| 713 | |
| 714 | return GetQuoteResponse(**result) |
| 715 | |
| 716 | async def info(self) -> InfoResponse[TcbInfo]: |
| 717 | """Fetch service information including parsed TCB info.""" |