
    F/j                     b    d dl Z d dlZd dlZd dlmZ d dlmZmZmZ d Z	d Z
edk(  r e
        yy)    N)serialization)Vapid01Vapid02b64urlencodec                 N    	 t        |       S # t        $ r t        |       cY S w xY w)N)input	NameError	raw_input)prompts    K/var/www/html/maxservice/venv/lib/python3.12/site-packages/py_vapid/main.pyr   r      s+    !V} !  !s   
 $$c                     t        j                  d      } | j                  ddd       | j                  ddd	d
d       | j                  ddddd       | j                  dddd
d       | j                  ddd
d       | j                  ddd
d       | j                  ddd
d       | j                  dddd       | j                         }t        }|j
                  rt        }|j                  s)t        j                  j                  |j                        s|j                  sSt        d       d }|d vrBt        d!      }|sd"}|j                         d#   }|d$k(  rt        d%       t        d&       |d vrB ||'      }|j!                          t        d(       |j#                  d       t        d)       |j%                  d*       |j'                  |j                        }|j(                  }t+               }|j,                  ro|j.                  j1                  t2        j4                  j6                  t2        j8                  j:                        }t        d+j=                  t?        |                   |rt        j                  j                  |      s0t        d,j=                  |             t        d-       t        d&       	 tA        jB                  tE        |      jG                               }|jI                  |j)                  |             |j@                  rt        tA        jN                  |             y t        d/       |jQ                         D ]   \  }
}t        d0j=                  |
|             " t        d1       y y # tJ        $ r*}	t        d.j=                  tM        |	                   |	d }	~	ww xY w)2Nz
VAPID tool)descriptionz--signz-szclaims file to sign)helpz--genz-gzgenerate new key pairsF
store_true)r   defaultactionz
--version2z-2zuse RFC8292 VAPID specTz
--version1z-1zuse VAPID spec Draft-01z--jsonzdump as jsonz--no-strictzDo not be strict about "sub"z--applicationServerKeyzshow applicationServerKey valuez--private-keyz-kzprivate key pem filezprivate_key.pem)r   r   zNo private key file found.)ynz+Do you want me to create one for you? (Y/n)r   r   r   z"Sorry, can't do much for you then.   )confzGenerating private_key.pemzGenerating public_key.pemzpublic_key.pemzApplication Server Key = {}

zNo {} file found.aO  
The claims file should be a JSON formatted file that holds the
information that describes you. There are three elements in the claims
file you'll need:

    "sub" This is your site's admin email address
          (e.g. "mailto:admin@example.com")
    "exp" This is the expiration time for the claim in seconds. If you don't
          have one, I'll add one that expires in 24 hours.

You're also welcome to add additional fields to the claims which could be
helpful for the Push Service operations team to pass along to your operations
team (e.g. "ami-id": "e-123456", "cust-id": "a3sfa10987"). Remember to keep
these values short to prevent some servers from rejecting the transaction due
to overly large headers. See https://jwt.io/introduction/ for details.

For example, a claims.json file could contain:

{"sub": "mailto:admin@example.com"}
zCrap, something went wrong: {}z/Include the following headers in your request:
z{}: {}

))argparseArgumentParseradd_argument
parse_argsr   version1r   genospathexistsprivate_keyprintr   lowerexitgenerate_keyssave_keysave_public_key	from_filesigndictapplicationServerKey
public_keypublic_bytesr   EncodingX962PublicFormatUncompressedPointformatr   jsonloadsopenreadupdate	Exceptionreprdumpsitems)parserargsVapidanswervapid
claim_fileresultraw_pubclaimsexckeyvalues               r   mainrH      sc   $$>F
$-BC
,D %l  <
d1I $\  ;
d1J %l  <
 %l  <
,J %l  <
0> %l  < 4J 1  3D E}}xxrww~~d&6&67xx./F
* MN F*S=>?G 
* 4 *+())*./OOD,,-EJVF  ""//&&++**<< 	/66!# 	$ww~~j)%,,Z89  ( G	ZZZ 0 5 5 78FMM%**V,- 99$**V$%@A ,,. 	1JC*##C/0	1dI 6  	299$s)DEI	s   AN 	O%N==O__main__)r   r   r3   cryptography.hazmat.primitivesr   py_vapidr   r   r   r   rH   __name__     r   <module>rO      s9   
  	  8 3 3!Xv zF rN   