change verify_presentation for verify_vp

This commit is contained in:
Cayo Puigdefabregas 2024-06-06 13:49:15 +02:00
parent 1651667717
commit 2720690320
1 changed files with 9 additions and 10 deletions

View File

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