MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / tdx_quote

Method tdx_quote

sdk/python/src/dstack_sdk/dstack_client.py:681–714  ·  view source on GitHub ↗

Use ``get_quote`` instead (deprecated).

(
        self,
        report_data: str | bytes,
        hash_algorithm: str | None = None,
    )

Source from the content-addressed store, hash-verified

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."""

Callers 2

mainFunction · 0.95

Calls 4

emit_deprecation_warningFunction · 0.85
_send_rpc_requestMethod · 0.80
GetQuoteResponseClass · 0.70
decodeMethod · 0.45

Tested by 2

mainFunction · 0.76