encripted y download credential
This commit is contained in:
parent
10c6d20a10
commit
5dc1577d9e
|
@ -3,7 +3,6 @@ import pytz
|
||||||
import datetime
|
import datetime
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.cache import cache
|
|
||||||
from django.template.loader import get_template
|
from django.template.loader import get_template
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from nacl import secret
|
from nacl import secret
|
||||||
|
@ -541,13 +540,15 @@ class VerificableCredential(models.Model):
|
||||||
if self.status == self.Status.ISSUED:
|
if self.status == self.Status.ISSUED:
|
||||||
return
|
return
|
||||||
|
|
||||||
self.status = self.Status.ISSUED
|
# self.status = self.Status.ISSUED
|
||||||
|
import pdb; pdb.set_trace()
|
||||||
self.subject_did = did
|
self.subject_did = did
|
||||||
self.issued_on = datetime.datetime.now().astimezone(pytz.utc)
|
self.issued_on = datetime.datetime.now().astimezone(pytz.utc)
|
||||||
self.data = sign_credential(
|
data = sign_credential(
|
||||||
self.render(),
|
self.render(),
|
||||||
self.issuer_did.get_key_material()
|
self.issuer_did.get_key_material()
|
||||||
)
|
)
|
||||||
|
self.data = self.user.encrypt_data(data)
|
||||||
|
|
||||||
def get_context(self):
|
def get_context(self):
|
||||||
d = json.loads(self.csv_data)
|
d = json.loads(self.csv_data)
|
||||||
|
|
|
@ -120,7 +120,7 @@ class CredentialJsonView(MyWallet, TemplateView):
|
||||||
pk=pk,
|
pk=pk,
|
||||||
user=self.request.user
|
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")
|
response['Content-Disposition'] = 'attachment; filename={}'.format("credential.json")
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue