Skip to content

Commit

Permalink
build: simplified the nodemon service and fixed tests for the new SDK…
Browse files Browse the repository at this point in the history
… version
  • Loading branch information
theblockstalk committed Jul 6, 2024
1 parent 9021ffd commit 2f97a77
Show file tree
Hide file tree
Showing 7 changed files with 2,106 additions and 196 deletions.
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,11 @@ yarn install
## Running the app

```bash
# development
# development with watch mode
yarn run start

# watch mode
yarn run start:dev

# production mode
yarn run build
yarn run start:prod
```

Expand Down
3 changes: 2 additions & 1 deletion nodemon.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"watch": [
"src"
"src",
"test"
],
"ext": "ts",
"ignore": [
Expand Down
5 changes: 1 addition & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,11 @@
"license": "Apache-2.0",
"type": "module",
"scripts": {
"yarn:version": "yarn set version 3.1.1 && echo \"yarn version set to 3.1.1, see https://github.com/Tonomy-Foundation/Tonomy-Communication/issues/85\"",
"esm": "cross-env NODE_OPTIONS=\"--experimental-vm-modules --experimental-require-module\"",
"build": "yarn run esm nest build && yarn run build:post",
"build:post": "node add-js-extension.js",
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
"start": "yarn run esm nodemon",
"start:dev": "yarn run start --watch",
"start:debug": "yarn run start --debug --watch",
"start:prod": "node --experimental-vm-modules --experimental-require-module dist/src/main",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\"",
"lint:fix": "yarn run lint --fix",
Expand All @@ -33,7 +30,7 @@
"@nestjs/platform-socket.io": "^10.2.3",
"@nestjs/swagger": "^7.1.10",
"@nestjs/websockets": "^10.2.3",
"@tonomy/tonomy-id-sdk": "0.21.0-development.4",
"@tonomy/tonomy-id-sdk": "../",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.0",
"hcaptcha": "^0.1.1",
Expand Down
1 change: 1 addition & 0 deletions src/accounts/accounts.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export class AccountsService {
createAccountRequest.usernameHash,
createAccountRequest.publicKey,
createAccountRequest.salt,
// @ts-expect-error - PrivateKey type mismatch
EosioUtil.createSigner(idTonomyActiveKey),
);
} catch (e) {
Expand Down
6 changes: 0 additions & 6 deletions start-dev.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
import { spawn } from 'child_process';
import path from 'path';
import { fileURLToPath } from 'url';

// Path to your JS extension modification script
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const addJsExtensionScriptPath = path.join(__dirname, 'add-js-extension.js');

function runCommand(command) {
return new Promise((resolve, reject) => {
Expand Down
13 changes: 2 additions & 11 deletions test/communication.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ import { connectSocket, emitMessage } from './ws-client.helper';
import { Socket } from 'socket.io-client';
import {
AuthenticationMessage,
ES256KSigner,
generateRandomKeyPair,
setSettings,
util,
} from '@tonomy/tonomy-id-sdk';
const { createJWK, toDid } = util;

setSettings({
blockchainUrl: 'http://localhost:8888',
Expand Down Expand Up @@ -45,16 +43,9 @@ describe('CommunicationGateway (e2e)', () => {
});

it('succeeds for did:jwk message', async () => {
const { privateKey, publicKey } = generateRandomKeyPair();
const signer = ES256KSigner(privateKey.data.array, true);
const jwk = await createJWK(publicKey);
const did = toDid(jwk);
const { privateKey } = generateRandomKeyPair();
const issuer = await util.toDidKeyIssuer(privateKey);

const issuer = {
did,
signer,
alg: 'ES256K-R',
};
const message = await AuthenticationMessage.signMessageWithoutRecipient(
{ data: 'test' },
issuer,
Expand Down
Loading

0 comments on commit 2f97a77

Please sign in to comment.