+
    ~j&                         ^ RI HtHt ^ RIHtHt ^RIHt ^RIH	t
 ^RIHt Rt^tRt^t] ! R R4      4       t] ! R	 R
4      4       t ! R R4      t ! R R4      t ! R R4      tR# )    )	dataclassfield)ListOptional)	FfiClient)e2ee_pb2)ffi_pb2s   LKFrameEncryptionKeyc                   l   a  ] tR t^t o Rt]t]t]	t
]t]P                  P                  tV 3R ltRtV tR# )KeyProviderOptionsNc                   < V ^8  d   Qh/ S[ S[,          ;R&   S[;R&   S[;R&   S[;R&   S[;R&   S[P                  P
                  ;R&   # )   
shared_keyratchet_saltratchet_window_sizefailure_tolerancekey_ring_sizekey_derivation_function)r   bytesint
proto_e2eeKeyDerivationFunction	ValueType)format__classdict__s   "e/Users/mitch_tango/dev/rabbit-r1-livekit/agent/.venv/lib/python3.14/site-packages/livekit/rtc/e2ee.py__annotate__KeyProviderOptions.__annotate__   sc     &  .  :	 
 6  .  (==GG       )__name__
__module____qualname____firstlineno__r   DEFAULT_RATCHET_SALTr   DEFAULT_RATCHET_WINDOW_SIZEr   DEFAULT_FAILURE_TOLERANCEr   DEFAULT_KEY_RING_SIZEr   r   r   PBKDF2r   __annotate_func____static_attributes____classdictcell__r   s   @r   r   r      s;     "&J.L:6.M((//   r   r   c                   j   a  ] tR t^(t o ]! ]R7      t]P                  P                  t
V 3R ltRtV tR# )E2EEOptions)default_factoryc                Z   < V ^8  d   Qh/ S[ ;R&   S[P                  P                  ;R&   # )r   key_provider_optionsencryption_type)r   r   EncryptionTyper   )r   r   s   "r   r   E2EEOptions.__annotate__(   s)     ,X   ..88X r   r   N)r    r!   r"   r#   r   r   r1   r   r3   GCMr2   r)   r*   r+   r,   s   @r   r.   r.   (   s)     /4EW/X;E;T;T;X;XO  r   r.   c                      a  ] tR t^.t o V 3R lR lt]V 3R lR l4       tV 3R lR ltV 3R lR ltV 3R	 lR
 lt	V 3R lR lt
V 3R lR ltV 3R lR ltRtV tR# )KeyProviderc                &   < V ^8  d   QhRS[ RS[/# r   room_handleoptions)r   r   )r   r   s   "r   r   KeyProvider.__annotate__/   s     ( (C (2D (r   c                    W n         Wn        R # N)_options_room_handleselfr:   r;   s   &&&r   __init__KeyProvider.__init__/   s    'r   c                    < V ^8  d   QhRS[ /# r   return)r   )r   r   s   "r   r   r<   4   s      + r   c                    V P                   # r>   )r?   rB   s   &r   r;   KeyProvider.options3       }}r   c                *   < V ^8  d   QhRS[ RS[RR/# )r   key	key_indexrG   N)r   r   )r   r   s   "r   r   r<   7   s"     ( (% (C (D (r   c                   \         P                  ! 4       pV P                  VP                  n        W#P                  P
                  n        WP                  P
                  n        \        P                  P                  V4       R# )zSets the shared encryption key.

Parameters:
    key (bytes): The new shared key.
    key_index (int): The index of the key.

Example:
    ```python
    key_provider.set_shared_key(b"my_shared_key", key_index=1)
    ```
N)	proto_ffi
FfiRequestr@   e2eer:   set_shared_keyrN   r   r   instancerequest)rB   rM   rN   reqs   &&& r   rS   KeyProvider.set_shared_key7   sX     ""$#00,5)-0*""3'r   c                &   < V ^8  d   QhRS[ RS[/# r   rN   rG   r   r   )r   r   s   "r   r   r<   I   s      3 5 r   c                   \         P                  ! 4       pV P                  VP                  n        WP                  P
                  n        \        P                  P                  V4      pVP                  P
                  P                  pV# )zExports the shared encryption key.

Parameters:
    key_index (int): The index of the key to export.

Returns:
    bytes: The exported shared key.

