Commit 7b9451a2 authored by Ли Джен Сеп's avatar Ли Джен Сеп 💬

Merge branch '2-backend-post-decode' into 'master'

Resolve "Backend: Реализовать POST-метод /decode для расшифровки сообщения"

Closes #2

See merge request !9
parents 37608698 f3bcb19d
......@@ -14,6 +14,7 @@
"@nestjs/core": "^10.0.0",
"@nestjs/mapped-types": "*",
"@nestjs/platform-express": "^10.0.0",
"caesar-salad": "^2.1.0",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.1",
"reflect-metadata": "^0.2.0",
......@@ -3206,6 +3207,18 @@
"node": ">= 0.8"
}
},
"node_modules/caesar-salad": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/caesar-salad/-/caesar-salad-2.1.0.tgz",
"integrity": "sha512-ul2EGpFSv9ftddddOo/2PkzTlbEFbdgBtc7ESpEend/Kf26/eG2e25vUuG9TL4nc+lZgnSMnc4SRgE1o7086DQ==",
"license": "MIT",
"dependencies": {
"char-buffer": "^1.0.0||^2.0.0"
},
"engines": {
"node": ">=8.0"
}
},
"node_modules/call-bind": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.8.tgz",
......@@ -3311,6 +3324,15 @@
"url": "https://github.com/chalk/chalk?sponsor=1"
}
},
"node_modules/char-buffer": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/char-buffer/-/char-buffer-2.0.0.tgz",
"integrity": "sha512-VhQ0Lv1guSq/VfUM2nmEQiqLyD/bPtGh0zAMNqP9fjnI1wNbOU1Bv1xEh0tEdxhieatZfmaCw08lhzNEyeHpkQ==",
"license": "MIT",
"engines": {
"node": ">=8"
}
},
"node_modules/char-regex": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/char-regex/-/char-regex-1.0.2.tgz",
......
......@@ -25,6 +25,7 @@
"@nestjs/core": "^10.0.0",
"@nestjs/mapped-types": "*",
"@nestjs/platform-express": "^10.0.0",
"caesar-salad": "^2.1.0",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.1",
"reflect-metadata": "^0.2.0",
......
......@@ -2,7 +2,7 @@ import { Controller, Post, Body } from '@nestjs/common';
import { MessageService } from './message.service';
import { CreateMessageDto } from './dto/create-message.dto';
@Controller('message')
@Controller()
export class MessageController {
constructor(private readonly messageService: MessageService) {}
......
import { Injectable } from '@nestjs/common';
import { CreateMessageDto } from './dto/create-message.dto';
import { UpdateMessageDto } from './dto/update-message.dto';
import { Vigenere } from 'caesar-salad';
@Injectable()
export class MessageService {
[x: string]: any;
create(createMessageDto: CreateMessageDto) {
return 'This action adds a new message';
encodeMessage(password: string, message: string): string {
return Vigenere.Cipher(password).crypt(message);
}
findAll() {
return `This action returns all message`;
}
findOne(id: number) {
return `This action returns a #${id} message`;
}
update(id: number, updateMessageDto: UpdateMessageDto) {
return `This action updates a #${id} message`;
}
remove(id: number) {
return `This action removes a #${id} message`;
decodeMessage(password: string, message: string): string {
return Vigenere.Decipher(password).crypt(message);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment