From 0653e9dbc85e035e79bd9f06641508edeaf829f8 Mon Sep 17 00:00:00 2001 From: DaevMithran <61043607+DaevMithran@users.noreply.github.com> Date: Tue, 10 Sep 2024 19:42:13 +0530 Subject: [PATCH] fix: Add LinkedDomain jsonld context in querier (#382) * fix: Add LinkedDomain jsonld context in querier * Update did.ts --------- Co-authored-by: Ankur Banerjee --- src/modules/did.ts | 5 +++++ src/types.ts | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/src/modules/did.ts b/src/modules/did.ts index 981e12b..9f35c75 100644 --- a/src/modules/did.ts +++ b/src/modules/did.ts @@ -10,6 +10,7 @@ import { SpecValidationResult, VerificationMethods, DIDDocumentWithMetadata, + ServiceType, } from '../types'; import { MsgCreateDidDoc, @@ -45,6 +46,7 @@ export const contexts = { W3CSuiteEd255192020: 'https://w3id.org/security/suites/ed25519-2020/v1', W3CSuiteEd255192018: 'https://w3id.org/security/suites/ed25519-2018/v1', W3CSuiteJws2020: 'https://w3id.org/security/suites/jws-2020/v1', + LinkedDomainsContext: 'https://identity.foundation/.well-known/did-configuration/v1', } as const; export const protobufLiterals = { @@ -549,6 +551,9 @@ export class DIDModule extends AbstractCheqdSDKModule { }); const service = protobufDidDocument.service.map((s) => { + if (s.serviceType === ServiceType.LinkedDomains) + protobufDidDocument.context = [...protobufDidDocument.context, contexts.LinkedDomainsContext]; + return { id: s.id, type: s.serviceType, diff --git a/src/types.ts b/src/types.ts index b1e89b3..8f016de 100644 --- a/src/types.ts +++ b/src/types.ts @@ -102,3 +102,7 @@ export const ISignInputs = { return object.some((x) => 'privateKeyHex' in x); }, }; + +export enum ServiceType { + LinkedDomains = 'LinkedDomains', +}