Example:
    ```python
    key = key_provider.export_shared_key(key_index=1)
    ```
)rP   rQ   r@   rR   r:   get_shared_keyrN   r   rT   rU   rM   )rB   rN   rV   resprM   s   &&   r   export_shared_keyKeyProvider.export_shared_keyI   sd     ""$#00,5)!!))#.ii&&**
r   c                &   < V ^8  d   QhRS[ RS[/# rY   rZ   )r   r   s   "r   r   r<   ^   s      C E r   c                   \         P                  ! 4       pV P                  VP                  n        WP                  P
                  n        \        P                  P                  V4      pVP                  P
                  P                  pV# )a  Ratchets the shared encryption key to a new key.

Parameters:
    key_index (int): The index of the key to ratchet.

Returns:
    bytes: The new ratcheted shared key.

Example:
    ```python
    new_key = key_provider.ratchet_shared_key(key_index=1)
    ```
)rP   rQ   r@   rR   r:   ratchet_shared_keyrN   r   rT   rU   new_key)rB   rN   rV   r]   rc   s   &&   r   rb   KeyProvider.ratchet_shared_key^   sd     ""$#0009##-!!))#.))..66r   c                0   < V ^8  d   QhRS[ RS[RS[RR/# )r   participant_identityrM   rN   rG   N)strr   r   )r   r   s   "r   r   r<   u   s*     ( (C (e ( (PT (r   c                L   \         P                  ! 4       pV P                  VP                  n        WP                  P
                  n        W4P                  P
                  n        W$P                  P
                  n        W0n        \        P                  P                  V4       R# )aE  Sets the encryption key for a specific participant.

Parameters:
    participant_identity (str): The identity of the participant.
    key (bytes): The encryption key to set.
    key_index (int): The index of the key.

Example:
    ```python
    key_provider.set_key("participant123", b"participant_key", key_index=2)
    ```
N)rP   rQ   r@   rR   r:   set_keyrf   rN   rM   r   rT   rU   )rB   rf   rM   rN   rV   s   &&&& r   ri   KeyProvider.set_keyu   sm     ""$#000D-%."""""3'r   c                ,   < V ^8  d   QhRS[ RS[RS[/# r   rf   rN   rG   rg   r   r   )r   r   s   "r   r   r<      s"      s s u r   c                L   \         P                  ! 4       pV P                  VP                  n        WP                  P
                  n        W#P                  P
                  n        \        P                  P                  V4      pVP                  P
                  P                  pV# )aB  Exports the encryption key for a specific participant.

Parameters:
    participant_identity (str): The identity of the participant.
    key_index (int): The index of the key to export.

Returns:
    bytes: The exported key.

Example:
    ```python
    key = key_provider.export_key("participant123", key_index=2)
    ```
)rP   rQ   r@   rR   r:   get_keyrf   rN   r   rT   rU   rM   )rB   rf   rN   rV   r]   rM   s   &&&   r   
export_keyKeyProvider.export_key   st     ""$#000D-%."!!))#.ii##
r   c                ,   < V ^8  d   QhRS[ RS[RS[/# rl   rm   )r   r   s   "r   r   r<      s"         r   c                L   \         P                  ! 4       pV P                  VP                  n        WP                  P
                  n        W#P                  P
                  n        \        P                  P                  V4      pVP                  P
                  P                  pV# )a[  Ratchets the encryption key for a specific participant to a new key.

Parameters:
    participant_identity (str): The identity of the participant.
    key_index (int): The index of the key to ratchet.

Returns:
    bytes: The new ratcheted key.

Example:
    ```python
    new_key = key_provider.ratchet_key("participant123", key_index=2)
    ```
)rP   rQ   r@   rR   r:   ratchet_keyrf   rN   r   rT   rU   rc   )rB   rf   rN   rV   r]   rc   s   &&&   r   rt   KeyProvider.ratchet_key   st     ""$#004H1)2&!!))#.))''//r   )r?   r@   rN   N)r    r!   r"   r#   rC   propertyr;   rS   r^   rb   ri   rp   rt   r*   r+   r,   s   @r   r7   r7   .   s_     ( (  ( ($ * .( (, . r   r7   c                      a  ] tR t^t o V 3R lR lt]V 3R lR l4       t]V 3R lR l4       t]V 3R lR l4       tV 3R	 lR
 lt	V 3R lR lt
RtV tR# )FrameCryptorc                2   < V ^8  d   QhRS[ RS[RS[ RS[/# )r   r:   rf   rN   enabled)r   rg   bool)r   r   s   "r   r   FrameCryptor.__annotate__   s*     $ $C $s $s $]a $r   c                6    Wn         W@n        W n        W0n        R # r>   )r@   _enabled_participant_identity
_key_index)rB   r:   rf   rN   rz   s   &&&&&r   rC   FrameCryptor.__init__   s    '%9"#r   c                    < V ^8  d   QhRS[ /# rF   )rg   )r   r   s   "r   r   r|      s     * *c *r   c                    V P                   # r>   )r   rI   s   &r   rf   !FrameCryptor.participant_identity   s    )))r   c                    < V ^8  d   QhRS[ /# rF   r   )r   r   s   "r   r   r|      s      3 r   c                    V P                   # r>   )r   rI   s   &r   rN   FrameCryptor.key_index   s    r   c                    < V ^8  d   QhRS[ /# rF   r{   )r   r   s   "r   r   r|             r   c                    V P                   # r>   r~   rI   s   &r   rz   FrameCryptor.enabled   rK   r   c                $   < V ^8  d   QhRS[ RR/# r   rz   rG   Nr   )r   r   s   "r   r   r|      s     ( (4 (D (r   c                .   Wn         \        P                  ! 4       pV P                  VP                  n        V P                  VP                  P                  n        WP                  P                  n	        \        P                  P                  V4       R# )zEnables or disables frame encryption.

