encrypt admin dids with secret_key
This commit is contained in:
parent
7a9017563a
commit
1e4323673c
|
@ -535,7 +535,10 @@ class VerificableCredential(models.Model):
|
||||||
self.status = self.Status.ISSUED
|
self.status = self.Status.ISSUED
|
||||||
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)
|
||||||
issuer_pass = cache.get("KEY_DIDS")
|
issuer_pass = self.user.decrypt_data(
|
||||||
|
cache.get("KEY_DIDS"),
|
||||||
|
settings.SECRET_KEY,
|
||||||
|
)
|
||||||
data = sign_credential(
|
data = sign_credential(
|
||||||
self.render(),
|
self.render(),
|
||||||
self.issuer_did.get_key_material(issuer_pass)
|
self.issuer_did.get_key_material(issuer_pass)
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from django.urls import reverse_lazy
|
from django.urls import reverse_lazy
|
||||||
|
from django.conf import settings
|
||||||
from django.core.cache import cache
|
from django.core.cache import cache
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from django.contrib.auth import views as auth_views
|
from django.contrib.auth import views as auth_views
|
||||||
|
@ -30,7 +31,11 @@ class LoginView(auth_views.LoginView):
|
||||||
if not user.is_anonymous and user.is_admin:
|
if not user.is_anonymous and user.is_admin:
|
||||||
admin_dashboard = reverse_lazy('idhub:admin_dashboard')
|
admin_dashboard = reverse_lazy('idhub:admin_dashboard')
|
||||||
self.extra_context['success_url'] = admin_dashboard
|
self.extra_context['success_url'] = admin_dashboard
|
||||||
cache.set("KEY_DIDS", sensitive_data_encryption_key, None)
|
encryption_key = user.encrypt_data(
|
||||||
|
sensitive_data_encryption_key,
|
||||||
|
settings.SECRET_KEY
|
||||||
|
)
|
||||||
|
cache.set("KEY_DIDS", encryption_key, None)
|
||||||
|
|
||||||
self.request.session["key_did"] = user.encrypt_data(
|
self.request.session["key_did"] = user.encrypt_data(
|
||||||
sensitive_data_encryption_key,
|
sensitive_data_encryption_key,
|
||||||
|
|
Loading…
Reference in New Issue