Skip to content

Commit

Permalink
fix bug and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Bnonni committed Aug 21, 2024
1 parent 3b63fbf commit 5b7d135
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 38 deletions.
4 changes: 2 additions & 2 deletions packages/applicant/src/dcx-applicant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
});

Expand Down
31 changes: 28 additions & 3 deletions packages/common/src/dcx-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -36,4 +59,6 @@ export const dcxOptions: DcxOptions = {
issuers : dcxConfig.issuers,
gateways : dcxConfig.gatewayUris,
dwns : dcxConfig.dwnEndpoints,
};
};

export type DcxConfig = typeof dcxConfig & { [key: string]: any };
9 changes: 0 additions & 9 deletions packages/common/src/dcx-trusted-issuers.ts

This file was deleted.

4 changes: 1 addition & 3 deletions packages/common/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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';
export * from './dcx-manager.js';
16 changes: 0 additions & 16 deletions packages/common/src/types/config.ts

This file was deleted.

2 changes: 1 addition & 1 deletion packages/common/tests/file-system.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions packages/server/src/applicant/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand Down
4 changes: 2 additions & 2 deletions packages/server/src/issuer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand Down

0 comments on commit 5b7d135

Please sign in to comment.