+
    BÆÚj÷8  ã                   ó  € R t ^ RIHt ^ RIHtHt ^ RIHtHt ^RI	H
t
HtHt ^RIHt  ! R R]4      t ! R R	]4      t ! R
 R]4      tR t ! R R]4      t ! R R]4      tR t ! R R]4      tR t ! R R]4      tR# )aß  libolm PK module.

This module contains bindings to the PK part of the Olm library.
It contains two classes PkDecryption and PkEncryption that are used to
establish an encrypted communication channel using public key encryption,
as well as a class PkSigning that is used to sign a message.

Examples:
    >>> decryption = PkDecryption()
    >>> encryption = PkEncryption(decryption.public_key)
    >>> plaintext = "It's a secret to everybody."
    >>> message = encryption.encrypt(plaintext)
    >>> decrypted_plaintext = decryption.decrypt(message)
    >>> seed = PkSigning.generate_seed()
    >>> signing = PkSigning(seed)
    >>> signature = signing.sign(plaintext)
    >>> ed25519_verify(signing.public_key, plaintext, signature)

)Úsuper)ÚAnyStrÚType)ÚffiÚlib)ÚURANDOMÚto_bytearrayÚto_unicode_str)Útrack_for_finalizationc                   ó   € ] tR t^-tRtRtR# )ÚPkEncryptionErrorzlibolm Pk encryption exception.© N©Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú__static_attributes__r   ó    Ú}/opt/data/installs/351f81cc06284494/environments/aa258815729c481f8402f54f4c368f83/venv/lib/python3.14/site-packages/olm/pk.pyr   r   -   ó   † Ý)r   r   c                   ó   € ] tR t^1tRtRtR# )ÚPkDecryptionErrorzlibolm Pk decryption exception.r   Nr   r   r   r   r   r   1   r   r   r   c                   ó   € ] tR t^5tRtRtR# )ÚPkSigningErrorzlibolm Pk signing exception.r   Nr   r   r   r   r   r   5   s   † Ý&r   r   c                 ó2   € \         P                  ! V 4       R # ©N)r   Úolm_clear_pk_encryption©Ú	pk_structs   &r   Ú_clear_pk_encryptionr!   9   ó   € Ü×Ò 	Ö*r   c                   ó*   a € ] tR t^=t o RtR tRtV tR# )Ú	PkMessagezA PK encrypted message.c                ó*   € Wn         W n        W0n        R# )aA  Create a new PK encrypted message.

Args:
    ephemeral_key(str): the public part of the ephemeral key
    used (together with the recipient's key) to generate a symmetric
    encryption key.
    mac(str): Message Authentication Code of the encrypted message
    ciphertext(str): The cipher text of the encrypted message
N)Úephemeral_keyÚmacÚ
ciphertext)Úselfr&   r'   r(   s   &&&&r   Ú__init__ÚPkMessage.__init__@   s   € ð +ÔØŒØ$Žr   )r(   r&   r'   N)r   r   r   r   r   r*   r   Ú__classdictcell__©Ú__classdict__s   @r   r$   r$   =   s   ø‡ € Ù!÷%ð %r   r$   c                   ó6   a € ] tR t^Pt o RtR tR tR tRtV t	R# )ÚPkEncryptionzOPkEncryption class.

Represents the decryption part of a PK encrypted channel.
c                óê  € V'       g   \        R4      h\        P                  ! R\        P                  ! 4       4      V n        \        P                  ! V P
                  4      V n        \        W P                  \        4       \        V4      p\        P                  ! V P                  \        P                  ! V4      \        V4      4       W!Jd#   \        ^ \        V4      4       F  p^ W#&   K	  	  R# R# )zpCreate a new PK encryption object.

Args:
    recipient_key(str): a public key that will be used for encryption
zRecipient key can't be emptyúchar[]N)Ú
ValueErrorr   Únewr   Úolm_pk_encryption_sizeÚ_bufÚolm_pk_encryptionÚ_pk_encryptionr
   r!   r   Ú#olm_pk_encryption_set_recipient_keyÚfrom_bufferÚlenÚrange)r)   Úrecipient_keyÚbyte_keyÚis   &&  r   r*   ÚPkEncryption.__init__V   s³   € ÷ ÜÐ;Ó<Ð<ä—G’G˜H¤c×&@Ò&@Ó&BÓCˆŒ	Ü!×3Ò3°D·I±IÓ>ˆÔÜ˜t×%8Ñ%8Ô:NÔOä Ó.ˆÜ×/Ò/Ø×ÑÜ�OŠO˜HÓ%Ü�‹Mô	
