Skip to content

Commit

Permalink
fix: default contexts are not using node fs/path anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
nklomp committed Feb 24, 2023
1 parent 51fd687 commit 8f1b17a
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 275 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getUniResolver } from '@sphereon/did-uni-client'
import { createAgent, CredentialPayload, IDIDManager, IIdentifier, IKeyManager, IResolver, PresentationPayload, TAgent } from '@veramo/core'
import { CredentialIssuer, ICredentialIssuer } from '@veramo/credential-w3c'
import { CredentialPlugin, ICredentialIssuer } from '@veramo/credential-w3c'
import { DIDManager, MemoryDIDStore } from '@veramo/did-manager'
import { getDidKeyResolver, KeyDIDProvider } from '@veramo/did-provider-key'
import { DIDResolverPlugin } from '@veramo/did-resolver'
Expand Down Expand Up @@ -33,7 +33,7 @@ describe('credential-LD full flow', () => {
let didLtoIdentifier: IIdentifier
let agent: TAgent<IResolver & IKeyManager & IDIDManager & ICredentialIssuer & ICredentialHandlerLDLocal>

jest.setTimeout(1000000)
// jest.setTimeout(1000000)
beforeAll(async () => {
agent = createAgent({
plugins: [
Expand Down Expand Up @@ -63,7 +63,7 @@ describe('credential-LD full flow', () => {
...getUniResolver('factom', { resolveUrl: 'https://factom-mock/1.0/identifiers' }),
}),
}),
new CredentialIssuer(),
new CredentialPlugin(),
new CredentialHandlerLDLocal({
contextMaps: [LdDefaultContexts, customContext],
suites: [new SphereonEd25519Signature2018(), new SphereonEd25519Signature2020()],
Expand Down
4 changes: 2 additions & 2 deletions packages/vc-handler-ld-local/src/__tests__/localAgent.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createObjects } from '@veramo/cli/build/lib/objectCreator'
import { getConfig } from '@veramo/cli/build/setup'

jest.setTimeout(30000)
// jest.setTimeout(30000)

import { LdDefaultContexts } from '../ld-default-contexts'
import { SphereonEd25519Signature2018 } from '../suites/Ed25519Signature2018'
Expand All @@ -21,7 +21,7 @@ const setup = async (): Promise<boolean> => {
const { localAgent } = createObjects(config, { localAgent: '/agent' })
agent = localAgent
agent.getSupportedVeramoKeyType = jest.fn()
jest.setTimeout(100000)
// jest.setTimeout(100000)

return true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { SphereonBbsBlsSignature2020, SphereonEd25519Signature2018, SphereonEd25

import vcHandlerLocalAgentLogic from './shared/vcHandlerLocalAgentLogic'

jest.setTimeout(30000)
// jest.setTimeout(30000)

const port = 4002
const basePath = '/agent'
Expand Down
82 changes: 0 additions & 82 deletions packages/vc-handler-ld-local/src/contexts/jws-2020-v1.json

This file was deleted.

129 changes: 0 additions & 129 deletions packages/vc-handler-ld-local/src/contexts/security_bbs_v1.json

This file was deleted.

58 changes: 0 additions & 58 deletions packages/vc-handler-ld-local/src/contexts/security_context_v1.json

This file was deleted.

6 changes: 6 additions & 0 deletions packages/vc-handler-ld-local/src/ld-default-contexts.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const contextCredentialV1 = require('./contexts/www.w3.org_2018_credentials_v1.json') // assert { type: 'json' }
import contextBBSV1 from './contexts/bbs-bls-signature-2020-v1.json'
import contextDidV1 from './contexts/www.w3.org_ns_did_v1.json' //assert { type: 'json' }
import contextSecurityV1 from './contexts/w3id.org_security_v1.json' //assert { type: 'json' }
import contextSecurityV2 from './contexts/w3id.org_security_v2.json' //assert { type: 'json' }
Expand All @@ -12,12 +13,15 @@ import contextSuitesSecp from './contexts/w3id.org_security_suites_secp256k1reco
import contextSuitesEd25519_2020 from './contexts/ed25519-signature-2020-v1.json' //assert { type: 'json' }
import contextSuitesJws_2020 from './contexts/json-web-signature-2020-v1.json' // assert { type: 'json' }
import contextSuiteEip712 from './contexts/eip712.json' // assert { type: 'json' }
import contextCitizenshipV1 from './contexts/citizenship-v1.json' // assert { type: 'json' }
import contextVCRevocationList2020 from './contexts/vc-revocation-list-2020-v1.json' // assert { type: 'json' }

/**
* Provides a hardcoded map of common context definitions
*/
export const LdDefaultContexts = new Map([
['https://www.w3.org/2018/credentials/v1', contextCredentialV1],
['https://w3id.org/security/bbs/v1', contextBBSV1],
['https://www.w3.org/ns/did/v1', contextDidV1],
['https://w3id.org/security/v1', contextSecurityV1],
['https://w3id.org/security/v2', contextSecurityV2],
Expand All @@ -27,6 +31,8 @@ export const LdDefaultContexts = new Map([
['https://w3id.org/security/suites/ed25519-2020/v1', contextSuitesEd25519_2020],
['https://w3id.org/security/suites/jws-2020/v1', contextSuitesJws_2020],
['https://veramo.io/contexts/profile/v1', contextProfile],
['https://w3id.org/citizenship/v1', contextCitizenshipV1],
['https://w3id.org/vc-revocation-list-2020', contextVCRevocationList2020],
['https://identity.foundation/EcdsaSecp256k1RecoverySignature2020/lds-ecdsa-secp256k1-recovery2020-0.0.jsonld', contextLdsEcdsaSecpRecovery2020_0],
['https://identity.foundation/EcdsaSecp256k1RecoverySignature2020/lds-ecdsa-secp256k1-recovery2020-2.0.jsonld', contextLdsEcdsaSecpRecovery2020_2],
['https://w3id.org/security/suites/secp256k1recovery-2020/v2', contextSuitesSecp],
Expand Down

0 comments on commit 8f1b17a

Please sign in to comment.