Parameters:
    enabled (bool): True to enable, False to disable.

Example:
    ```python
    frame_cryptor.set_enabled(True)
    ```
N)r~   rP   rQ   r@   rR   r:   r   cryptor_set_enabledrf   rz   r   rT   rU   rB   rz   rV   s   && r   set_enabledFrameCryptor.set_enabled   se      ""$#00<@<V<V$$9/6$$,""3'r   c                $   < V ^8  d   QhRS[ RR/# )r   rN   rG   Nr   )r   r   s   "r   r   r|      s     ( (s (t (r   c                .   Wn         \        P                  ! 4       pV P                  VP                  n        V P                  VP                  P                  n        WP                  P                  n	        \        P                  P                  V4       R# )zSets the key index for encryption/decryption.

Parameters:
    key_index (int): The new key index.

Example:
    ```python
    frame_cryptor.set_key_index(3)
    ```
N)r   rP   rQ   r@   rR   r:   r   cryptor_set_key_indexrf   rN   r   rT   rU   )rB   rN   rV   s   && r   set_key_indexFrameCryptor.set_key_index   se     $""$#00>B>X>X&&;3<&&0""3'r   )r~   r   r   r@   N)r    r!   r"   r#   rC   rv   rf   rN   rz   r   r   r*   r+   r,   s   @r   rx   rx      s_     $ $ * *    ( ($( (r   rx   c                      a  ] tR t^t o V 3R lR lt]V 3R lR l4       t]V 3R lR l4       tV 3R lR ltV 3R	 lR
 lt	Rt
V tR# )E2EEManagerc                6   < V ^8  d   QhRS[ RS[S[,          /# r9   )r   r   r.   )r   r   s   "r   r   E2EEManager.__annotate__   s$     ^ ^C ^(;2G ^r   c                    W n         Wn        VR JV n        Ve(   \        V P                  VP                  4      V n        R # R # r>   )r;   r@   r~   r7   r1   _key_providerrA   s   &&&r   rC   E2EEManager.__init__   s?    't+!,T->->@\@\!]D r   c                0   < V ^8  d   QhRS[ S[,          /# rF   )r   r7   )r   r   s   "r   r   r      s     " "h{3 "r   c                    V P                   # r>   )r   rI   s   &r   key_providerE2EEManager.key_provider   s    !!!r   c                    < V ^8  d   QhRS[ /# rF   r   )r   r   s   "r   r   r     r   r   c                    V P                   # r>   r   rI   s   &r   rz   E2EEManager.enabled   rK   r   c                $   < V ^8  d   QhRS[ RR/# r   r   )r   r   s   "r   r   r     s     ( (4 (D (r   c                    Wn         \        P                  ! 4       pV P                  VP                  n        WP                  P                  n        \        P                  P                  V4       R# )zEnables or disables end-to-end encryption.

Parameters:
    enabled (bool): True to enable, False to disable.

Example:
    ```python
    e2ee_manager.set_enabled(True)
    ```
N)r~   rP   rQ   r@   rR   r:   manager_set_enabledrz   r   rT   rU   r   s   && r   r   E2EEManager.set_enabled  sM      ""$#00/6$$,""3'r   c                0   < V ^8  d   QhRS[ S[,          /# rF   )r   rx   )r   r   s   "r   r   r     s      \ 2 r   c           	        \         P                  ! 4       pV P                  VP                  n        \
        P                  P                  V4      p. pVP                  P                  P                   FH  pVP                  \        V P                  VP                  VP                  VP                  4      4       KJ  	  V# )a  Retrieves the list of frame cryptors for participants.

Returns:
    List[FrameCryptor]: A list of FrameCryptor instances.

Example:
    ```python
    cryptors = e2ee_manager.frame_cryptors()
    for cryptor in cryptors:
        print(cryptor.participant_identity)
    ```
)rP   rQ   r@   rR   r:   r   rT   rU   manager_get_frame_cryptorsframe_cryptorsappendrx   rf   rN   rz   )rB   rV   r]   r   frame_cryptors   &    r   r   E2EEManager.frame_cryptors  s     ""$#00!!))#.!YYAAPPM!!%%!66!++!))	 Q r   )r~   r   r@   r;   N)r    r!   r"   r#   rC   rv   r   rz   r   r   r*   r+   r,   s   @r   r   r      sM     ^ ^ " "  ( (" r   r   N)dataclassesr   r   typingr   r   _ffi_clientr   _protor   r   r	   rP   r$   r%   r&   r'   r   r.   r7   rx   r   r   r   r   <module>r      s    ) ! " * (.         Y Y Y
J JZ5( 5(p= =r   