From e903a36fa43cceba08fb44eaf9dda33835408412 Mon Sep 17 00:00:00 2001 From: Sai Ranjit Tummalapalli Date: Tue, 19 Dec 2023 15:55:52 +0530 Subject: [PATCH] fix: update DID document and add new context (#17) Signed-off-by: Sai Ranjit Tummalapalli --- src/polygon-did-registrar.ts | 5 ++++- src/polygon-did-update.ts | 6 ++---- src/registrar.ts | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/polygon-did-registrar.ts b/src/polygon-did-registrar.ts index e665a35..7b6abb0 100644 --- a/src/polygon-did-registrar.ts +++ b/src/polygon-did-registrar.ts @@ -18,7 +18,10 @@ export async function wrapDidDocument( serviceEndpoint?: string, ) { return { - '@context': 'https://w3id.org/did/v1', + '@context': [ + 'https://w3id.org/did/v1', + 'https://w3id.org/security/suites/secp256k1-2019/v1', + ], id: did, verificationMethod: [ { diff --git a/src/polygon-did-update.ts b/src/polygon-did-update.ts index 79e78d2..10e3295 100644 --- a/src/polygon-did-update.ts +++ b/src/polygon-did-update.ts @@ -35,6 +35,7 @@ export async function updateDidDoc( if (!didDoc && !JSON.parse(didDoc)) { throw new Error('Invalid DID has been entered!') } + const didDocJson = JSON.parse(didDoc) if ( @@ -46,10 +47,7 @@ export async function updateDidDoc( } // Calling smart contract with update DID document on matic chain - const txnHash = await registry.updateDIDDoc( - parsedDid.didAddress, - didDocJson, - ) + const txnHash = await registry.updateDIDDoc(parsedDid.didAddress, didDoc) return BaseResponse.from(txnHash, 'Update DID document successfully') } catch (error) { diff --git a/src/registrar.ts b/src/registrar.ts index 3b06fcc..5102068 100644 --- a/src/registrar.ts +++ b/src/registrar.ts @@ -122,7 +122,7 @@ export class PolygonDID { // Calling smart contract with update DID document on matic chain const txnHash = await this.registry.updateDIDDoc( parsedDid.didAddress, - didDocJson, + didDoc, ) return {