mirror of
https://github.com/meshcore-dev/meshcore_py.git
synced 2026-04-20 22:13:49 +00:00
Add timeout argument to sign and sign_finish methods for improved BLE operation handling
This commit is contained in:
parent
a814bd19b6
commit
1ecc1d8055
3 changed files with 61 additions and 8 deletions
|
|
@ -49,6 +49,12 @@ async def main():
|
|||
default=512,
|
||||
help="Chunk size to stream to the device (bytes)",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--timeout",
|
||||
type=float,
|
||||
default=None,
|
||||
help="Timeout for sign_finish operation in seconds (default: 15s minimum, longer for large data like JWT tokens)",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--debug",
|
||||
action="store_true",
|
||||
|
|
@ -63,7 +69,7 @@ async def main():
|
|||
print("✅ Connected.")
|
||||
|
||||
data_bytes = args.data.encode("utf-8")
|
||||
sig_evt = await meshcore.commands.sign(data_bytes, chunk_size=max(1, args.chunk_size))
|
||||
sig_evt = await meshcore.commands.sign(data_bytes, chunk_size=max(1, args.chunk_size), timeout=args.timeout)
|
||||
if sig_evt.type == EventType.ERROR:
|
||||
raise RuntimeError(f"sign failed: {sig_evt.payload}")
|
||||
signature = sig_evt.payload.get("signature", b"")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue