Merge branch 'release' into feature-revoke

This commit is contained in:
Cayo Puigdefabregas 2024-02-14 17:08:46 +01:00
commit 2e7abc4bdd
2 changed files with 11 additions and 4 deletions

View File

@ -73,7 +73,7 @@ class Command(BaseCommand):
org1.save()
org2.save()
def create_defaults_dids(self, u, password):
did = DID(label="Default", user=u, type=DID.Types.KEY)
did = DID(label="Default", user=u, type=DID.Types.WEB)
did.set_did(password)
did.save()

View File

@ -592,10 +592,17 @@ class VerificableCredential(models.Model):
)
# revocationBitmapIndex = models.AutoField()
@property
def is_didweb(self):
if self.issuer_did.type == DID.Types.WEB.value:
return True
return False
def get_data(self, password):
if not self.data:
return ""
if self.eidas1_did:
if self.eidas1_did or self.is_didweb:
return self.data
return self.user.decrypt_data(self.data, password)
@ -641,7 +648,7 @@ class VerificableCredential(models.Model):
self.render(domain),
self.issuer_did.get_key_material(issuer_pass)
)
if self.eidas1_did:
if self.eidas1_did or self.is_didweb:
self.data = data
else:
self.data = self.user.encrypt_data(data, password)
@ -655,7 +662,7 @@ class VerificableCredential(models.Model):
cred_path = 'credentials'
sid = self.id
if self.eidas1_did:
if self.eidas1_did or self.is_didweb:
cred_path = 'public/credentials'
sid = self.hash