Skip to content

Commit a5e5aab

Browse files
GhostWalker562davidiw
authored andcommitted
Removed strictness warnings with aip-80 parsing
1 parent 56f1812 commit a5e5aab

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ All notable changes to the Aptos Python SDK will be captured in this file. This
44

55
## Unreleased
66

7+
- `PrivateKey.format_private_key` can now format a AIP-80 compliant private key
8+
- Removed strictness warnnings for `PrivateKey.parse_hex_input`
9+
710
## 0.10.0
811

912
- Added support for deserialize RawTransactionWithData

aptos_sdk/asymmetric_crypto.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@ def format_private_key(
5050

5151
key_value: str | None = None
5252
if isinstance(private_key, str):
53-
key_value = private_key
53+
if private_key.startswith(aip80_prefix):
54+
key_value = private_key.split("-")[2]
55+
else:
56+
key_value = private_key
5457
elif isinstance(private_key, bytes):
5558
key_value = f"0x{private_key.hex()}"
5659
else:
@@ -97,10 +100,6 @@ def parse_hex_input(
97100
)
98101
raise ValueError("Invalid HexString input.")
99102
elif isinstance(value, bytes):
100-
if strict is None:
101-
print(
102-
"It is recommended that private keys are AIP-80 compliant (https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-80.md)."
103-
)
104103
return value
105104
else:
106105
raise TypeError("Input value must be a string or bytes.")

0 commit comments

Comments
 (0)