
    j
                     |    S r SSKrSSKrSSKJr   " S S\5      r " S S\5      r " S S	\5      r " S
 S\5      r	g)zImplements data model for the library.

This module implements basic data model objects that are necessary
for interacting with the Security Key as well as for implementing
the higher level components of the U2F protocol.
    N)errorsc                   2    \ rS rSrSrSrSrS rS rS r	Sr
g	)

ClientData   zQFIDO U2F ClientData.

Implements the ClientData object of the FIDO U2F protocol.
znavigator.id.getAssertionznavigator.id.finishEnrollmentc                     U[         R                  [         R                  4;  a  [        R                  " 5       eXl        X l        X0l        g N)r   TYP_REGISTRATIONTYP_AUTHENTICATIONr   InvalidModelErrortypraw_server_challengeorigin)selfr   r   r   s       &platform/bq/third_party/pyu2f/model.py__init__ClientData.__init__%   s:    
:..
0M0MNN$$&&H 4K    c                     [         R                  " U R                  5      R                  5       nUR	                  S5      n[
        R                  " U R                  UU R                  S.SS9$ )z=Returns JSON version of ClientData compatible with FIDO spec.=)r   	challenger   T)	sort_keys)	base64urlsafe_b64encoder   decoderstripjsondumpsr   r   )r   server_challenge_b64s     r   GetJsonClientData.GetJson,   sa     "33!!##)68 /66s;::dhh$8!%.9=? ?r   c                 "    U R                  5       $ r   )r   )r   s    r   __repr__ClientData.__repr__:   s    <<>r   )r   r   r   N)__name__
__module____qualname____firstlineno____doc__r
   r	   r   r   r"   __static_attributes__ r   r   r   r      s$     34?r   r   c                       \ rS rSrSS jrSrg)RegisteredKey>   c                     Xl         X l        g r   
key_handleversion)r   r0   r1   s      r   r   RegisteredKey.__init__@   s     OLr   r/   N)U2F_V2r$   r%   r&   r'   r   r)   r*   r   r   r,   r,   >   s    r   r,   c                       \ rS rSrS rSrg)RegisterResponseE   c                     Xl         X l        g r   )registration_dataclient_data)r   r9   r:   s      r   r   RegisterResponse.__init__G   s    ."r   )r:   r9   Nr4   r*   r   r   r6   r6   E   s    #r   r6   c                       \ rS rSrS rSrg)SignResponseL   c                 (    Xl         X l        X0l        g r   )r0   signature_datar:   )r   r0   r@   r:   s       r   r   SignResponse.__init__N   s     O("r   )r:   r0   r@   Nr4   r*   r   r   r=   r=   L   s    #r   r=   )
r(   r   r   pyu2fr   objectr   r,   r6   r=   r*   r   r   <module>rD      sF        BF #v ##6 #r   