Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
DaevMithran committed Sep 10, 2024
1 parent 0774252 commit 6ff10d8
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/modules/did.ts
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,9 @@ export class DIDModule extends AbstractCheqdSDKModule {
});

const service = protobufDidDocument.service.map((s) => {
if (s.serviceType === ServiceType.LinkedDomains)
protobufDidDocument.context = [...protobufDidDocument.context, contexts.DIFDIDConfiguration];

return {
id: s.id,
type: s.serviceType,
Expand All @@ -547,12 +550,6 @@ export class DIDModule extends AbstractCheqdSDKModule {
});

const context = (function () {
if (
protobufDidDocument.service.find((s) => s.serviceType === ServiceType.LinkedDomains) &&
!protobufDidDocument.context.includes(contexts.DIFDIDConfiguration)
)
protobufDidDocument.context.push(contexts.DIFDIDConfiguration);

if (protobufDidDocument.context.includes(contexts.W3CDIDv1)) return protobufDidDocument.context;

return [contexts.W3CDIDv1, ...protobufDidDocument.context];
Expand Down

0 comments on commit 6ff10d8

Please sign in to comment.