Ë
    tPêjŒ  ã            
       ó4  — d Z ddlmZ ddlZddlZddlmZ  ej                  «       d„ «       Zej                  d¬«       ej                  d	d
ddd¬«       ej                  dddd¬«      ej                  dej                  d
edefd„«       «       «       «       Zy)z=CLI commands for the at-rest credential encryption migration.é    )ÚFinalNé   )Ú
HTTPClientc                   ó   — y)zEMigrate at-rest credentials to AES-256-GCM and attest residual state.N© r   ó    úq/home/oem/CyberBrain26-unified/.venv/lib/python3.12/site-packages/litellm/proxy/client/cli/commands/encryption.pyÚ
encryptionr
      s   � r   Úmigrate)Únamez--checkÚ
check_onlyTFzERead-only residual scan (no writes). Reports legacy values remaining.)Úis_flagÚdefaultÚhelpz	--dry-runz;Run the full migration walkers without writing any changes.ÚctxÚdry_runc                 ó¾  — t        | j                  d   | j                  d   «      }|r|j                  dd«      }n|j                  ddi |rddind	¬
«      }t        j                  |¬«       t        |t        «      r|j                  di «      ni }|j                  d«      }|�|dkD  rt        j                  d|› d�«       y	|dk(  rt        j                  d«       y	y	)a   Re-encrypt at-rest credentials into the AES-256-GCM (v2:gcm:) format.

    Requires the proxy to be started with
    ``general_settings.encryption_algorithm: aes-256-gcm``. Idempotent and
    resumable; safe to re-run after an interruption.

    Examples:
        litellm-proxy encryption migrate --check   # attestation scan, no writes
        litellm-proxy encryption migrate           # perform the migration
    Úbase_urlÚapi_keyÚGETz%/credentials/migrate-encryption/checkÚPOSTz/credentials/migrate-encryptionr   ÚtrueN)ÚjsonÚparams)ÚdataÚreportÚresidual_legacyr   z*[yellow]Residual legacy values remaining: z	[/yellow]zA[green]No legacy values remaining (residual_legacy == 0).[/green])	r   ÚobjÚrequestÚrichÚ
print_jsonÚ
isinstanceÚdictÚgetÚprint)r   r   r   ÚclientÚresponser   Úresiduals          r	   r   r      sÒ   € ô4 ˜sŸw™w zÑ2°C·G±G¸IÑ4FÓG€FáØ—>‘> %Ð)PÓQ‰à—>‘>ØØ-ØÙ*1�I˜vÑ&°tð	 "ó 
ˆô 	‡O�O˜Õ"ä2<¸XÄtÔ2L�H—L‘L ¨2Ô.ÐRT€FØ—j‘jÐ!2Ó3€HØÐ ¨1¢Ü�
‰
Ð?À¸zÈÐSÕTØ	�QŠÜ�
‰
ÐVÕWð 
r   )Ú__doc__Útypingr   Úclickr    Úhttp_clientr   Úgroupr
   ÚcommandÚoptionÚpass_contextÚContextÚboolr   r   r   r	   ú<module>r3      sÅ   ðÙ Cå ã Û å %ð €‡�ƒñPó ðPð ×Ñ˜ÐÓ#Ø€‡�ØØØØØ	Pôð €‡�ØØØØ	Fô	ð ×ÑðX�—‘ð X¨Dð X¸4ò Xó óóó $ñXr   