Skip to content

Commit

Permalink
fix: fix annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
Ernst79 committed Sep 29, 2022
1 parent 801679e commit 1bc8f72
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/bthome_ble/bthome_encryption.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from Cryptodome.Cipher import AES


def parse_value(data: bytes) -> dict:
def parse_value(data: bytes) -> dict[str, float]:
"""Parse decrypted payload to readable BTHome data"""
vlength = len(data)
if vlength >= 3:
Expand All @@ -20,7 +20,7 @@ def parse_value(data: bytes) -> dict:

def decrypt_payload(
payload: bytes, mic: bytes, key: bytes, nonce: bytes
) -> dict | None:
) -> dict[str, float] | None:
"""Decrypt payload."""
print("Nonce:", nonce.hex())
print("CryptData:", payload.hex())
Expand All @@ -40,7 +40,9 @@ def decrypt_payload(
return parse_value(data=data)


def decrypt_aes_ccm(key: bytes, mac: bytes, data: bytes) -> dict | None:
def decrypt_aes_ccm(
key: bytes, mac: bytes, data: bytes
) -> dict[str, float] | None:
"""Decrypt AES CCM."""
print("MAC:", mac.hex())
print("Bindkey:", key.hex())
Expand Down Expand Up @@ -78,7 +80,7 @@ def encrypt_payload(
# =============================
# main()
# =============================
def main():
def main() -> None:
"""Example to encrypt and decrypt BTHome payload."""
print()
print("====== Test encode -----------------------------------------")
Expand Down

0 comments on commit 1bc8f72

Please sign in to comment.