Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix bug, fix tests, bump versions #103

Merged
merged 3 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions dcx.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@
},
{
"name": "applicant",
"path": "packages/applicant",
"path": "packages/applicant"
},
{
"name": "common",
"path": "packages/common",
"path": "packages/common"
},
{
"name": "issuer",
"path": "packages/issuer",
"path": "packages/issuer"
},
{
"name": "server",
"path": "packages/server",
},
"path": "packages/server"
}
],
"settings": {
"eslint.workingDirectories": [
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dcx-protocol/root",
"version": "5.0.0",
"version": "0.6.0",
"description": "DCX: Decentralized Credential Exchange. DWN protocol for verifiable credential exchange.",
"type": "module",
"workspaces": [
Expand Down Expand Up @@ -105,4 +105,4 @@
"ws@<8.17.1": ">=8.17.1"
}
}
}
}
2 changes: 1 addition & 1 deletion packages/applicant/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dcx-protocol/applicant",
"version": "5.0.0",
"version": "0.6.1",
"description": "DCX Applicant protocol and server",
"type": "module",
"main": "./dist/cjs/index.js",
Expand Down
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
2 changes: 1 addition & 1 deletion packages/common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dcx-protocol/common",
"version": "3.2.0",
"version": "0.4.3",
"description": "Common library shared by the other @dcx-protocol packages",
"type": "module",
"main": "./dist/cjs/index.js",
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.

8 changes: 4 additions & 4 deletions packages/common/tests/dcx-config.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ describe('dcxConfig', () => {
});

it('should contain property dcxConfig.applicant as an object with at least 2 entries', () => {
const dcxApplicantProtocol = dcxConfig.applicant;
expect(dcxApplicantProtocol).to.not.be.null.and.not.be.undefined;
expect(dcxApplicantProtocol).to.be.an('object');
expect(Object.entries(dcxApplicantProtocol)).to.have.lengthOf.gte(2);
const dcxApplicantConfig = dcxConfig.applicant;
expect(dcxApplicantConfig).to.not.be.null.and.not.be.undefined;
expect(dcxApplicantConfig).to.be.an('object');
expect(Object.entries(dcxApplicantConfig)).to.have.lengthOf.gte(2);
});
});
});
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
2 changes: 1 addition & 1 deletion packages/issuer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dcx-protocol/issuer",
"version": "5.0.0",
"version": "0.6.1",
"description": "DCX Issuer protocol and server",
"type": "module",
"main": "./dist/cjs/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/server/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dcx-protocol/server",
"version": "2.0.0",
"version": "0.3.1",
"description": "DCX Server Implementation",
"type": "module",
"main": "./dist/cjs/index.js",
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
Loading