diff --git a/src/dkr/app/cli/commands/did/webs/generate.py b/src/dkr/app/cli/commands/did/webs/generate.py index 8654ba6..aae2027 100644 --- a/src/dkr/app/cli/commands/did/webs/generate.py +++ b/src/dkr/app/cli/commands/did/webs/generate.py @@ -87,7 +87,7 @@ def generate(self, tymth, tock=0.0, **opts): dd_file_path = os.path.join(dd_dir_path, f"{webbing.DID_JSON}") ddf = open(dd_file_path, "w") - json.dump(diddoc, ddf) + json.dump(didding.toDidWeb(diddoc), ddf) kever = self.hby.kevers[aid] diff --git a/src/dkr/app/cli/commands/did/webs/resolve.py b/src/dkr/app/cli/commands/did/webs/resolve.py index 8cecf9e..ca1b3bf 100644 --- a/src/dkr/app/cli/commands/did/webs/resolve.py +++ b/src/dkr/app/cli/commands/did/webs/resolve.py @@ -62,7 +62,7 @@ def resolve(self, tymth, tock=0.0, **opts): # Load the did doc dd_url = f"{base_url}/{webbing.DID_JSON}" print(f"Loading DID Doc from {dd_url}") - dd_actual = json.loads(self.loadUrl(dd_url).decode("utf-8")) + dd_actual = didding.fromDidWeb(json.loads(self.loadUrl(dd_url).decode("utf-8"))) # Load the KERI CESR kc_url = f"{base_url}/{webbing.KERI_CESR}" diff --git a/src/dkr/core/didding.py b/src/dkr/core/didding.py index 723ffe5..b52020f 100644 --- a/src/dkr/core/didding.py +++ b/src/dkr/core/didding.py @@ -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