diff --git a/packages/credential-ld/contexts/X25519KeyAgreementKey2019.jsonld b/packages/credential-ld/contexts/X25519KeyAgreementKey2019.json similarity index 100% rename from packages/credential-ld/contexts/X25519KeyAgreementKey2019.jsonld rename to packages/credential-ld/contexts/X25519KeyAgreementKey2019.json diff --git a/packages/credential-ld/contexts/did_v0.11.jsonld b/packages/credential-ld/contexts/did_v0.11.json similarity index 100% rename from packages/credential-ld/contexts/did_v0.11.jsonld rename to packages/credential-ld/contexts/did_v0.11.json diff --git a/packages/credential-ld/contexts/ed25519-signature-2018-v1.jsonld b/packages/credential-ld/contexts/ed25519-signature-2018-v1.json similarity index 100% rename from packages/credential-ld/contexts/ed25519-signature-2018-v1.jsonld rename to packages/credential-ld/contexts/ed25519-signature-2018-v1.json diff --git a/packages/credential-ld/contexts/kyc-v1.jsonld b/packages/credential-ld/contexts/kyc-v1.json similarity index 100% rename from packages/credential-ld/contexts/kyc-v1.jsonld rename to packages/credential-ld/contexts/kyc-v1.json diff --git a/packages/credential-ld/contexts/lds-ecdsa-secp256k1-recovery2020-0.0.jsonld b/packages/credential-ld/contexts/lds-ecdsa-secp256k1-recovery2020-0.0.json similarity index 100% rename from packages/credential-ld/contexts/lds-ecdsa-secp256k1-recovery2020-0.0.jsonld rename to packages/credential-ld/contexts/lds-ecdsa-secp256k1-recovery2020-0.0.json diff --git a/packages/credential-ld/contexts/profile-v1.jsonld b/packages/credential-ld/contexts/profile-v1.json similarity index 100% rename from packages/credential-ld/contexts/profile-v1.jsonld rename to packages/credential-ld/contexts/profile-v1.json diff --git a/packages/credential-ld/contexts/security_context_v1.jsonld b/packages/credential-ld/contexts/security_context_v1.json similarity index 100% rename from packages/credential-ld/contexts/security_context_v1.jsonld rename to packages/credential-ld/contexts/security_context_v1.json diff --git a/packages/credential-ld/contexts/socialmedia-v1.jsonld b/packages/credential-ld/contexts/socialmedia-v1.json similarity index 100% rename from packages/credential-ld/contexts/socialmedia-v1.jsonld rename to packages/credential-ld/contexts/socialmedia-v1.json diff --git a/packages/credential-ld/contexts/transmute_v1.jsonld b/packages/credential-ld/contexts/transmute_v1.json similarity index 100% rename from packages/credential-ld/contexts/transmute_v1.jsonld rename to packages/credential-ld/contexts/transmute_v1.json diff --git a/packages/credential-ld/contexts/w3_2018_credentials_v1.jsonld b/packages/credential-ld/contexts/w3_2018_credentials_v1.json similarity index 100% rename from packages/credential-ld/contexts/w3_2018_credentials_v1.jsonld rename to packages/credential-ld/contexts/w3_2018_credentials_v1.json diff --git a/packages/credential-ld/src/ld-default-contexts.ts b/packages/credential-ld/src/ld-default-contexts.ts index aa2dd3c55..31bd9adb9 100644 --- a/packages/credential-ld/src/ld-default-contexts.ts +++ b/packages/credential-ld/src/ld-default-contexts.ts @@ -1,30 +1,25 @@ -import * as fs from 'fs' -import * as path from 'path' import { ContextDoc } from './types' async function _read(_path: string): Promise { - const contextDefinition = await fs.promises.readFile(path.join(__dirname, '../contexts', _path), { - encoding: 'utf8', - }) - return JSON.parse(contextDefinition) + return await import('../contexts/' + _path); } /** * Provides a hardcoded map of common context definitions */ export const LdDefaultContexts = new Map([ - ['https://www.w3.org/2018/credentials/v1', _read('w3_2018_credentials_v1.jsonld')], - ['https://www.w3.org/ns/did/v1', _read('security_context_v1.jsonld')], - ['https://w3id.org/did/v0.11', _read('did_v0.11.jsonld')], + ['https://www.w3.org/2018/credentials/v1', _read('w3_2018_credentials_v1.json')], + ['https://www.w3.org/ns/did/v1', _read('security_context_v1.json')], + ['https://w3id.org/did/v0.11', _read('did_v0.11.json')], - ['https://veramo.io/contexts/socialmedia/v1', _read('socialmedia-v1.jsonld')], - ['https://veramo.io/contexts/kyc/v1', _read('kyc-v1.jsonld')], - ['https://veramo.io/contexts/profile/v1', _read('profile-v1.jsonld')], - ['https://ns.did.ai/transmute/v1', _read('transmute_v1.jsonld')], + ['https://veramo.io/contexts/socialmedia/v1', _read('socialmedia-v1.json')], + ['https://veramo.io/contexts/kyc/v1', _read('kyc-v1.json')], + ['https://veramo.io/contexts/profile/v1', _read('profile-v1.json')], + ['https://ns.did.ai/transmute/v1', _read('transmute_v1.json')], [ 'https://identity.foundation/EcdsaSecp256k1RecoverySignature2020/lds-ecdsa-secp256k1-recovery2020-0.0.jsonld', - _read('lds-ecdsa-secp256k1-recovery2020-0.0.jsonld'), + _read('lds-ecdsa-secp256k1-recovery2020-0.0.json'), ], - ['https://w3id.org/security/suites/ed25519-2018/v1', _read('ed25519-signature-2018-v1.jsonld')], - ['https://w3id.org/security/suites/x25519-2019/v1', _read('X25519KeyAgreementKey2019.jsonld')], + ['https://w3id.org/security/suites/ed25519-2018/v1', _read('ed25519-signature-2018-v1.json')], + ['https://w3id.org/security/suites/x25519-2019/v1', _read('X25519KeyAgreementKey2019.json')], ]) diff --git a/packages/credential-ld/tsconfig.json b/packages/credential-ld/tsconfig.json index 15a16d261..59fe5b9e8 100644 --- a/packages/credential-ld/tsconfig.json +++ b/packages/credential-ld/tsconfig.json @@ -5,7 +5,8 @@ "outDir": "build", "declarationDir": "build", // https://github.com/transmute-industries/vc.js/issues/60 - "skipLibCheck": true + "skipLibCheck": true, + "resolveJsonModule": true }, "references": [ { "path": "../core" },