-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Tara Matthew
committed
Oct 12, 2023
1 parent
9e0a66b
commit 42d073f
Showing
12 changed files
with
379 additions
and
379 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
module.exports = { | ||
presets: [ | ||
'@vue/cli-plugin-babel/preset' | ||
] | ||
} | ||
presets: [ | ||
"@vue/cli-plugin-babel/preset" | ||
] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
import { createApp } from 'vue' | ||
import App from './App.vue' | ||
import router from './router' | ||
import "bootstrap" | ||
import "bootstrap/dist/css/bootstrap.min.css" | ||
import { createApp } from "vue"; | ||
import App from "./App.vue"; | ||
import router from "./router"; | ||
import "bootstrap"; | ||
import "bootstrap/dist/css/bootstrap.min.css"; | ||
|
||
import VueCookies from 'vue3-cookies' | ||
import VueCookies from "vue3-cookies"; | ||
|
||
createApp(App).use(VueCookies).use(router).mount('#app') | ||
createApp(App).use(VueCookies).use(router).mount("#app"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,27 @@ | ||
import { createRouter, createWebHashHistory } from 'vue-router' | ||
import Home from '../views/Home.vue' | ||
import { createRouter, createWebHashHistory } from "vue-router"; | ||
import Home from "../views/Home.vue"; | ||
|
||
const routes = [ | ||
{ | ||
path: '/', | ||
name: 'Home', | ||
component: Home | ||
}, | ||
{ | ||
path: '/docs', | ||
name: 'Docs', | ||
component: () => import('../views/Docs.vue') | ||
}, | ||
{ | ||
path: '/chat', | ||
name: 'Chat', | ||
component: () => import('../views/Chat.vue') | ||
} | ||
] | ||
{ | ||
path: "/", | ||
name: "Home", | ||
component: Home | ||
}, | ||
{ | ||
path: "/docs", | ||
name: "Docs", | ||
component: () => import("../views/Docs.vue") | ||
}, | ||
{ | ||
path: "/chat", | ||
name: "Chat", | ||
component: () => import("../views/Chat.vue") | ||
} | ||
]; | ||
|
||
const router = createRouter({ | ||
history: createWebHashHistory(process.env.BASE_URL), | ||
routes | ||
}) | ||
history: createWebHashHistory(process.env.BASE_URL), | ||
routes | ||
}); | ||
|
||
export default router | ||
export default router; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,36 @@ | ||
const forge = require("node-forge"); | ||
|
||
function encryptMessage(message, publicKey) { | ||
const key = forge.random.getBytesSync(32); | ||
const iv = forge.random.getBytesSync(16); | ||
const key = forge.random.getBytesSync(32); | ||
const iv = forge.random.getBytesSync(16); | ||
|
||
const cipher = forge.cipher.createCipher("AES-CBC", key); | ||
cipher.start({ iv }); | ||
cipher.update(forge.util.createBuffer(message)); | ||
cipher.finish(); | ||
const encrypted = cipher.output; | ||
const cipher = forge.cipher.createCipher("AES-CBC", key); | ||
cipher.start({ iv }); | ||
cipher.update(forge.util.createBuffer(message)); | ||
cipher.finish(); | ||
const encrypted = cipher.output; | ||
|
||
return { | ||
encrypted: encrypted.getBytes(), | ||
key: publicKey.encrypt(key), | ||
iv: iv, | ||
}; | ||
return { | ||
encrypted: encrypted.getBytes(), | ||
key: publicKey.encrypt(key), | ||
iv: iv, | ||
}; | ||
} | ||
|
||
function decryptMessage(message, privateKey) { | ||
const key = privateKey.decrypt(message.key); | ||
const { encrypted, iv } = message; | ||
const key = privateKey.decrypt(message.key); | ||
const { encrypted, iv } = message; | ||
|
||
const decipher = forge.cipher.createDecipher("AES-CBC", key); | ||
decipher.start({ iv }); | ||
decipher.update(forge.util.createBuffer(encrypted)); | ||
decipher.finish(); | ||
const decipher = forge.cipher.createDecipher("AES-CBC", key); | ||
decipher.start({ iv }); | ||
decipher.update(forge.util.createBuffer(encrypted)); | ||
decipher.finish(); | ||
|
||
const decrypted = decipher.output.toString(); | ||
return decrypted; | ||
const decrypted = decipher.output.toString(); | ||
return decrypted; | ||
} | ||
|
||
module.exports = { | ||
encryptMessage, | ||
decryptMessage, | ||
encryptMessage, | ||
decryptMessage, | ||
}; |
Oops, something went wrong.