diff --git a/README.md b/README.md index 4dfea1a..f69bf6d 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,12 @@ yarn run start:dev yarn run start:prod ``` +## Environment variables and configuration + +`NODE_ENV` - Determines which config file in `./src/config` to use +`CREATE_ACCOUNT_PRIVATE_KEY` - The private key used to sign the transaction to create a new account +`HCAPTCHA_SECRET` - The hCaptcha account secret key + ## Test ```bash diff --git a/package.json b/package.json index ec6f152..98db93c 100644 --- a/package.json +++ b/package.json @@ -27,9 +27,10 @@ "@nestjs/platform-socket.io": "^9.2.1", "@nestjs/swagger": "^6.1.4", "@nestjs/websockets": "^9.2.1", - "@tonomy/tonomy-id-sdk": "^0.14.1", + "@tonomy/tonomy-id-sdk": "development", "class-transformer": "^0.5.1", "class-validator": "^0.14.0", + "hcaptcha": "^0.1.1", "helmet": "^7.0.0", "nestjs-asyncapi": "^1.0.4", "reflect-metadata": "^0.1.13", diff --git a/src/accounts/accounts.controller.spec.ts b/src/accounts/accounts.controller.spec.ts new file mode 100644 index 0000000..cc149fb --- /dev/null +++ b/src/accounts/accounts.controller.spec.ts @@ -0,0 +1,20 @@ +import { Test, TestingModule } from '@nestjs/testing'; +import { AccountsController } from './accounts.controller'; +import { AccountsService } from './accounts.service'; + +describe('AccountsController', () => { + let controller: AccountsController; + + beforeEach(async () => { + const module: TestingModule = await Test.createTestingModule({ + controllers: [AccountsController], + providers: [AccountsService], + }).compile(); + + controller = module.get(AccountsController); + }); + + it('should be defined', () => { + expect(controller).toBeDefined(); + }); +}); diff --git a/src/accounts/accounts.controller.ts b/src/accounts/accounts.controller.ts new file mode 100644 index 0000000..f50f138 --- /dev/null +++ b/src/accounts/accounts.controller.ts @@ -0,0 +1,74 @@ +import { + Body, + Controller, + HttpException, + HttpStatus, + Logger, + Post, + Res, +} from '@nestjs/common'; +import { ApiOperation, ApiParam, ApiResponse } from '@nestjs/swagger'; +import { AccountsService } from './accounts.service'; +import { + CreateAccountRequest, + CreateAccountResponse, +} from './dto/create-account.dto'; +import { Response } from 'express'; + +@Controller('accounts') +export class AccountsController { + private readonly logger = new Logger(AccountsController.name); + constructor(private accountService: AccountsService) { } + + @Post() + @ApiOperation({ + summary: 'Create a new Tonomy ID account on the blockchain', + }) + @ApiParam({ + name: 'usernameHash', + description: 'sha256 hash of username', + required: true, + type: 'string', + example: 'b06ecffb7ad2e992e82c1f3a23341bca36f8337f74032c00c489c21b00f66e52', + }) + @ApiParam({ + name: 'salt', + description: 'Salt used to generate the private key', + required: true, + type: 'string', + example: 'b06ecffb7ad2e992e82c1f3a23341bca36f8337f74032c00c489c21b00f66e52', + }) + @ApiParam({ + name: 'publicKey', + description: 'Public key that will control the account', + example: 'PUB_K1_6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5BoDq63', + required: true, + }) + @ApiParam({ + name: 'captchaToken', + description: 'The hCaptcha token', + required: true, + type: 'string', + example: '10000000-aaaa-bbbb-cccc-000000000001', + }) + @ApiResponse({ + status: HttpStatus.CREATED, + description: 'New account created', + type: CreateAccountResponse, + }) + async createAccount( + @Body() createAccountDto: CreateAccountRequest, + @Res() response: Response, + ): Promise { + try { + const val = await this.accountService.createAccount(createAccountDto); + + response.status(HttpStatus.CREATED).send(val); + } catch (e) { + if (e instanceof HttpException) throw e; + console.error(e); + this.logger.error(e); + throw new HttpException(e.message, HttpStatus.INTERNAL_SERVER_ERROR); + } + } +} diff --git a/src/accounts/accounts.module.ts b/src/accounts/accounts.module.ts new file mode 100644 index 0000000..0e18141 --- /dev/null +++ b/src/accounts/accounts.module.ts @@ -0,0 +1,9 @@ +import { Module } from '@nestjs/common'; +import { AccountsController } from './accounts.controller'; +import { AccountsService } from './accounts.service'; + +@Module({ + controllers: [AccountsController], + providers: [AccountsService], +}) +export class AccountsModule {} diff --git a/src/users/users.service.spec.ts b/src/accounts/accounts.service.spec.ts similarity index 54% rename from src/users/users.service.spec.ts rename to src/accounts/accounts.service.spec.ts index 62815ba..01304e2 100644 --- a/src/users/users.service.spec.ts +++ b/src/accounts/accounts.service.spec.ts @@ -1,15 +1,15 @@ import { Test, TestingModule } from '@nestjs/testing'; -import { UsersService } from './users.service'; +import { AccountsService } from './accounts.service'; -describe('UsersService', () => { - let service: UsersService; +describe('AccountsService', () => { + let service: AccountsService; beforeEach(async () => { const module: TestingModule = await Test.createTestingModule({ - providers: [UsersService], + providers: [AccountsService], }).compile(); - service = module.get(UsersService); + service = module.get(AccountsService); }); it('should be defined', () => { diff --git a/src/accounts/accounts.service.ts b/src/accounts/accounts.service.ts new file mode 100644 index 0000000..535305f --- /dev/null +++ b/src/accounts/accounts.service.ts @@ -0,0 +1,106 @@ +import { HttpException, HttpStatus, Injectable, Logger } from '@nestjs/common'; +import { + CreateAccountRequest, + CreateAccountResponse, +} from './dto/create-account.dto'; +import { Name, PrivateKey } from '@wharfkit/antelope'; +import settings from '../settings'; +import { PushTransactionResponse } from '@wharfkit/antelope/src/api/v1/types'; +import { + IDContract, + EosioUtil, + AntelopePushTransactionError, +} from '@tonomy/tonomy-id-sdk'; +import { verify } from 'hcaptcha'; + +const idContract = IDContract.Instance; + +@Injectable() +export class AccountsService { + private readonly logger = new Logger(AccountsService.name); + + async createAccount( + createAccountRequest: CreateAccountRequest, + ): Promise { + this.logger.debug('createAccount()'); + + if (!createAccountRequest) + throw new HttpException( + 'CreateAccountRequest not provided', + HttpStatus.BAD_REQUEST, + ); + if (!createAccountRequest.usernameHash) + throw new HttpException( + 'UsernameHash not provided', + HttpStatus.BAD_REQUEST, + ); + if (!createAccountRequest.publicKey) + throw new HttpException( + 'Public key not provided', + HttpStatus.BAD_REQUEST, + ); + if (!createAccountRequest.salt) + throw new HttpException('Salt not provided', HttpStatus.BAD_REQUEST); + if (!createAccountRequest.captchaToken) + throw new HttpException( + 'Captcha token not provided', + HttpStatus.BAD_REQUEST, + ); + + const verifyResponse = await verify( + settings.secrets.hCaptchaSecret, + createAccountRequest.captchaToken, + ); + + if (!verifyResponse.success) { + throw new HttpException( + { + message: 'Captcha verification failed', + errors: verifyResponse['error-codes'], + }, + HttpStatus.BAD_REQUEST, + ); + } + + const idTonomyActiveKey = PrivateKey.from( + settings.secrets.createAccountPrivateKey, + ); + + let res: PushTransactionResponse; + + try { + res = await idContract.newperson( + createAccountRequest.usernameHash, + createAccountRequest.publicKey, + createAccountRequest.salt, + EosioUtil.createSigner(idTonomyActiveKey), + ); + } catch (e) { + if ( + e instanceof AntelopePushTransactionError && + e.hasErrorCode(3050003) && + e.hasTonomyErrorCode('TCON1000') + ) { + throw new HttpException( + 'Username is already taken', + HttpStatus.BAD_REQUEST, + ); + } + + throw e; + } + + const newAccountAction = + res.processed.action_traces[0].inline_traces[0].act; + + const accountName = Name.from(newAccountAction.data.name); + + if (settings.config.loggerLevel === 'debug') + this.logger.debug('createAccount()', accountName.toString()); + + return { + transactionId: res.transaction_id, + accountName: accountName.toString(), + }; + } +} diff --git a/src/accounts/dto/create-account.dto.ts b/src/accounts/dto/create-account.dto.ts new file mode 100644 index 0000000..6c6e26f --- /dev/null +++ b/src/accounts/dto/create-account.dto.ts @@ -0,0 +1,44 @@ +import { ApiProperty } from '@nestjs/swagger'; + +export class CreateAccountRequest { + @ApiProperty({ + required: true, + description: 'sha256 hash of username', + example: 'b06ecffb7ad2e992e82c1f3a23341bca36f8337f74032c00c489c21b00f66e52', + }) + usernameHash?: string; + + @ApiProperty({ + required: true, + description: 'Salt used to generate the private key', + example: 'b06ecffb7ad2e992e82c1f3a23341bca36f8337f74032c00c489c21b00f66e52', + }) + salt?: string; + + @ApiProperty({ + required: true, + description: 'Public key that will control the account', + example: 'PUB_K1_6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5BoDq63', + }) + publicKey?: string; + + @ApiProperty({ + required: true, + description: 'The hCaptcha token', + example: '10000000-aaaa-bbbb-cccc-000000000001', + type: 'string', + }) + captchaToken?: string; +} + +export class CreateAccountResponse { + @ApiProperty({ + example: 'dfd401c1dcd5fd4ff7836dfe5e3b54630a077ea01643c1529ac20e4e03b26763', + }) + transactionId!: string; + + @ApiProperty({ + example: 'tonomyacc1', + }) + accountName!: string; +} diff --git a/src/app.module.ts b/src/app.module.ts index 73e916a..fb4ebae 100644 --- a/src/app.module.ts +++ b/src/app.module.ts @@ -1,10 +1,11 @@ import { Module } from '@nestjs/common'; import { AppController } from './app.controller'; import { AppService } from './app.service'; -import { UsersModule } from './users/users.module'; +import { CommunicationModule } from './communication/communication.module'; +import { AccountsModule } from './accounts/accounts.module'; @Module({ - imports: [UsersModule], + imports: [CommunicationModule, AccountsModule], controllers: [AppController], providers: [AppService], }) diff --git a/src/communication/communication.gateway.spec.ts b/src/communication/communication.gateway.spec.ts new file mode 100644 index 0000000..bd466c6 --- /dev/null +++ b/src/communication/communication.gateway.spec.ts @@ -0,0 +1,19 @@ +import { Test, TestingModule } from '@nestjs/testing'; +import { CommunicationGateway } from './communication.gateway'; +import { CommunicationService } from './communication.service'; + +describe('CommunicationGateway', () => { + let gateway: CommunicationGateway; + + beforeEach(async () => { + const module: TestingModule = await Test.createTestingModule({ + providers: [CommunicationGateway, CommunicationService], + }).compile(); + + gateway = module.get(CommunicationGateway); + }); + + it('should be defined', () => { + expect(gateway).toBeDefined(); + }); +}); diff --git a/src/users/users.gateway.ts b/src/communication/communication.gateway.ts similarity index 86% rename from src/users/users.gateway.ts rename to src/communication/communication.gateway.ts index 430c021..7404448 100644 --- a/src/users/users.gateway.ts +++ b/src/communication/communication.gateway.ts @@ -6,7 +6,7 @@ import { OnGatewayDisconnect, BaseWsExceptionFilter, } from '@nestjs/websockets'; -import { UsersService } from './users.service'; +import { CommunicationService } from './communication.service'; import { HttpException, HttpStatus, @@ -21,7 +21,7 @@ import { MessageDto, MessageRto } from './dto/message.dto'; import { Client } from './dto/client.dto'; import { WsExceptionFilter } from './ws-exception/ws-exception.filter'; import { AuthenticationMessage } from '@tonomy/tonomy-id-sdk'; -import { UsersGuard } from './users.guard'; +import { CommunicationGuard } from './communication.guard'; @UseFilters(WsExceptionFilter) @UsePipes(new TransformVcPipe()) @@ -33,9 +33,9 @@ import { UsersGuard } from './users.guard'; }, }) @UseFilters(new BaseWsExceptionFilter()) -export class UsersGateway implements OnGatewayDisconnect { - private readonly logger = new Logger(UsersGateway.name); - constructor(private readonly usersService: UsersService) {} +export class CommunicationGateway implements OnGatewayDisconnect { + private readonly logger = new Logger(CommunicationGateway.name); + constructor(private readonly usersService: CommunicationService) {} /** * Logs in the user and added it to the loggedIn map @@ -73,7 +73,7 @@ export class UsersGateway implements OnGatewayDisconnect { * @returns void */ @SubscribeMessage('message') - @UseGuards(UsersGuard) + @UseGuards(CommunicationGuard) @AsyncApiPub({ channel: 'message', message: { diff --git a/src/communication/communication.guard.spec.ts b/src/communication/communication.guard.spec.ts new file mode 100644 index 0000000..f0c0c06 --- /dev/null +++ b/src/communication/communication.guard.spec.ts @@ -0,0 +1,7 @@ +import { CommunicationGuard } from './communication.guard'; + +describe('CommunicationGuard', () => { + it('should be defined', () => { + expect(new CommunicationGuard()).toBeDefined(); + }); +}); diff --git a/src/users/users.guard.ts b/src/communication/communication.guard.ts similarity index 88% rename from src/users/users.guard.ts rename to src/communication/communication.guard.ts index 4fc7b91..2d6be25 100644 --- a/src/users/users.guard.ts +++ b/src/communication/communication.guard.ts @@ -7,7 +7,7 @@ import { import { Observable } from 'rxjs'; @Injectable() -export class UsersGuard implements CanActivate { +export class CommunicationGuard implements CanActivate { canActivate( context: ExecutionContext, ): boolean | Promise | Observable { diff --git a/src/communication/communication.module.ts b/src/communication/communication.module.ts new file mode 100644 index 0000000..b39250c --- /dev/null +++ b/src/communication/communication.module.ts @@ -0,0 +1,14 @@ +import { Logger, Module } from '@nestjs/common'; +import { CommunicationService } from './communication.service'; +import { CommunicationGateway } from './communication.gateway'; +import { TransformVcPipe } from './transform-vc/transform-vc.pipe'; + +@Module({ + providers: [ + CommunicationGateway, + CommunicationService, + Logger, + TransformVcPipe, + ], +}) +export class CommunicationModule {} diff --git a/src/communication/communication.service.spec.ts b/src/communication/communication.service.spec.ts new file mode 100644 index 0000000..e71e07e --- /dev/null +++ b/src/communication/communication.service.spec.ts @@ -0,0 +1,18 @@ +import { Test, TestingModule } from '@nestjs/testing'; +import { CommunicationService } from './communication.service'; + +describe('CommunicationService', () => { + let service: CommunicationService; + + beforeEach(async () => { + const module: TestingModule = await Test.createTestingModule({ + providers: [CommunicationService], + }).compile(); + + service = module.get(CommunicationService); + }); + + it('should be defined', () => { + expect(service).toBeDefined(); + }); +}); diff --git a/src/users/users.service.ts b/src/communication/communication.service.ts similarity index 82% rename from src/users/users.service.ts rename to src/communication/communication.service.ts index 316e8f4..1a1ae42 100644 --- a/src/users/users.service.ts +++ b/src/communication/communication.service.ts @@ -1,12 +1,15 @@ -import { HttpException, HttpStatus, Injectable } from '@nestjs/common'; +import { HttpException, HttpStatus, Injectable, Logger } from '@nestjs/common'; import { AsyncApiSub, AsyncApi } from 'nestjs-asyncapi'; import { Socket } from 'socket.io'; import { Client } from './dto/client.dto'; import { MessageDto, MessageRto } from './dto/message.dto'; +import settings from '../settings'; @AsyncApi() @Injectable() -export class UsersService { +export class CommunicationService { + private readonly logger = new Logger(CommunicationService.name); + private readonly loggedInUsers = new Map(); /** @@ -24,7 +27,8 @@ export class UsersService { * @returns boolean if user is connected successfully */ login(did: string, socket: Client): boolean { - if (process.env.LOG === 'true') console.log('login()', did, socket.id); + if (settings.config.loggerLevel === 'debug') + this.logger.debug('login()', did, socket.id); if (this.loggedInUsers.get(did) === socket.id) return false; this.loggedInUsers.set(did, socket.id); @@ -50,8 +54,8 @@ export class UsersService { sendMessage(socket: Client, message: MessageDto): boolean { const recipient = this.loggedInUsers.get(message.getRecipient()); - if (process.env.LOG === 'true') - console.log( + if (settings.config.loggerLevel === 'debug') + this.logger.debug( 'sendMessage()', message.getIssuer(), message.getRecipient(), diff --git a/src/users/dto/client.dto.ts b/src/communication/dto/client.dto.ts similarity index 100% rename from src/users/dto/client.dto.ts rename to src/communication/dto/client.dto.ts diff --git a/src/users/dto/message.dto.ts b/src/communication/dto/message.dto.ts similarity index 100% rename from src/users/dto/message.dto.ts rename to src/communication/dto/message.dto.ts diff --git a/src/users/transform-vc/transform-vc.pipe.spec.ts b/src/communication/transform-vc/transform-vc.pipe.spec.ts similarity index 97% rename from src/users/transform-vc/transform-vc.pipe.spec.ts rename to src/communication/transform-vc/transform-vc.pipe.spec.ts index b6ebbf9..498d447 100644 --- a/src/users/transform-vc/transform-vc.pipe.spec.ts +++ b/src/communication/transform-vc/transform-vc.pipe.spec.ts @@ -3,7 +3,10 @@ import { MessageDto } from '../dto/message.dto'; import { TransformVcPipe } from './transform-vc.pipe'; import { HttpException } from '@nestjs/common'; -setSettings({}); +setSettings({ + blockchainUrl: 'http://localhost:8888', +}); + describe('TransformVcPipe', () => { it('should be defined', () => { expect(new TransformVcPipe()).toBeDefined(); diff --git a/src/users/transform-vc/transform-vc.pipe.ts b/src/communication/transform-vc/transform-vc.pipe.ts similarity index 95% rename from src/users/transform-vc/transform-vc.pipe.ts rename to src/communication/transform-vc/transform-vc.pipe.ts index 655a5bb..ff2307f 100644 --- a/src/users/transform-vc/transform-vc.pipe.ts +++ b/src/communication/transform-vc/transform-vc.pipe.ts @@ -5,7 +5,6 @@ import { Injectable, PipeTransform, } from '@nestjs/common'; -import { WsException } from '@nestjs/websockets'; import { MessageDto, MessageRto } from '../dto/message.dto'; @Injectable() diff --git a/src/users/ws-exception/ws-exception.filter.spec.ts b/src/communication/ws-exception/ws-exception.filter.spec.ts similarity index 100% rename from src/users/ws-exception/ws-exception.filter.spec.ts rename to src/communication/ws-exception/ws-exception.filter.spec.ts diff --git a/src/users/ws-exception/ws-exception.filter.ts b/src/communication/ws-exception/ws-exception.filter.ts similarity index 100% rename from src/users/ws-exception/ws-exception.filter.ts rename to src/communication/ws-exception/ws-exception.filter.ts diff --git a/src/config/config.demo.json b/src/config/config.demo.json index 1a9f250..35d1152 100644 --- a/src/config/config.demo.json +++ b/src/config/config.demo.json @@ -1,3 +1,4 @@ { - "blockchainUrl": "https://blockchain-api-demo.tonomy.foundation" + "blockchainUrl": "https://blockchain-api-demo.tonomy.foundation", + "loggerLevel": "info" } diff --git a/src/config/config.json b/src/config/config.json index 5ee0f7c..c9a42ac 100644 --- a/src/config/config.json +++ b/src/config/config.json @@ -1,3 +1,4 @@ { - "blockchainUrl": "http://localhost:8888" + "blockchainUrl": "http://localhost:8888", + "loggerLevel": "debug" } diff --git a/src/config/config.staging.json b/src/config/config.staging.json index 3390c85..a121402 100644 --- a/src/config/config.staging.json +++ b/src/config/config.staging.json @@ -1,3 +1,4 @@ { - "blockchainUrl": "https://blockchain-api-staging.tonomy.foundation" + "blockchainUrl": "https://blockchain-api-staging.tonomy.foundation", + "loggerLevel": "debug" } diff --git a/src/main.ts b/src/main.ts index 883e3ac..4073174 100644 --- a/src/main.ts +++ b/src/main.ts @@ -8,6 +8,7 @@ import helmet from 'helmet'; setSettings({ blockchainUrl: settings.config.blockchainUrl, + loggerLevel: settings.config.loggerLevel, }); async function bootstrap() { diff --git a/src/settings.ts b/src/settings.ts index b374506..8a34eda 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -1,6 +1,7 @@ import * as configDefault from './config/config.json'; import * as configStaging from './config/config.staging.json'; import * as configDemo from './config/config.demo.json'; +import { EosioUtil } from '@tonomy/tonomy-id-sdk'; const env = process.env.NODE_ENV || 'development'; @@ -8,12 +9,25 @@ console.log(`NODE_ENV=${env}`); type ConfigType = { blockchainUrl: string; + loggerLevel: + | 'emergency' + | 'alert' + | 'critical' + | 'error' + | 'warning' + | 'notice' + | 'info' + | 'debug'; }; type SettingsType = { env: string; config: ConfigType; isProduction: () => boolean; + secrets: { + createAccountPrivateKey: string; + hCaptchaSecret: string; + }; }; let config: ConfigType; @@ -22,17 +36,29 @@ const settings: SettingsType = { isProduction: () => settings.env === 'production', } as SettingsType; +type FixLoggerLevelEnumType = Omit & { + loggerLevel: + | 'emergency' + | 'alert' + | 'critical' + | 'error' + | 'warning' + | 'notice' + | 'info' + | 'debug'; +}; + switch (env) { case 'test': case 'local': case 'development': - config = configDefault; + config = configDefault as FixLoggerLevelEnumType; break; case 'staging': - config = configStaging; + config = configStaging as FixLoggerLevelEnumType; break; case 'demo': - config = configDemo; + config = configDemo as FixLoggerLevelEnumType; break; case 'production': throw new Error('Production config not implemented yet'); @@ -40,14 +66,30 @@ switch (env) { throw new Error('Unknown environment: ' + env); } +settings.config = Object.assign({}, config); + if (process.env.BLOCKCHAIN_URL) { console.log(`Using BLOCKCHAIN_URL from env: ${process.env.BLOCKCHAIN_URL}`); - config = { blockchainUrl: process.env.BLOCKCHAIN_URL }; + settings.config.blockchainUrl = process.env.BLOCKCHAIN_URL; } -settings.config = config; - console.log('settings', settings); +settings.secrets = { + createAccountPrivateKey: EosioUtil.defaultAntelopePrivateKey.toString(), + hCaptchaSecret: '0x0000000000000000000000000000000000000000', +}; + +if (process.env.CREATE_ACCOUNT_PRIVATE_KEY) { + console.log('Using CREATE_ACCOUNT_PRIVATE_KEY from env'); + settings.secrets.createAccountPrivateKey = + process.env.CREATE_ACCOUNT_PRIVATE_KEY; +} + +if (process.env.HCAPTCHA_SECRET) { + console.log('Using HCAPTCHA_SECRET from env'); + settings.secrets.hCaptchaSecret = process.env.HCAPTCHA_SECRET; +} + export default settings; diff --git a/src/users/entities/user.entity.ts b/src/users/entities/user.entity.ts deleted file mode 100644 index 4f82c14..0000000 --- a/src/users/entities/user.entity.ts +++ /dev/null @@ -1 +0,0 @@ -export class User {} diff --git a/src/users/users.gateway.spec.ts b/src/users/users.gateway.spec.ts deleted file mode 100644 index 72ba8d3..0000000 --- a/src/users/users.gateway.spec.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { Test, TestingModule } from '@nestjs/testing'; -import { UsersGateway } from './users.gateway'; -import { UsersService } from './users.service'; - -describe('UsersGateway', () => { - let gateway: UsersGateway; - - beforeEach(async () => { - const module: TestingModule = await Test.createTestingModule({ - providers: [UsersGateway, UsersService], - }).compile(); - - gateway = module.get(UsersGateway); - }); - - it('should be defined', () => { - expect(gateway).toBeDefined(); - }); -}); diff --git a/src/users/users.guard.spec.ts b/src/users/users.guard.spec.ts deleted file mode 100644 index 428d11c..0000000 --- a/src/users/users.guard.spec.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { UsersGuard } from './users.guard'; - -describe('UsersGuard', () => { - it('should be defined', () => { - expect(new UsersGuard()).toBeDefined(); - }); -}); diff --git a/src/users/users.module.ts b/src/users/users.module.ts deleted file mode 100644 index c0be053..0000000 --- a/src/users/users.module.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Logger, Module } from '@nestjs/common'; -import { UsersService } from './users.service'; -import { UsersGateway } from './users.gateway'; -import { TransformVcPipe } from './transform-vc/transform-vc.pipe'; - -@Module({ - providers: [UsersGateway, UsersService, Logger, TransformVcPipe], -}) -export class UsersModule {} diff --git a/yarn.lock b/yarn.lock index 1e4408f..686de8c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2849,9 +2849,9 @@ __metadata: languageName: node linkType: hard -"@tonomy/tonomy-id-sdk@npm:^0.14.1": - version: 0.14.1 - resolution: "@tonomy/tonomy-id-sdk@npm:0.14.1" +"@tonomy/tonomy-id-sdk@npm:development": + version: 0.15.0-development.2 + resolution: "@tonomy/tonomy-id-sdk@npm:0.15.0-development.2" dependencies: "@consento/sync-randombytes": ^1.0.5 "@tonomy/antelope-did": ^0.1.5 @@ -2866,7 +2866,7 @@ __metadata: elliptic: ^6.5.4 socket.io-client: ^4.5.4 universal-base64url: ^1.1.0 - checksum: bdf3d3946650a506017da30926dcc4731eb832acb4c8edb1e93b193e74a55887fcbd3ce29107079b251ea3ffdccba3bd8564145542d789a016e68329d542c1f5 + checksum: 33d6031035c480da14ad603a7bb4e94ffcc6138677ae9fcf301f962a96328a449ee636c7fdec7825bda79853b93fc9781586da62eae341763c6686c3b58afcdc languageName: node linkType: hard @@ -6436,6 +6436,13 @@ __metadata: languageName: node linkType: hard +"hcaptcha@npm:^0.1.1": + version: 0.1.1 + resolution: "hcaptcha@npm:0.1.1" + checksum: 3dcad365da0b4611ba43f02f898eb343324f607445c21f403a60a7d8f4891501323a6553c24670e2a7dd77dc5184ca656a8b15e5b29bbf494b15cd7e0daae6e8 + languageName: node + linkType: hard + "helmet@npm:^7.0.0": version: 7.0.0 resolution: "helmet@npm:7.0.0" @@ -10576,7 +10583,7 @@ __metadata: "@nestjs/swagger": ^6.1.4 "@nestjs/testing": ^9.0.0 "@nestjs/websockets": ^9.2.1 - "@tonomy/tonomy-id-sdk": ^0.14.1 + "@tonomy/tonomy-id-sdk": development "@types/express": ^4.17.13 "@types/jest": 29.2.4 "@types/node": 18.11.18 @@ -10588,6 +10595,7 @@ __metadata: eslint: ^8.0.1 eslint-config-prettier: ^8.3.0 eslint-plugin-prettier: ^4.0.0 + hcaptcha: ^0.1.1 helmet: ^7.0.0 jest: 29.3.1 nestjs-asyncapi: ^1.0.4