2024-05-24 10:38:48 +00:00
|
|
|
import json
|
2024-05-24 20:16:58 +00:00
|
|
|
import argparse
|
|
|
|
from verify import verify_vc
|
2024-05-24 10:38:48 +00:00
|
|
|
|
|
|
|
|
2024-05-24 20:16:58 +00:00
|
|
|
def get_presentation(path_presentation):
|
|
|
|
with open(path_presentation, "r") as f:
|
|
|
|
vc = f.read()
|
|
|
|
return vc
|
2024-05-24 10:38:48 +00:00
|
|
|
|
|
|
|
|
2024-05-24 20:16:58 +00:00
|
|
|
def main():
|
|
|
|
parser=argparse.ArgumentParser(description='Verify a presentation')
|
|
|
|
parser.add_argument("presentation_path")
|
|
|
|
args=parser.parse_args()
|
2024-05-24 10:38:48 +00:00
|
|
|
|
2024-05-24 20:16:58 +00:00
|
|
|
if args.presentation_path:
|
|
|
|
presentation = get_presentation(args.presentation_path)
|
|
|
|
presentation_verified = verify_vc(presentation)
|
|
|
|
if not presentation_verified:
|
|
|
|
print(presentation_verified)
|
|
|
|
return
|
2024-05-24 10:38:48 +00:00
|
|
|
|
2024-05-24 20:16:58 +00:00
|
|
|
vp = json.loads(presentation)
|
|
|
|
for vc in vp['verifiableCredential']:
|
|
|
|
vc_str = json.dumps(vc)
|
|
|
|
verified = verify_vc(vc_str)
|
|
|
|
if not verified:
|
|
|
|
print(verified)
|
|
|
|
return
|
2024-05-24 10:38:48 +00:00
|
|
|
|
2024-05-24 20:16:58 +00:00
|
|
|
print(True)
|
|
|
|
return
|
2024-05-24 10:38:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
2024-05-24 20:16:58 +00:00
|
|
|
main()
|