-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(credential-ld): remove fs dependency for JSON LD default contexts (…
…#868) * remove fs dependency for JSON LD default contexts * add contexts/*.json files in the build output fixes #837
- Loading branch information
Showing
13 changed files
with
14 additions
and
18 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,25 @@ | ||
import * as fs from 'fs' | ||
import * as path from 'path' | ||
import { ContextDoc } from './types' | ||
|
||
async function _read(_path: string): Promise<ContextDoc> { | ||
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')], | ||
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters