Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[aip80] Removed strictness warnings with aip-80 parsing #46

Merged
merged 1 commit into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ All notable changes to the Aptos Python SDK will be captured in this file. This

## Unreleased

- `PrivateKey.format_private_key` can now format a AIP-80 compliant private key
- Removed strictness warnnings for `PrivateKey.parse_hex_input`

## 0.10.0

- Added support for deserialize RawTransactionWithData
Expand Down
9 changes: 4 additions & 5 deletions aptos_sdk/asymmetric_crypto.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ def format_private_key(

key_value: str | None = None
if isinstance(private_key, str):
key_value = private_key
if private_key.startswith(aip80_prefix):
key_value = private_key.split("-")[2]
else:
key_value = private_key
elif isinstance(private_key, bytes):
key_value = f"0x{private_key.hex()}"
else:
Expand Down Expand Up @@ -97,10 +100,6 @@ def parse_hex_input(
)
raise ValueError("Invalid HexString input.")
elif isinstance(value, bytes):
if strict is None:
print(
"It is recommended that private keys are AIP-80 compliant (https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-80.md)."
)
return value
else:
raise TypeError("Input value must be a string or bytes.")
Expand Down
Loading