§
   ŽOü¤c¨Aã                   óJ   — d Z ddlmZmZ dZdd„Zdd„Zdd„Zd„ Zd	„ Z	dd
„Z
dS )a–  Keys and logins of the account written into the device's own (hidden) settings (S5, T8, T9).

The server sends them by addon setting id; a secret id it does not send is not in the account and is cleared here.
The Webshare session `token` is the device's own (T9): it is cleared when the login changes, so the addon's existing
re-login runs with the account's username and password. Values are never logged.é    )ÚschemaÚstate)ÚtokenÚvinyl_statusNc                 óŠ  — dd l }|                     t          j        ¦  «        }t	          j        ¦   «         pg }|                     d¦  «        |                     d¦  «        f}d}|D ]Z}t          |                      |¦  «        pd¦  «        }|                     |¦  «        |k    r| 	                    ||¦  «         |dz  }Œ[|                      d¦  «        �;|                     d¦  «        | d         k    r| 	                    d| d         ¦  «         |                     d¦  «        |                     d¦  «        f|k    r,| 	                    d|                      d¦  «        pd¦  «         nF|                      d¦  «        r1|                     d¦  «        s| 	                    d| d         ¦  «         |rt          |¦  «         |S )Nr   ÚwsuserÚwspassÚ é   r   r   )Ú	xbmcaddonÚAddonr   ÚADDON_IDr   Ú
secret_idsÚ
getSettingÚstrÚgetÚ
setSettingÚrefresh_status)	ÚvaluesÚprevious_loginr   ÚaddonÚidsÚlogin_beforeÚchangedÚsidÚvalues	            úa/Users/chudy/Library/Application Support/Kodi/addons/plugin.video.milionar/wcs/account/secrets.pyÚapplyr      sÃ  € ØÐÐÐØ�OŠO�EœNÑ+Ô+€EÝ
Ô
Ñ
Ô
Ð
# €CØ×$Ò$ XÑ.Ô.°×0@Ò0@ÀÑ0JÔ0JÐK€LØ€GØð ð ˆÝ�F—J’J˜s‘O”OÐ) rÑ*Ô*ˆØ×Ò˜CÑ Ô  EÒ)Ð)Ø×Ò˜S %Ñ(Ô(Ð(Ø�q‰LˆGøØ‡z‚z�.Ñ!Ô!Ð-°%×2BÒ2BÀ>Ñ2RÔ2RÐV\Ð]kÔVlÒ2lÐ2lØ×Ò˜¨°Ô)?Ñ@Ô@Ð@Ø×Ò˜Ñ"Ô" E×$4Ò$4°XÑ$>Ô$>Ð?À<ÒOÐOØ×Ò˜ &§*¢*¨WÑ"5Ô"5Ð";¸Ñ<Ô<Ð<Ð<Ø	�Š�GÑ	Ô	ð 3 U×%5Ò%5°hÑ%?Ô%?ð 3Ø×Ò˜ &¨¤/Ñ2Ô2Ð2Øð Ý�uÑÔÐØ€Nó    c                 óV  — ddl }t          j        ¦   «         sdS | p|                     t          j        ¦  «        } |                      d¦  «        r|                      d¦  «        rdS ddl}ddl}|                     d¦  «        }	 t          | 
                    d¦  «        pd¦  «        }n# t          $ r d}Y nw xY w|                     ¦   «         |z
  dk    rb|                     dt          |                     ¦   «         ¦  «        ¦  «         	 dd	lm} |                     ¦   «          n# t"          $ r Y dS w xY w|                     t          j        ¦  «                             d
¦  «        }|r/|                      d
¦  «        |k    r|                      d
|¦  «         t'          |¦  «        S )zäA signed-in device without its own Webshare login plays with the account's session token (T9). When that token
    is gone from the device or Webshare refused it, the account's keys are fetched again. True: a token is there now.r   NFr   r	   i'  zmilionar.account.ws_restoreé<   )Úsyncr   )r   r   Ú	signed_inr   r   r   ÚtimeÚxbmcguiÚWindowÚfloatÚgetPropertyÚ
ValueErrorÚsetPropertyr   Úwcs.accountr"   Úfetch_secretsÚ	Exceptionr   Úbool)r   r   r$   r%   ÚhomeÚlastr"   r   s           r   Úrestore_webshare_tokenr1   "   sÎ  € ð ÐÐÐÝŒ?ÑÔð ØˆuØÐ4�Y—_’_¥U¤^Ñ4Ô4€EØ×Ò˜Ñ!Ô!ð  e×&6Ò&6°xÑ&@Ô&@ð ØˆuØ€K€K€KØ€N€N€NØ�>Š>˜%Ñ Ô €DðÝ�T×%Ò%Ð&CÑDÔDÐIÈÑJÔJˆˆøÝð ð ð Øˆˆˆðøøøà‡y‚y�{„{�TÑ˜RÒÐØ×ÒÐ6½¸D¿IºI¹K¼KÑ8HÔ8HÑIÔIÐIð	Ø(Ð(Ð(Ð(Ð(Ð(Ø×ÒÑ Ô Ð Ð øÝð 	ð 	ð 	Ø�5�5ð	øøøð �OŠO�EœNÑ+Ô+×6Ò6°wÑ?Ô?€EØð )�×!Ò! 'Ñ*Ô*¨eÒ3Ð3Ø×Ò˜ %Ñ(Ô(Ð(Ý�‰;Œ;Ðs$   Â$B* Â*B9Â8B9ÄD( Ä(
D6Ä5D6c                 óª   — ddl }| p|                     t          j        ¦  «        } t          t
          fD ]}	  || ¦  «         Œ# t          $ r Y Œw xY wdS )z\Statuses, provider flags and Home properties after the keys changed (as after a key window).r   N)r   r   r   r   Ú
_ai_statusÚ
_providersr-   )r   r   Ústeps      r   r   r   @   sx   € àÐÐÐØÐ4�Y—_’_¥U¤^Ñ4Ô4€EÝ�ZÐ(ð ð ˆð	ØˆD�‰KŒKˆKˆKøÝð 	ð 	ð 	ØˆDð	øøøðð s   ·AÁ
AÁAc                 ó<   — ddl m} |                     | ¦  «         d S )Nr   )Úaccounts)Úwcs.air7   Úsync_status)r   r7   s     r   r3   r3   K   s.   € ØÐÐÐÐÐØ×Ò˜ÑÔÐÐÐr   c                 ó<   — ddl m} |                     | ¦  «         d S )Nr   )Úactions)Úwcs.skinr;   Úset_provider_properties)r   r;   s     r   r4   r4   P   s.   € Ø Ð Ð Ð Ð Ð Ø×#Ò# EÑ*Ô*Ð*Ð*Ð*r   c                 óì   — ddl }| p|                     t          j        ¦  «        } t	          t          j        ¦   «         ¦  «        t	          t          ¦  «        z   D ]}|                      |d¦  «         ŒdS )zYSign-out: the account's keys leave the device (the local ones come back from the backup).r   Nr
   )	r   r   r   r   Úlistr   r   ÚDEVICE_ONLYr   )r   r   r   s      r   ÚclearrA   U   sv   € àÐÐÐØÐ4�Y—_’_¥U¤^Ñ4Ô4€EÝ•FÔ%Ñ'Ô'Ñ(Ô(­4µÑ+<Ô+<Ñ<ð "ð "ˆØ×Ò˜˜bÑ!Ô!Ð!Ð!ð"ð "r   )N)Ú__doc__r+   r   r   r@   r   r1   r   r3   r4   rA   © r   r   ú<module>rD      s¨   ððTð Tð
 &Ð %Ð %Ð %Ð %Ð %Ð %Ð %à'€ðð ð ð ð,ð ð ð ð<ð ð ð ð ð  ð  ð
+ð +ð +ð
"ð "ð "ð "ð "ð "r   