ð Ó(Ü˜1œc (›mÖ,�Ø�“ó -ñ )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_pk_encryption_last_errorr8   Údecoder   ©r)   ÚretÚ
last_errors   && r   Ú_check_errorÚPkEncryption._check_errorp   óL   € à”#—-’-“/Ô!Ùä—Z’ZÜ×,Ò,¨T×-@Ñ-@ÓAó
ç
‰&‹(ð 	ô   
Ó+Ð+r   c                ó  € \        V4      p\        P                  ! V P                  4      p\	        V4      p\
        P                  ! RV4      p\        P                  ! V P                  \        V4      4      p\
        P                  ! RV4      p\        P                  ! V P                  4      p\
        P                  ! RV4      p	\        P                  ! 4       p
\
        P                  ! RV
4      p\        P                  ! V P                  \
        P                  ! V4      \        V4      WvW˜WºWS4      p V P                  V4       W!Jd!   \        ^ \        V4      4       F  p^ W-&   K	  	  \        \
        P                   ! Yº4      P#                  4       \
        P                   ! Y˜4      P#                  4       \
        P                   ! Yv4      P#                  4       4      pT#   Y!Jd"   \        ^ \        T4      4       F  p^ Y-&   K	  	  i i ; i)z“Encrypt a message.

Returns the encrypted PkMessage.

Args:
    plaintext(str): A string that will be encrypted using the
    PkEncryption object.
r2   )r   r   Úolm_pk_encrypt_random_lengthr8   r   r   r4   Úolm_pk_ciphertext_lengthr;   Úolm_pk_mac_lengthÚolm_pk_key_lengthÚolm_pk_encryptr:   rI   r<   r$   ÚunpackrE   )r)   Ú	plaintextÚbyte_plaintextÚr_lengthÚrandomÚrandom_bufferÚciphertext_lengthr(   Ú
mac_lengthr'   Úephemeral_key_sizer&   rG   r?   Úmessages   &&             r   ÚencryptÚPkEncryption.encrypt{   s¨  € ô & iÓ0ˆä×3Ò3°D×4GÑ4GÓHˆÜ˜Ó"ˆÜŸš ¨&Ó1ˆä×8Ò8Ø×Ñ¤ ^Ó!4ó
Ðô —W’W˜XÐ'8Ó9ˆ
ä×*Ò*¨4×+>Ñ+>Ó?ˆ
Ü�gŠg�h 
Ó+ˆä ×2Ò2Ó4ÐÜŸš Ð*<Ó=ˆä× Ò Ø×ÑÜ�OŠO˜NÓ+¬S°Ó-@ØØØØó
ˆð	*Ø×Ñ˜cÔ"ð Ó.Ü˜q¤# nÓ"5Ö6�AØ()�NÓ%ñ 7ô Ü�JŠJ�}Ó9×@Ñ@ÓBÜ�JŠJ�sÓ'×.Ñ.Ó0Ü�JŠJ�zÓ5×<Ñ<Ó>ó
ˆð
 ˆøð Ó.Ü˜q¤# nÓ"5Ö6�AØ()�NÓ%ò 7ð /ús   Ä6G! ÅG! Ç!(H	)r6   r8   N)
r   r   r   r   r   r*   rI   r\   r   r,   r-   s   @r   r0   r0   P   s   ø‡ € ñò
 ò4	,÷1ð 1r   r0   c                 ó2   € \         P                  ! V 4       R # r   )r   Úolm_clear_pk_decryptionr   s   &r   Ú_clear_pk_decryptionr`   ¯   r"   r   c                   ój   a a€ ] tR t^³t oRtV 3R ltR tR tR	R lt]	R	R l4       t
R
R ltRtVtV ;t# )ÚPkDecryptionzÞPkDecryption class.

Represents the decryption part of a PK encrypted channel.

Attributes:
    public_key (str): The public key of the PkDecryption object, can be
        shared and used to create a PkEncryption object.

