pyvckit #1

Merged
cayop merged 17 commits from pyvckit into release 2024-06-11 15:10:32 +00:00
Showing only changes of commit 2720690320 - Show all commits

View file

@ -12,7 +12,7 @@ from django.http import QueryDict
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
from idhub_auth.models import User from idhub_auth.models import User
from django.db import models from django.db import models
from utils.idhub_ssikit import verify_presentation from pyvckit.verify_vp import verify_vp
SALT_CHARS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" SALT_CHARS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
@ -271,7 +271,7 @@ class OAuth2VPToken(models.Model):
return self.authorization.code return self.authorization.code
def verifing(self): def verifing(self):
self.result_verify = verify_presentation(self.vp_token) self.result_verify = verify_vp(self.vp_token)
def get_result_verify(self): def get_result_verify(self):
if not self.result_verify: if not self.result_verify:
@ -284,8 +284,7 @@ class OAuth2VPToken(models.Model):
"redirect_uri": "", "redirect_uri": "",
"response": "", "response": "",
} }
verification = json.loads(self.result_verify) if not self.result_verify:
if verification.get('errors') or verification.get('warnings'):
response["verify"] = "Error, {}".format(_("Failed verification")) response["verify"] = "Error, {}".format(_("Failed verification"))
return response return response