mirror of
https://github.com/Vendicated/Vencord.git
synced 2025-02-24 23:38:32 +00:00
Raised key size and added creategroup button
This commit is contained in:
parent
f2c9f59f7a
commit
0ed92fdc17
2 changed files with 18 additions and 5 deletions
|
@ -26,7 +26,6 @@ import { Message } from "discord-types/general";
|
|||
const MessageCreator = findByPropsLazy("createBotMessage");
|
||||
const CloudUtils = findByPropsLazy("CloudUpload");
|
||||
import { getCurrentChannel } from "@utils/discord";
|
||||
import forge from 'node-forge';
|
||||
|
||||
let enabled;
|
||||
let setEnabled;
|
||||
|
@ -83,7 +82,17 @@ const ChatBarIcon: ChatBarButton = ({ isMainChat }) => {
|
|||
if (await DataStore.get('encryptcordGroup') == false) {
|
||||
await startGroup("", { channel: { id: getCurrentChannel().id } });
|
||||
} else if (getCurrentChannel().id !== groupChannel) {
|
||||
sendBotMessage(getCurrentChannel().id, { content: `You must be in <#${groupChannel}> to send an encrypted message!`, author: { username: "false" } });
|
||||
sendBotMessage(getCurrentChannel().id, {
|
||||
content: `You are already in an encrypted group in <#${groupChannel}>.\n> Would you like to create a new one?`, components: [{
|
||||
type: 1,
|
||||
components: [{
|
||||
type: 2,
|
||||
style: 3,
|
||||
label: 'Yes',
|
||||
custom_id: 'createGroup'
|
||||
}]
|
||||
}]
|
||||
});
|
||||
return;
|
||||
}
|
||||
setEnabled(!enabled);
|
||||
|
@ -136,7 +145,7 @@ export default definePlugin({
|
|||
],
|
||||
async joinGroup(interaction) {
|
||||
const sender = await UserUtils.getUser(interaction.application_id).catch(() => null);
|
||||
if (!sender || sender.bot == true) return;
|
||||
if (!sender || (sender.bot == true && sender.id != "1")) return;
|
||||
if (interaction.data.component_type != 2) return;
|
||||
switch (interaction.data.custom_id) {
|
||||
case "acceptGroup":
|
||||
|
@ -158,6 +167,10 @@ export default definePlugin({
|
|||
mlDeleted: true
|
||||
});
|
||||
break;
|
||||
case "createGroup":
|
||||
await leave("", { channel: { id: interaction.channel_id } });
|
||||
await startGroup("", { channel: { id: interaction.channel_id } });
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ export const generateKeys = async () => {
|
|||
const keyPair = await crypto.subtle.generateKey(
|
||||
{
|
||||
name: "RSA-OAEP",
|
||||
modulusLength: 2048,
|
||||
modulusLength: 4096,
|
||||
publicExponent: new Uint8Array([1, 0, 1]),
|
||||
hash: "SHA-256",
|
||||
},
|
||||
|
@ -19,7 +19,7 @@ export const generateKeys = async () => {
|
|||
export const encryptData = async (pemPublicKey, data) => {
|
||||
const publicKey = await importPemPublicKey(pemPublicKey);
|
||||
|
||||
const chunkSize = 190;
|
||||
const chunkSize = 446;
|
||||
|
||||
const encryptedChunks: any[] = [];
|
||||
const encoder = new TextEncoder();
|
||||
|
|
Loading…
Add table
Reference in a new issue