@@ -371,8 +371,17 @@ def cmd_revoke_oauth2_token(host, port, tls, rest_api, token, **_):
371371
372372@cli .command ("get-pnba-code" )
373373@shared_options
374+ @click .option ("--auth-channel" , help = "The medium used to receive the code." )
374375def cmd_get_pnba_code (
375- host , port , tls , rest_api , platform , phone_number , request_identifier , ** _
376+ host ,
377+ port ,
378+ tls ,
379+ rest_api ,
380+ platform ,
381+ phone_number ,
382+ request_identifier ,
383+ auth_channel ,
384+ ** _ ,
376385):
377386 """Request a PNBA code."""
378387 logger .info ("platform=%s | phone_number=%s" , platform , phone_number )
@@ -393,7 +402,8 @@ def cmd_get_pnba_code(
393402 publisher_pb2 .GetPNBACodeRequest (
394403 platform = platform ,
395404 phone_number = phone_number ,
396- request_identifier = request_identifier or "" ,
405+ request_identifier = request_identifier ,
406+ channel = auth_channel ,
397407 ),
398408 metadata = metadata ,
399409 )
@@ -409,6 +419,7 @@ def cmd_get_pnba_code(
409419@shared_options
410420@click .option ("--code" , required = True , help = "Authorization code." )
411421@click .option ("--password" , help = "Two-step verification password." )
422+ @click .option ("--auth-channel" , help = "The medium used to receive the code." )
412423def cmd_exchange_pnba_code (
413424 host ,
414425 port ,
@@ -419,6 +430,7 @@ def cmd_exchange_pnba_code(
419430 request_identifier ,
420431 code ,
421432 password ,
433+ auth_channel ,
422434 ** _ ,
423435):
424436 """Exchange a PNBA code, decrypt the token, and store session data."""
@@ -451,6 +463,7 @@ def cmd_exchange_pnba_code(
451463 )
452464 for i , kp in enumerate (client_keypairs )
453465 ],
466+ channel = auth_channel ,
454467 ),
455468 metadata = metadata ,
456469 )
@@ -929,7 +942,7 @@ def cmd_send(
929942 sys .exit (1 )
930943
931944 len_att = len (attachment_bytes ) if attachment_bytes else 0
932- sess_id = secrets .randbelow (256 ) if has_attachment else None
945+ sess_id = secrets .randbelow (128 ) if has_attachment else None
933946
934947 try :
935948 payload = rrs .V1Payloads (
@@ -941,10 +954,7 @@ def cmd_send(
941954 )
942955 if has_attachment :
943956 segments = payload .split (rrs .Transports .SMS )
944- segments_b64 = [
945- seg .decode () if isinstance (seg , (bytes , bytearray )) else seg
946- for seg in segments
947- ]
957+ segments_b64 = [seg .decode () for seg in segments ]
948958 else :
949959 raw = payload .serialize_without_attachment ()
950960 segments_b64 = [b64 (raw , urlsafe = False )]
0 commit comments