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

Method sign

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

Signs data using a derived key.

(self, algorithm: str, data: str | bytes)

Source from the content-addressed store, hash-verified

483 return GetTlsKeyResponse(**result)
484
485 async def sign(self, algorithm: str, data: str | bytes) -> SignResponse:
486 """Signs data using a derived key."""
487 data_bytes = data.encode() if isinstance(data, str) else data
488 if algorithm == "secp256k1_prehashed" and len(data_bytes) != 32:
489 raise ValueError(
490 f"Pre-hashed signing requires a 32-byte digest, but received {len(data_bytes)} bytes"
491 )
492
493 hex_data = binascii.hexlify(data_bytes).decode()
494 payload = {"algorithm": algorithm, "data": hex_data}
495 result = await self._send_rpc_request("Sign", payload)
496 return SignResponse(**result)
497
498 async def verify(
499 self,

Calls 3

_send_rpc_requestMethod · 0.95
SignResponseClass · 0.70
decodeMethod · 0.45