Signs data using a derived key.
(self, algorithm: str, data: str | bytes)
| 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, |