+
    BÆÚj!  ã                   ó�   € R t ^ RIHt ^ RIHt ^ RIHt ^ RIHtH	t	 ^RI
HtHtHt ^RIHt R t ! R R	]4      t ! R
 R]4      tR# )a°  libolm SAS module.

This module contains functions to perform key verification using the Short
Authentication String (SAS) method.

Examples:
    >>> sas = Sas()
    >>> bob_key = "3p7bfXt9wbTTW2HC7OQ1Nz+DQ8hbeGdNrfx+FG+IK08"
    >>> message = "Hello world!"
    >>> extra_info = "MAC"
    >>> sas_alice.set_their_pubkey(bob_key)
    >>> sas_alice.calculate_mac(message, extra_info)
    >>> sas_alice.generate_bytes(extra_info, 5)

)Úbytes)Úwraps)ÚOptional)ÚffiÚlib)ÚURANDOMÚto_bytearrayÚto_bytes)Útrack_for_finalizationc                 ó2   € \         P                  ! V 4       R # ©N)r   Úolm_clear_sas)Úsass   &Ú~/opt/data/installs/351f81cc06284494/environments/aa258815729c481f8402f54f4c368f83/venv/lib/python3.14/site-packages/olm/sas.pyÚ
_clear_sasr   +   s   € ä×Ò�cÖó    c                   ó   € ] tR t^0tRtRtR# )ÚOlmSasErrorzlibolm Sas error exception.© N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú__static_attributes__r   r   r   r   r   0   s   † Ý%r   r   c                   óx   a € ] tR t^4t o RtRR ltR tR t]R 4       t	]R 4       t
R tR	 tR
 tR tR tRtV tR# )ÚSasz.libolm Short Authenticaton String (SAS) class.Nc                ó�  € \         P                  ! R\        P                  ! 4       4      V n        \        P
                  ! V P                  4      V n        \        W P                  \        4       \        P                  ! V P                  4      p\        V4      pV P                  W24       V'       d   V P                  V4       R# R# )zúCreate a new SAS object.

Args:
    other_users_pubkey(str, optional): The other users public key, this
        key is necesary to generate bytes for the authentication string
        as well as to calculate the MAC.

Raises OlmSasError on failure.

úchar[]N)r   Únewr   Úolm_sas_sizeÚ_bufÚolm_sasÚ_sasr
   r   Úolm_create_sas_random_lengthr   Ú_create_sasÚset_their_pubkey)ÚselfÚother_users_pubkeyÚrandom_lengthÚrandoms   &&  r   Ú__init__ÚSas.__init__7   s„   € ô —G’G˜H¤c×&6Ò&6Ó&8Ó9ˆŒ	Ü—K’K §	¡	Ó*ˆŒ	Ü˜t§Y¡Y´
Ô;ä×8Ò8¸¿¹ÓCˆÜ˜Ó'ˆà×Ñ˜Ô/çØ×!Ñ!Ð"4Ö5ñ r   c                ó�   € V P                  \        P                  ! V P                  \        P
                  ! V4      V4      4       R # r   )Ú_check_errorr   Úolm_create_sasr#   r   Úfrom_buffer)r'   ÚbufferÚbuffer_lengths   &&&r   r%   ÚSas._create_sasO   s4   € Ø×ÑÜ×ÒØ—	‘	Ü—’ Ó'Øóö	
r   c                óÔ   € V\         P                  ! 4       8w  d   R # \        P                  ! \         P                  ! V P
                  4      4      P                  4       p\        V4      hr   )r   Ú	olm_errorr   ÚstringÚolm_sas_last_errorr#   Údecoder   )r'   ÚretÚ
last_errors   && r   r.   ÚSas._check_errorX   sD   € à”#—-’-“/Ô!Ùä—Z’Z¤×!7Ò!7¸¿	¹	Ó!BÓD×KÑKÓMˆ
ä˜*Ó%Ð%r   c                ó  € \         P                  ! V P                  4      p\        P                  ! RV4      pV P                  \         P                  ! V P                  W!4      4       \        P                  ! W!4      P                  4       # )zÈGet the public key for the SAS object.

This returns the public key of the SAS object that can then be shared
with another user to perform the authentication process.

Raises OlmSasError on failure.

r   )	r   Úolm_sas_pubkey_lengthr#   r   r   r.   Úolm_sas_get_pubkeyÚunpackr8   )r'   Úpubkey_lengthÚpubkey_buffers   &  r   ÚpubkeyÚ
Sas.pubkeya   sd   € ô ×1Ò1°$·)±)Ó<ˆÜŸš ¨-Ó8ˆà×ÑÜ×"Ò" 4§9¡9¨mÓKô	
ô �zŠz˜-Ó7×>Ñ>Ó@Ð@r   c                óH   € \         P                  ! V P                  4      ^8H  # )z7Check if the other user's pubkey has been set.
        )r   Úolm_sas_is_their_key_setr#   )r'   s   &r   Úother_key_setÚSas.other_key_setu   s   € ô
 ×+Ò+¨D¯I©IÓ6¸!Ñ;Ð;r   c           	     ó¸   € \        V4      pV P                  \        P                  ! V P                  \
        P                  ! V4      \        V4      4      4       R# )a  Set the public key of the other user.

This sets the public key of the other user, it needs to be set before
bytes can be generated for the authentication string and a MAC can be
calculated.

Args:
    key (str): The other users public key.

Raises OlmSasError on failure.

N)r   r.   r   Úolm_sas_set_their_keyr#   r   r0   Úlen)r'   ÚkeyÚbyte_keys   && r   r&   ÚSas.set_their_pubkey|   sD   € ô   Ó$ˆà×ÑÜ×%Ò%Ø—	‘	Ü—’ Ó)Ü�H“óö	
r   c           	     ó6  € V^8  d   \        R4      h\        V4      p\        P                  ! RV4      pV P	                  \
        P                  ! V P                  \        P                  ! V4      \        V4      VV4      4       \        P                  ! WB4      # )a1  Generate bytes to use for the short authentication string.

Args:
    extra_info (str): Extra information to mix in when generating the
        bytes.
    length (int): The number of bytes to generate.

Raises OlmSasError if the other users persons public key isn't set or
an internal Olm error happens.

z/The length needs to be a positive integer valuer   )Ú
ValueErrorr   r   r   r.   r   Úolm_sas_generate_bytesr#   r0   rJ   r?   )r'   Ú
extra_infoÚlengthÚ	byte_infoÚ
out_buffers   &&&  r   Úgenerate_bytesÚSas.generate_bytes”   s~   € ð �AŒ:ÜÐNÓOÐOä  Ó,ˆ	Ü—W’W˜X vÓ.ˆ
à×ÑÜ×&Ò&Ø—	‘	Ü—’ 	Ó*Ü�I“ØØóô	
ô �zŠz˜*Ó-Ð-r   c                óÂ  € \        V4      p\        V4      p\        P                  ! V P                  4      p\        P
                  ! RV4      pV P                  \        P                  ! V P                  \        P                  ! V4      \        V4      \        P                  ! V4      \        V4      VV4      4       \        P                  ! We4      P                  4       # )a  Generate a message authentication code based on the shared secret.

Args:
    message (str): The message to produce the authentication code for.
    extra_info (str): Extra information to mix in when generating the
        MAC

Raises OlmSasError on failure.

r   )r	   r   Úolm_sas_mac_lengthr#   r   r   r.   Úolm_sas_calculate_macr0   rJ   r?   r8   ©r'   ÚmessagerQ   Úbyte_messagerS   Ú
mac_lengthÚ
mac_buffers   &&&    r   Úcalculate_macÚSas.calculate_mac³   s¦   € ô   Ó(ˆÜ˜ZÓ(ˆ	ä×+Ò+¨D¯I©IÓ6ˆ
Ü—W’W˜X zÓ2ˆ
à×ÑÜ×%Ò%Ø—	‘	Ü—’ Ó-Ü�LÓ!Ü—’ 	Ó*Ü�I“ØØóô
	
ô �zŠz˜*Ó1×8Ñ8Ó:Ð:r   c                óÂ  € \        V4      p\        V4      p\        P                  ! V P                  4      p\        P
                  ! RV4      pV P                  \        P                  ! V P                  \        P                  ! V4      \        V4      \        P                  ! V4      \        V4      VV4      4       \        P                  ! We4      P                  4       # )af  Generate a message authentication code based on the shared secret.

This function uses a fixed base64 encoding that is compatible with
other base64 implementations.

Args:
    message (str): The message to produce the authentication code for.
    extra_info (str): Extra information to mix in when generating the
        MAC

Raises OlmSasError on failure.

r   )r	   r   rX   r#   r   r   r.   Ú"olm_sas_calculate_mac_fixed_base64r0   rJ   r?   r8   rZ   s   &&&    r   Úcalculate_mac_fixed_base64ÚSas.calculate_mac_fixed_base64Ò   s¦   € ô   Ó(ˆÜ˜ZÓ(ˆ	ä×+Ò+¨D¯I©IÓ6ˆ
Ü—W’W˜X zÓ2ˆ
à×ÑÜ×2Ò2Ø—	‘	Ü—’ Ó-Ü�LÓ!Ü—’ 	Ó*Ü�I“ØØóô
	
ô �zŠz˜*Ó1×8Ñ8Ó:Ð:r   c                óÂ  € \        V4      p\        V4      p\        P                  ! V P                  4      p\        P
                  ! RV4      pV P                  \        P                  ! V P                  \        P                  ! V4      \        V4      \        P                  ! V4      \        V4      VV4      4       \        P                  ! We4      P                  4       # )am  Generate a message authentication code based on the shared secret.

This function should not be used unless compatibility with an older
non-tagged Olm version is required.

Args:
    message (str): The message to produce the authentication code for.
    extra_info (str): Extra information to mix in when generating the
        MAC

Raises OlmSasError on failure.

r   )r	   r   rX   r#   r   r   r.   Úolm_sas_calculate_mac_long_kdfr0   rJ   r?   r8   rZ   s   &&&    r   Úcalculate_mac_long_kdfÚSas.calculate_mac_long_kdfô   s¦   € ô   Ó(ˆÜ˜ZÓ(ˆ	ä×+Ò+¨D¯I©IÓ6ˆ
Ü—W’W˜X zÓ2ˆ
à×ÑÜ×.Ò.Ø—	‘	Ü—’ Ó-Ü�LÓ!Ü—’ 	Ó*Ü�I“ØØóô
	
ô �zŠz˜*Ó1×8Ñ8Ó:Ð:r   )r!   r#   r   )r   r   r   r   r   r+   r%   r.   ÚpropertyrB   rF   r&   rU   r_   rc   rg   r   Ú__classdictcell__)Ú__classdict__s   @r   r   r   4   s`   ø‡ € Ù8ô6ò0
ò&ð ñAó ðAð& ñ<ó ð<ò
ò0.ò>;ò> ;÷D ;ð  ;r   r   N)r   Úbuiltinsr   Ú	functoolsr   Útypingr   Ú_libolmr   r   Ú_compatr   r   r	   Ú	_finalizer
   r   Ú	Exceptionr   Úobjectr   r   r   r   Ú<module>rt      s@   ðñ"õ  Ý Ý ç ç 4Ñ 4Ý -òô
&�)ô &ô`;ˆ&ö `;r   