This repository was archived by the owner on Jan 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfetcher.py
More file actions
executable file
·58 lines (43 loc) · 1.3 KB
/
fetcher.py
File metadata and controls
executable file
·58 lines (43 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/python
import eoskey
import coov_api
import vc_util
import configparser
import os
import tempfile
import webbrowser
if os.path.isfile('coov.ini'):
print("Config file already exists")
exit()
if not (authpage := coov_api.getauthpage()):
print("Cannot get auth page")
exit()
tmpf = tempfile.NamedTemporaryFile('w', suffix='.html')
tmpf.write(authpage)
tmpf.flush()
webbrowser.open_new('file://' + tmpf.name)
print("Paste authentication token here")
token = input("token >>> ").strip()
if not coov_api.checktoken(token):
print("Invalid token")
exit()
privkey, pubkey = eoskey.eos_keygen()
config = configparser.ConfigParser()
config['Key'] = {}
config['VC'] = {}
config['Key']['private'] = privkey
config['Key']['public'] = pubkey
config['Key']['token'] = token
vc_personal = coov_api.getvc_v1(token, vc_util.did_append(pubkey), 'personal')
for vc in vc_personal:
config['VC'][vc['type']] = vc['vc']
coov_api.resetvc_vaccine(token)
vc_vaccine = coov_api.getvc_vaccine(token, vc_util.did_append(pubkey))['VCs']
for vc in vc_vaccine:
vaccine_vc_cs = vc_util.vc_verify(vc)['vc']['credentialSubject']
vaccine = vaccine_vc_cs['vaccine']
dose = vaccine_vc_cs['doseNum']
config['VC'][f'{vaccine}_{dose}'] = vc
with open('coov.ini', 'w') as f:
config.write(f)
print("Done!")