Skip to content

Commit

Permalink
fix: Jsonld errors in did document (#378)
Browse files Browse the repository at this point in the history
* fix: Jsonld errors in did document

* Removed redundant

---------

Co-authored-by: Tasos Derisiotis <[email protected]>
  • Loading branch information
DaevMithran and Eengineer1 authored Sep 6, 2024
1 parent 46980ca commit d75ecb6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/modules/did.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,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',
DIFDIDConfiguration: 'https://identity.foundation/.well-known/did-configuration/v1',
} as const;

export const protobufLiterals = {
Expand Down Expand Up @@ -545,6 +546,12 @@ export class DIDModule extends AbstractCheqdSDKModule {
});

const context = (function () {
if (
protobufDidDocument.service.length &&
!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 d75ecb6

Please sign in to comment.