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

Class DstackClient

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

Source from the content-addressed store, hash-verified

535
536
537class DstackClient(BaseClient):
538 PATH_PREFIX = "/"
539
540 def __init__(self, endpoint: str | None = None, *, timeout: float = 3):
541 """Initialize client with HTTP or Unix-socket transport.
542
543 If a non-HTTP(S) endpoint is provided, it is treated as a Unix socket
544 path and validated for existence.
545 """
546 self.async_client = AsyncDstackClient(
547 endpoint, use_sync_http=True, timeout=timeout
548 )
549
550 @call_async
551 def get_key(
552 self,
553 path: str | None = None,
554 purpose: str | None = None,
555 algorithm: str = "secp256k1",
556 ) -> GetKeyResponse:
557 """Derive a key from the given path, purpose, and algorithm."""
558 raise NotImplementedError
559
560 @call_async
561 def get_quote(
562 self,
563 report_data: str | bytes,
564 ) -> GetQuoteResponse:
565 """Request an attestation quote for the provided report data."""
566 raise NotImplementedError
567
568 @call_async
569 def attest(
570 self,
571 report_data: str | bytes,
572 ) -> AttestResponse:
573 """Request a versioned attestation for the provided report data."""
574 raise NotImplementedError
575
576 @call_async
577 def info(self) -> InfoResponse[TcbInfo]:
578 """Fetch service information including parsed TCB info."""
579 raise NotImplementedError
580
581 @call_async
582 def emit_event(
583 self,
584 event: str,
585 payload: str | bytes,
586 ) -> None:
587 """Emit an event that extends RTMR3 on TDX platforms."""
588 raise NotImplementedError
589
590 @call_async
591 def get_tls_key(
592 self,
593 subject: str | None = None,
594 alt_names: List[str] | None = None,

Callers 15

mainFunction · 0.90
test_sync_client_get_keyFunction · 0.90
test_sync_client_attestFunction · 0.90
test_sync_emit_eventFunction · 0.90

Calls

no outgoing calls

Tested by 15

mainFunction · 0.72
test_sync_client_get_keyFunction · 0.72
test_sync_client_attestFunction · 0.72
test_sync_emit_eventFunction · 0.72