Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update DID document and add new context #17

Merged
merged 1 commit into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading