diff --git a/idhub/models.py b/idhub/models.py index 116f46c..c0e237a 100644 --- a/idhub/models.py +++ b/idhub/models.py @@ -3,7 +3,6 @@ import pytz import datetime from django.db import models from django.conf import settings -from django.core.cache import cache from django.template.loader import get_template from django.utils.translation import gettext_lazy as _ from nacl import secret @@ -541,13 +540,15 @@ class VerificableCredential(models.Model): if self.status == self.Status.ISSUED: return - self.status = self.Status.ISSUED + # self.status = self.Status.ISSUED + import pdb; pdb.set_trace() self.subject_did = did self.issued_on = datetime.datetime.now().astimezone(pytz.utc) - self.data = sign_credential( + data = sign_credential( self.render(), self.issuer_did.get_key_material() ) + self.data = self.user.encrypt_data(data) def get_context(self): d = json.loads(self.csv_data) diff --git a/idhub/user/views.py b/idhub/user/views.py index e6e28dc..0a273ec 100644 --- a/idhub/user/views.py +++ b/idhub/user/views.py @@ -120,7 +120,7 @@ class CredentialJsonView(MyWallet, TemplateView): pk=pk, user=self.request.user ) - response = HttpResponse(self.object.data, content_type="application/json") + response = HttpResponse(self.object.get_data(), content_type="application/json") response['Content-Disposition'] = 'attachment; filename={}'.format("credential.json") return response