diff --git a/packages/applicant/src/dcx-applicant.ts b/packages/applicant/src/dcx-applicant.ts index 75811d7..f5fa5a7 100644 --- a/packages/applicant/src/dcx-applicant.ts +++ b/packages/applicant/src/dcx-applicant.ts @@ -423,8 +423,8 @@ export class DcxApplicant implements DcxManager { // Check the state of the password and recovery phrase const { password, recoveryPhrase } = await DcxAgentRecovery.validate({ - password : this.config.applicantProtocol.web5Password, - recoveryPhrase : this.config.applicantProtocol.web5RecoveryPhrase, + password : this.config.applicant.web5Password, + recoveryPhrase : this.config.applicant.web5RecoveryPhrase, type : 'applicant' }); diff --git a/packages/common/src/dcx-config.ts b/packages/common/src/dcx-config.ts index 5814513..c05ac0a 100644 --- a/packages/common/src/dcx-config.ts +++ b/packages/common/src/dcx-config.ts @@ -2,10 +2,33 @@ import { DcxHandshakeManifest, DcxOptions, EmailAddressManifest, - PhoneNumberManifest, - defaultTrustedIssuers + PhoneNumberManifest } from './index.js'; +export type DcxIssuerConfig = { + cursorFile: string; + lastRecordIdFile: string; + web5Password: string; + web5RecoveryPhrase: string; + agentDataPath: string; +}; + +export type DcxApplicantConfig = { + web5Password: string; + web5RecoveryPhrase: string; +}; + +export const MX = { + name : 'mx', + id : 'did:dht:sa713dw7jyg44ejwcdf8iqcseh7jcz51wj6fjxbooj41ipeg76eo' +}; +export const FORMFREE = { + name : 'formfree', + id : 'did:dht:hcf5e55bbm44s4oixp5z89wtxenxyk35su7f5pd4r5np93ikyowy' +}; + +export const defaultTrustedIssuers = [MX, FORMFREE]; + export const dcxConfig = { ...[DcxHandshakeManifest, PhoneNumberManifest, EmailAddressManifest], issuers : defaultTrustedIssuers, @@ -36,4 +59,6 @@ export const dcxOptions: DcxOptions = { issuers : dcxConfig.issuers, gateways : dcxConfig.gatewayUris, dwns : dcxConfig.dwnEndpoints, -}; \ No newline at end of file +}; + +export type DcxConfig = typeof dcxConfig & { [key: string]: any }; \ No newline at end of file diff --git a/packages/common/src/dcx-trusted-issuers.ts b/packages/common/src/dcx-trusted-issuers.ts deleted file mode 100644 index 2a9bf2a..0000000 --- a/packages/common/src/dcx-trusted-issuers.ts +++ /dev/null @@ -1,9 +0,0 @@ -export const MX = { - name : 'mx', - id : 'did:dht:sa713dw7jyg44ejwcdf8iqcseh7jcz51wj6fjxbooj41ipeg76eo' -}; -export const FORMFREE = { - name : 'formfree', - id : 'did:dht:hcf5e55bbm44s4oixp5z89wtxenxyk35su7f5pd4r5np93ikyowy' -}; -export const defaultTrustedIssuers = [MX, FORMFREE]; \ No newline at end of file diff --git a/packages/common/src/index.ts b/packages/common/src/index.ts index e15bea1..72bc76f 100644 --- a/packages/common/src/index.ts +++ b/packages/common/src/index.ts @@ -12,7 +12,6 @@ export { schema as manifestSchema } from './schemas/manifest.js'; export type * from './types/did.js'; export type * from './types/handlers.js'; export type * from './types/options.js'; -export type * from './types/config.js'; export type * from './types/pex.js'; export type * from './types/server.js'; export type * from './types/web5.js'; @@ -35,5 +34,4 @@ export * from './dcx-agent.js'; export * from './dcx-config.js'; export * from './dcx-dht-manager.js'; export * from './dcx-identity-vault.js'; -export * from './dcx-manager.js'; -export * from './dcx-trusted-issuers.js'; \ No newline at end of file +export * from './dcx-manager.js'; \ No newline at end of file diff --git a/packages/common/src/types/config.ts b/packages/common/src/types/config.ts deleted file mode 100644 index 0051818..0000000 --- a/packages/common/src/types/config.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { dcxConfig } from '../index.js'; - -export type DcxConfig = typeof dcxConfig & { [key: string]: any }; - -export type DcxIssuerConfig = { - cursorFile: string; - lastRecordIdFile: string; - web5Password: string; - web5RecoveryPhrase: string; - agentDataPath: string; -}; - -export type DcxApplicantConfig = { - web5Password: string; - web5RecoveryPhrase: string; -}; \ No newline at end of file diff --git a/packages/common/tests/file-system.spec.ts b/packages/common/tests/file-system.spec.ts index 4ff0b0d..0d9fbc0 100644 --- a/packages/common/tests/file-system.spec.ts +++ b/packages/common/tests/file-system.spec.ts @@ -9,7 +9,7 @@ describe('FileSystem class', () => { const CURSOR = 'cursor.json'; const randomUUID = crypto.randomUUID(); - afterEach(async () => { + after(async () => { await FileSystem.rm(EXISTS_FILE_PATH); await FileSystem.rm(DNE_FILE_PATH); await FileSystem.rm(LAST_RECORD_ID); diff --git a/packages/server/src/applicant/index.ts b/packages/server/src/applicant/index.ts index 0cc04d7..2e107c3 100644 --- a/packages/server/src/applicant/index.ts +++ b/packages/server/src/applicant/index.ts @@ -152,8 +152,8 @@ export class DcxApplicantServer { this.isPolling = true; Logger.log('DCX server starting ...'); - const CURSOR = this.issuer.config.issuerProtocol.cursorFile!; - const LAST_RECORD_ID = this.issuer.config.issuerProtocol.lastRecordIdFile!; + const CURSOR = this.issuer.config.issuer.cursorFile!; + const LAST_RECORD_ID = this.issuer.config.issuer.lastRecordIdFile!; let cursor = await FileSystem.readToJson(CURSOR); const pagination = Objects.isEmpty(cursor) ? {} : { cursor }; diff --git a/packages/server/src/issuer/index.ts b/packages/server/src/issuer/index.ts index 7b6be7b..ee762d3 100644 --- a/packages/server/src/issuer/index.ts +++ b/packages/server/src/issuer/index.ts @@ -152,8 +152,8 @@ export class DcxIssuerServer { this.isPolling = true; Logger.log('DCX server starting ...'); - const CURSOR = this.issuer.config.issuerProtocol.cursorFile!; - const LAST_RECORD_ID = this.issuer.config.issuerProtocol.lastRecordIdFile!; + const CURSOR = this.issuer.config.issuer.cursorFile!; + const LAST_RECORD_ID = this.issuer.config.issuer.lastRecordIdFile!; let cursor = await FileSystem.readToJson(CURSOR); const pagination = Objects.isEmpty(cursor) ? {} : { cursor };