c                ó$  <€ \        4       P                  V 4      p\        P                  ! R \        P
                  ! 4       4      Vn        \        P                  ! VP                  4      Vn        RVn	        \        WP                  \        4       V# )r2   N)r   Ú__new__r   r4   r   Úolm_pk_decryption_sizer6   Úolm_pk_decryptionÚ_pk_decryptionÚ
public_keyr
   r`   )ÚclsÚobjÚ	__class__s   & €r   rd   ÚPkDecryption.__new__¾   sb   ø€ ä‹g�o‰o˜cÓ"ˆÜ—7’7˜8¤S×%?Ò%?Ó%AÓBˆŒÜ ×2Ò2°3·8±8Ó<ˆÔØˆŒÜ˜s×$6Ñ$6Ô8LÔMØˆ
r   c                óˆ  €  \        P                  ! 4       p\        T4      p\        P
                  ! RT4      p\        P                  ! 4       p\        P
                  ! RT4      p\        P                  ! T P                   YTY14      pT P                  T4       \        P                  ! TT4      P                  4       T n        R# )Fr2   N)rg   r   Úolm_pk_private_key_lengthr   r   r4   rP   Úolm_pk_key_from_privaterI   rR   rE   rh   )r)   Úrandom_lengthrV   rW   Ú
key_lengthÚ
key_bufferrG   s   &      r   r*   ÚPkDecryption.__init__Ç   sž   € Øô ×5Ò5Ó7ˆÜ˜Ó'ˆÜŸš ¨&Ó1ˆä×*Ò*Ó,ˆ
Ü—W’W˜X zÓ2ˆ
ä×)Ò)Ø×ÑØØó
ˆð
 	×Ñ˜#ÔÜ"ŸzšzØØó 
÷ ‰&‹(ð 	Žr   c                óÔ   € V\         P                  ! 4       8w  d   R # \        P                  ! \         P                  ! V P
                  4      4      P                  4       p\        V4      hr   )r   rB   r   rC   Úolm_pk_decryption_last_errorrg   rE   r   rF   s   && r   rI   ÚPkDecryption._check_errorÝ   rK   r   c                óà  € \        V4      p\        P                  ! V P                  4      p\        P
                  ! RV4      p\        P                  ! V P                  \        P                  ! V4      \        V4      WC4      p V P                  V4       \        ^ \        V4      4       F  p^ W&&   K	  	  \        P                  ! WC4      #   \        ^ \        T4      4       F  p^ Y&&   K	  	  i ; i)a4  Store a PkDecryption object.

Stores a PkDecryption object as a base64 string. Encrypts the object
using the supplied passphrase. Returns a byte object containing the
base64 encoded string of the pickled session.

Args:
    passphrase(str, optional): The passphrase to be used to encrypt
        the object.
r2   )r   r   Úolm_pickle_pk_decryption_lengthrg   r   r4   Úolm_pickle_pk_decryptionr:   r;   rI   r<   rR   )r)   Ú
passphraser>   Úpickle_lengthÚpickle_bufferrG   r?   s   &&     r   ÚpickleÚPkDecryption.pickleè   sÉ   € ô   
Ó+ˆä×;Ò;Ø×Ñó
ˆô Ÿš ¨-Ó8ˆä×*Ò*Ø×ÑÜ�OŠO˜HÓ%¤s¨8£}Øó
ˆð
	 Ø×Ñ˜cÔ"ô ˜1œc (›mÖ,�Ø�“ñ -ô �zŠz˜-Ó7Ð7øô ˜1œc (›mÖ,�Ø�“ò -ús   ÂC Ã"C-c           	     ó‚  € V'       g   \        R4      h\        V4      p\        P                  ! RV4      p\        P
                  ! 4       p\        P                  ! RV4      pV P                  V 4      p\        P                  ! VP                  \        P                  ! V4      \        V4      V\        V4      We4      p VP                  V4       \        ^ \        V4      4       F  p	^ W9&   K	  	  \        P                  ! VV4      P                  4       Vn        V#   \        ^ \        T4      4       F  p	^ Y9&   K	  	  i ; i)ab  Restore a previously stored PkDecryption object.

Creates a PkDecryption object from a pickled base64 string. Decrypts
the pickled object using the supplied passphrase.
Raises PkDecryptionError on failure. If the passphrase
doesn't match the one used to encrypt the session then the error
message for the exception will be "BAD_ACCOUNT_KEY". If the base64
couldn't be decoded then the error message will be "INVALID_BASE64".

Args:
    pickle(bytes): Base64 encoded byte string containing the pickled
        PkDecryption object
    passphrase(str, optional): The passphrase used to encrypt the
        object
zPickle can't be emptyr2   )r3   r   r   r4   r   rP   rd   Úolm_unpickle_pk_decryptionrg   r:   r;   rI   r<   rR   rE   rh   )
ri   r}   rz   r>   r|   Úpubkey_lengthÚpubkey_bufferrj   rG   r?   s
   &&&       r   Úfrom_pickleÚPkDecryption.from_pickle	  s
  € ÷$ ÜÐ4Ó5Ð5ä 
Ó+ˆÜŸš ¨&Ó1ˆä×-Ò-Ó/ˆÜŸš ¨-Ó8ˆà�k‰k˜#Óˆä×,Ò,Ø×ÑÜ�OŠO˜HÓ%¤s¨8£}Øœ3˜v›;Øó	*ˆð	 Ø×Ñ˜SÔ!ä˜1œc (›mÖ,�Ø�“ñ -ô ŸšØØó
÷ ‰&‹(ð 	Œð
 ˆ
øô ˜1œc (›mÖ,�Ø�“ò -ús   Â?D Ä"D>c                ó�  € \        VP                  4      p\        V4      p\        VP                  4      p\        V4      p\        VP                  4      p\        V4      p\
        P                  ! V P                  V4      p	\        P                  ! RV	4      p
\
        P                  ! V P                  \        P                  ! V4      V\        P                  ! V4      V\        P                  ! V4      VW©4	      pV P                  V4       \        P                  ! V
V4      p\
        P                  ! V
^ V	4       \        WÂR7      # )aw  Decrypt a previously encrypted Pk message.

Returns the decrypted plaintext.
Raises PkDecryptionError on failure.

Args:
    message(PkMessage): the pk message to decrypt.
    unicode_errors(str, optional): The error handling scheme to use for
        unicode decoding errors. The default is "replace" meaning that
        the character that was unable to decode will be replaced with
        the unicode replacement character (U+FFFD). Other possible
        values are "strict", "ignore" and "xmlcharrefreplace" as well
        as any other name registered with codecs.register_error that
        can handle UnicodeEncodeErrors.
r2   )Úerrors)r   r&   r;   r'   r(   r   Úolm_pk_max_plaintext_lengthrg   r   r4   Úolm_pk_decryptr:   rI   rR   Úmemsetr	   )r)   r[   Úunicode_errorsr&   rZ   r'   rY   r(   rX   Úmax_plaintext_lengthÚplaintext_bufferrG   rS   s   &&&          r   ÚdecryptÚPkDecryption.decrypt9  s  € ô" % W×%:Ñ%:Ó;ˆÜ  Ó/Ðä˜7Ÿ;™;Ó'ˆÜ˜“Xˆ
ä! '×"4Ñ"4Ó5ˆ
Ü 
›OÐä"×>Ò>Ø×ÑØó 
Ðô Ÿ7š7 8Ð-AÓBÐä× Ò Ø×ÑÜ�OŠO˜MÓ*Ð,>Ü�OŠO˜CÓ  *Ü�OŠO˜JÓ'Ð):Øó4ˆð 	×Ñ˜#Ôä—Z’ZØØó
ˆ	ô 	�
Š
Ð# QÐ(<Ô=ä˜iÔ?Ð?r   )rg   rh   )Ú )Úreplace)r   r   r   r   r   rd   r*   rI   r}   Úclassmethodrƒ   r�   r   r,   Ú__classcell__)rk   r.   s   @@r   rb   rb   ³   s@   ù‡ € ñõòò,	,ô8ðB ó-ó ð-÷^0@ô 0@r   rb   c                 ó2   € \         P                  ! V 4       R # r   )r   Úolm_clear_pk_signingr   s   &r   Ú_clear_pk_signingr•   l  s   € Ü×Ò˜YÖ'r   c                   óF   a € ] tR tRt o RtR tR t]R 4       tR t	Rt
V tR# )	Ú	PkSigningip  zÓPkSigning class.

Signs messages using public key cryptography.

Attributes:
    public_key (str): The public key of the PkSigning object, can be
        shared and used to verify using Utility.ed25519_verify.

c           	     óœ  € V'       g   \        R4      h\        P                  ! R\        P                  ! 4       4      V n        \        P                  ! V P
                  4      V n        \        W P                  \        4       \        P                  ! RV4      p\        P                  ! 4       p\        P                  ! RV4      p\        P                  ! V P                  WCV\        V4      4      p\        P                  ! V^ \        V4      4       V P                  V4       \        P                  ! WC4      P!                  4       V n        R# )zÎCreate a new signing object.

Args:
    seed(bytes): the seed to use as the private key for signing.  The
        seed must have the same length as the seeds generated by
        PkSigning.generate_seed().
zseed can't be emptyr2   N)r3   r   r4   r   Úolm_pk_signing_sizer6   Úolm_pk_signingÚ_pk_signingr
   r•   Ú olm_pk_signing_public_key_lengthÚolm_pk_signing_key_from_seedr;   r‰   rI   rR   rE   rh   )r)   ÚseedÚseed_bufferr�   r‚   rG   s   &&    r   r*   ÚPkSigning.__init__{  sæ   € ÷ ÜÐ2Ó3Ð3ä—G’G˜H¤c×&=Ò&=Ó&?Ó@ˆŒ	Ü×-Ò-¨d¯i©iÓ8ˆÔÜ˜t×%5Ñ%5Ô7HÔIä—g’g˜h¨Ó-ˆä×<Ò<Ó>ˆÜŸš ¨-Ó8ˆä×.Ò.Ø×ÑØØœ˜T›ó
ˆô 	�
Š
�; ¤3 t£9Ô-à×Ñ˜#ÔäŸ*š* ]ÓB×IÑIÓKˆŽr   c                óÔ   € V\         P                  ! 4       8w  d   R # \        P                  ! \         P                  ! V P
                  4      4      P                  4       p\        V4      hr   )r   rB   r   rC   Úolm_pk_signing_last_errorr›   rE   r   rF   s   && r   rI   ÚPkSigning._check_error�  sF   € à”#—-’-“/Ô!Ùä—Z’Z¤× =Ò =¸d×>NÑ>NÓ OÓP×WÑWÓYˆ
ä˜ZÓ(Ð(r   c                óF   € \         P                  ! 4       p\        V4      pV# )z Generate a random seed.
        )r   Úolm_pk_signing_seed_lengthr   )ri   rp   rV   s   &  r   Úgenerate_seedÚPkSigning.generate_seed¦  s!   € ô
 ×6Ò6Ó8ˆÜ˜Ó'ˆàˆr   c                óZ  € \        V4      p\        P                  ! 4       p\        P                  ! RV4      p\        P
                  ! V P                  \        P                  ! V4      \        V4      WC4      pV P                  V4       \        P                  ! WC4      P                  4       # )zwSign a message

Returns the signature.
Raises PkSigningError on failure.

Args:
    message(str): the message to sign.
r2   )r   r   Úolm_pk_signature_lengthr   r4   Úolm_pk_signr›   r:   r;   rI   rR   rE   )r)   r[   Úbytes_messageÚsignature_lengthÚsignature_bufferrG   s   &&    r   ÚsignÚPkSigning.sign°  s…   € ô % WÓ-ˆä×6Ò6Ó8ÐÜŸ7š7 8Ð-=Ó>Ðä�oŠoØ×ÑÜ�OŠO˜MÓ*¬C°Ó,>Øó0ˆð 	×Ñ˜#Ôä�zŠzÐ*Ó=×DÑDÓFÐFr   )r6   r›   rh   N)r   r   r   r   r   r*   rI   r‘   r¦   r®   r   r,   r-   s   @r   r—   r—   p  s6   ø‡ € ñò LòD)ð ñó ð÷Gð Gr   r—   N)r   Úbuiltinsr   Útypingr   r   Ú_libolmr   r   Ú_compatr   r   r	   Ú	_finalizer
   Ú	Exceptionr   r   r   r!   Úobjectr$   r0   r`   rb   r•   r—   r   r   r   Ú<module>r·      s�   ðñ õ( ß ç ç :Ñ :Ý -ô*˜	ô *ô*˜	ô *ô'�Yô 'ò+ô%�ô %ô&\�6ô \ò~+ôv@�6ô v@òr(ôUG�ö UGr   