fix mypy error

src/extract_otp_secrets.py:707: error: Argument 1 to "save" of "PyPNGImage" has incompatible type "str"; expected "SupportsWrite[bytes]"  [arg-type]
This commit is contained in:
scito
2025-02-08 09:12:45 +01:00
parent 38e7e8b40b
commit 10a60ab556
2 changed files with 7 additions and 2 deletions

View File

@@ -779,6 +779,11 @@ FileNotFoundError: Could not find module 'libiconv.dll' (or one of its dependenc
* [Android OTP Extractor](https://github.com/puddly/android-otp-extractor) can extract your tokens from popular Android OTP apps and export them in a standard format or just display them as QR codes for easy importing. [Requires a _rooted_ Android phone.] * [Android OTP Extractor](https://github.com/puddly/android-otp-extractor) can extract your tokens from popular Android OTP apps and export them in a standard format or just display them as QR codes for easy importing. [Requires a _rooted_ Android phone.]
* [Google Authenticator secret extractor](https://github.com/krissrex/google-authenticator-exporter) is similar project written in JavaScript. It also extracts otp secrets from Google Authenticator. * [Google Authenticator secret extractor](https://github.com/krissrex/google-authenticator-exporter) is similar project written in JavaScript. It also extracts otp secrets from Google Authenticator.
## Third party documentation
* [TOTP Secret Extraction from QR codes (medium.com)](https://cavalloj.medium.com/totp-secret-extraction-from-qr-codes-ee097b4c687f)
* [Google Authenticator: OTP-Secrets auslesen (stadt-bremerhaven.de)](https://stadt-bremerhaven.de/google-authenticator-otp-secrets-auslesen/)
*** ***
# #StandWithUkraine 🇺🇦 # #StandWithUkraine 🇺🇦

View File

@@ -49,7 +49,7 @@ from typing import (Any, Final, List, Optional, Sequence, TextIO, Tuple,
TypedDict, Union) TypedDict, Union)
import colorama import colorama
from qrcode import QRCode # type: ignore from qrcode import QRCode
import protobuf_generated_python.google_auth_pb2 as pb import protobuf_generated_python.google_auth_pb2 as pb
@@ -704,7 +704,7 @@ def save_qr_image_file(otp_url: OtpUrl, name: str) -> None:
qr.add_data(otp_url) qr.add_data(otp_url)
img = qr.make_image(fill_color='black', back_color='white') img = qr.make_image(fill_color='black', back_color='white')
if verbose: print(f"Saving to {name}") if verbose: print(f"Saving to {name}")
img.save(name) img.save(name) # type: ignore
def print_qr(otp_url: str, out: Optional[TextIO] = None) -> None: def print_qr(otp_url: str, out: Optional[TextIO] = None) -> None: