Create an Ethereum account from DstackClient key response. DEPRECATED: Use to_account_secure instead. This method has security concerns. Current implementation uses raw key material without proper hashing. Args: get_key_response: Response from get_key() or get_tls_key() Re
(get_key_response: GetKeyResponse | GetTlsKeyResponse)
| 19 | |
| 20 | |
| 21 | def to_account(get_key_response: GetKeyResponse | GetTlsKeyResponse) -> LocalAccount: |
| 22 | """Create an Ethereum account from DstackClient key response. |
| 23 | |
| 24 | DEPRECATED: Use to_account_secure instead. This method has security concerns. |
| 25 | Current implementation uses raw key material without proper hashing. |
| 26 | |
| 27 | Args: |
| 28 | get_key_response: Response from get_key() or get_tls_key() |
| 29 | |
| 30 | Returns: |
| 31 | Account: Ethereum account object |
| 32 | |
| 33 | """ |
| 34 | if isinstance(get_key_response, GetTlsKeyResponse): |
| 35 | warnings.warn( |
| 36 | "to_account: Please don't use getTlsKey method to get key, use getKey instead.", |
| 37 | DeprecationWarning, |
| 38 | stacklevel=2, |
| 39 | ) |
| 40 | key_bytes = get_key_response.as_uint8array(32) |
| 41 | return Account.from_key(key_bytes) # type: ignore[no-any-return] |
| 42 | else: # GetKeyResponse |
| 43 | return Account.from_key(get_key_response.decode_key()) # type: ignore[no-any-return] |
| 44 | |
| 45 | |
| 46 | def to_account_secure( |