Skip to content

Commit

Permalink
Add functions for transforming to/from did:web document
Browse files Browse the repository at this point in the history
Signed-off-by: Markus Sabadello <[email protected]>
  • Loading branch information
peacekeeper committed Oct 6, 2023
1 parent a06dc52 commit 8f221f2
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/dkr/core/didding.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,15 @@ def generateDIDDoc(hby, did, aid, oobi=None, metadata=None):
return resolutionResult
else:
return diddoc

def toDidWeb(diddoc):
diddoc['id'] = diddoc['id'].replace('did:webs', 'did:web')
for verificationMethod in diddoc['verificationMethod']:
verificationMethod['controller'] = verificationMethod['controller'].replace('did:webs', 'did:web')
return diddoc

def fromDidWeb(diddoc):
diddoc['id'] = diddoc['id'].replace('did:web', 'did:webs')
for verificationMethod in diddoc['verificationMethod']:
verificationMethod['controller'] = verificationMethod['controller'].replace('did:web', 'did:webs')
return diddoc

0 comments on commit 8f221f2

Please sign in to comment.