Skip to content

Commit

Permalink
fix: update DID document and add new context (#17)
Browse files Browse the repository at this point in the history
Signed-off-by: Sai Ranjit Tummalapalli <[email protected]>
  • Loading branch information
sairanjit authored Dec 19, 2023
1 parent b8525f3 commit e903a36
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
5 changes: 4 additions & 1 deletion src/polygon-did-registrar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
{
Expand Down
6 changes: 2 additions & 4 deletions src/polygon-did-update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand All @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/registrar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit e903a36

Please sign in to comment.