Merge pull request '124-didweb-instead-didkey' (#135) from 124-didweb-instead-didkey into release
Reviewed-on: https://gitea.pangea.org/trustchain-oc1-orchestral/IdHub/pulls/135
This commit is contained in:
commit
7d8ab6a8fc
|
@ -73,7 +73,7 @@ class Command(BaseCommand):
|
||||||
org1.save()
|
org1.save()
|
||||||
org2.save()
|
org2.save()
|
||||||
def create_defaults_dids(self, u, password):
|
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.set_did(password)
|
||||||
did.save()
|
did.save()
|
||||||
|
|
||||||
|
|
|
@ -590,10 +590,17 @@ class VerificableCredential(models.Model):
|
||||||
related_name='vcredentials',
|
related_name='vcredentials',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def is_didweb(self):
|
||||||
|
if self.issuer_did.type == DID.Types.WEB.value:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
def get_data(self, password):
|
def get_data(self, password):
|
||||||
if not self.data:
|
if not self.data:
|
||||||
return ""
|
return ""
|
||||||
if self.eidas1_did:
|
|
||||||
|
if self.eidas1_did or self.is_didweb:
|
||||||
return self.data
|
return self.data
|
||||||
|
|
||||||
return self.user.decrypt_data(self.data, password)
|
return self.user.decrypt_data(self.data, password)
|
||||||
|
@ -639,7 +646,7 @@ class VerificableCredential(models.Model):
|
||||||
self.render(domain),
|
self.render(domain),
|
||||||
self.issuer_did.get_key_material(issuer_pass)
|
self.issuer_did.get_key_material(issuer_pass)
|
||||||
)
|
)
|
||||||
if self.eidas1_did:
|
if self.eidas1_did or self.is_didweb:
|
||||||
self.data = data
|
self.data = data
|
||||||
else:
|
else:
|
||||||
self.data = self.user.encrypt_data(data, password)
|
self.data = self.user.encrypt_data(data, password)
|
||||||
|
@ -653,7 +660,7 @@ class VerificableCredential(models.Model):
|
||||||
|
|
||||||
cred_path = 'credentials'
|
cred_path = 'credentials'
|
||||||
sid = self.id
|
sid = self.id
|
||||||
if self.eidas1_did:
|
if self.eidas1_did or self.is_didweb:
|
||||||
cred_path = 'public/credentials'
|
cred_path = 'public/credentials'
|
||||||
sid = self.hash
|
sid = self.hash
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue