diff --git a/app/providers/AttachmentProvider/useAttachment.ts b/app/providers/AttachmentProvider/useAttachment.ts index f7768f2..d153d60 100644 --- a/app/providers/AttachmentProvider/useAttachment.ts +++ b/app/providers/AttachmentProvider/useAttachment.ts @@ -4,7 +4,7 @@ import { useUploadStatus } from "../TransportProvider/useUploadStatus"; import { useFileStorage } from "../../hooks/useFileStorage"; import { usePublicKey } from "../AccountProvider/usePublicKey"; import { usePrivatePlain } from "../AccountProvider/usePrivatePlain"; -import { decodeWithPassword, encodeWithPassword, generateMd5 } from "../../crypto/crypto"; +import { decodeWithPassword, encodeWithPassword, generateMd5 } from "../../workers/crypto/crypto"; import { useTransport } from "../TransportProvider/useTransport"; import { useDialogsCache } from "../DialogProvider/useDialogsCache"; import { useConsoleLogger } from "../../hooks/useConsoleLogger"; diff --git a/app/providers/AvatarProvider/AvatarProvider.tsx b/app/providers/AvatarProvider/AvatarProvider.tsx index de3e3de..0ef4274 100644 --- a/app/providers/AvatarProvider/AvatarProvider.tsx +++ b/app/providers/AvatarProvider/AvatarProvider.tsx @@ -2,7 +2,7 @@ import { useDatabase } from "@/app/providers/DatabaseProvider/useDatabase"; import { createContext, useEffect, useRef, useState } from "react"; import { usePublicKey } from "../AccountProvider/usePublicKey"; import { useFileStorage } from "@/app/hooks/useFileStorage"; -import { decodeWithPassword, encodeWithPassword, generateMd5 } from "@/app/crypto/crypto"; +import { decodeWithPassword, encodeWithPassword, generateMd5 } from "@/app/workers/crypto/crypto"; import { useConsoleLogger } from "@/app/hooks/useConsoleLogger"; import { useSystemAccounts } from "../SystemAccountsProvider/useSystemAccounts"; import { AVATAR_PASSWORD_TO_ENCODE } from "@/app/constants"; diff --git a/app/providers/DialogListProvider/useDialogInfo.ts b/app/providers/DialogListProvider/useDialogInfo.ts index 7684874..cd576bb 100644 --- a/app/providers/DialogListProvider/useDialogInfo.ts +++ b/app/providers/DialogListProvider/useDialogInfo.ts @@ -2,7 +2,7 @@ import { useEffect, useState } from "react"; import { DialogRow } from "./DialogListProvider"; import { useDatabase } from "@/app/providers/DatabaseProvider/useDatabase"; import { usePublicKey } from "../AccountProvider/usePublicKey"; -import { decodeWithPassword } from "@/app/crypto/crypto"; +import { decodeWithPassword } from "@/app/workers/crypto/crypto"; import { constructLastMessageTextByAttachments } from "@/app/utils/constructLastMessageTextByAttachments"; import { usePrivatePlain } from "../AccountProvider/usePrivatePlain"; import { DeliveredMessageState, Message } from "../DialogProvider/DialogProvider"; diff --git a/app/providers/DialogProvider/DialogProvider.tsx b/app/providers/DialogProvider/DialogProvider.tsx index 7aed63d..d5fe8b7 100644 --- a/app/providers/DialogProvider/DialogProvider.tsx +++ b/app/providers/DialogProvider/DialogProvider.tsx @@ -1,4 +1,4 @@ -import { chacha20Decrypt, decodeWithPassword, decrypt, encodeWithPassword, generateMd5 } from '@/app/crypto/crypto'; +import { chacha20Decrypt, decodeWithPassword, decrypt, encodeWithPassword, generateMd5 } from '@/app/workers/crypto/crypto'; import { useDatabase } from '@/app/providers/DatabaseProvider/useDatabase'; import { createContext, useEffect, useRef, useState } from 'react'; import { Attachment, AttachmentType, PacketMessage } from '@/app/providers/ProtocolProvider/protocol/packets/packet.message'; diff --git a/app/providers/DialogProvider/useDialog.ts b/app/providers/DialogProvider/useDialog.ts index 5ebfcd5..4b54615 100644 --- a/app/providers/DialogProvider/useDialog.ts +++ b/app/providers/DialogProvider/useDialog.ts @@ -1,6 +1,6 @@ import { useContext } from "react"; import { useDatabase } from "../DatabaseProvider/useDatabase"; -import { chacha20Encrypt, encodeWithPassword, encrypt, generateMd5} from "../../crypto/crypto"; +import { chacha20Encrypt, encodeWithPassword, encrypt, generateMd5} from "../../workers/crypto/crypto"; import { AttachmentMeta, DeliveredMessageState, DialogContext, Message } from "./DialogProvider"; import { Attachment, AttachmentType, PacketMessage } from "@/app/providers/ProtocolProvider/protocol/packets/packet.message"; import { usePublicKey } from "../AccountProvider/usePublicKey"; diff --git a/app/providers/DialogProvider/useDialogFiber.ts b/app/providers/DialogProvider/useDialogFiber.ts index 0831a27..4ee0a24 100644 --- a/app/providers/DialogProvider/useDialogFiber.ts +++ b/app/providers/DialogProvider/useDialogFiber.ts @@ -12,7 +12,7 @@ import { useDialogsCache } from "./useDialogsCache"; import { useDatabase } from "@/app/providers/DatabaseProvider/useDatabase"; import { usePrivatePlain } from "../AccountProvider/usePrivatePlain"; import { usePublicKey } from "../AccountProvider/usePublicKey"; -import { chacha20Decrypt, decodeWithPassword, decrypt, encodeWithPassword, generateMd5 } from "@/app/crypto/crypto"; +import { chacha20Decrypt, decodeWithPassword, decrypt, encodeWithPassword, generateMd5 } from "@/app/workers/crypto/crypto"; import { DeliveredMessageState, Message } from "./DialogProvider"; import { PacketRead } from "../ProtocolProvider/protocol/packets/packet.read"; import { PacketDelivery } from "../ProtocolProvider/protocol/packets/packet.delivery"; diff --git a/app/providers/DialogProvider/useGroups.ts b/app/providers/DialogProvider/useGroups.ts index 6f70dc8..78499d6 100644 --- a/app/providers/DialogProvider/useGroups.ts +++ b/app/providers/DialogProvider/useGroups.ts @@ -1,6 +1,6 @@ import { useDatabase } from "@/app/providers/DatabaseProvider/useDatabase"; import { usePrivatePlain } from "../AccountProvider/usePrivatePlain"; -import { decodeWithPassword, encodeWithPassword } from "@/app/crypto/crypto"; +import { decodeWithPassword, encodeWithPassword } from "@/app/workers/crypto/crypto"; import { generateRandomKey } from "@/app/utils/utils"; import { useDialogsList } from "../DialogListProvider/useDialogsList"; import { usePublicKey } from "../AccountProvider/usePublicKey"; diff --git a/app/providers/SystemAccountsProvider/SystemAccountsProvider.tsx b/app/providers/SystemAccountsProvider/SystemAccountsProvider.tsx index 9e14da3..8ec8713 100644 --- a/app/providers/SystemAccountsProvider/SystemAccountsProvider.tsx +++ b/app/providers/SystemAccountsProvider/SystemAccountsProvider.tsx @@ -3,7 +3,7 @@ import { createContext } from "react"; import { useSystemAccount } from "./useSystemAccount"; import { usePublicKey } from "../AccountProvider/usePublicKey"; import { usePrivatePlain } from "../AccountProvider/usePrivatePlain"; -import { chacha20Encrypt, encodeWithPassword, encrypt } from "@/app/crypto/crypto"; +import { chacha20Encrypt, encodeWithPassword, encrypt } from "@/app/workers/crypto/crypto"; import { generateRandomKey } from "@/app/utils/utils"; import { DeliveredMessageState } from "../DialogProvider/DialogProvider"; import { UserInformation } from "../InformationProvider/InformationProvider"; diff --git a/app/providers/SystemProvider/SystemProvider.tsx b/app/providers/SystemProvider/SystemProvider.tsx index 906aa06..3ced45c 100644 --- a/app/providers/SystemProvider/SystemProvider.tsx +++ b/app/providers/SystemProvider/SystemProvider.tsx @@ -1,4 +1,4 @@ -import { decodeWithPassword, encodeWithPassword } from "@/app/crypto/crypto"; +import { decodeWithPassword, encodeWithPassword } from "@/app/workers/crypto/crypto"; import { useFileStorage } from "@/app/hooks/useFileStorage"; import { generateRandomKey } from "@/app/utils/utils"; import { createContext, useEffect, useState } from "react"; diff --git a/app/views/Backup/Backup.tsx b/app/views/Backup/Backup.tsx index 411aadf..0cb7317 100644 --- a/app/views/Backup/Backup.tsx +++ b/app/views/Backup/Backup.tsx @@ -3,7 +3,7 @@ import { InternalScreen } from "@/app/components/InternalScreen/InternalScreen"; import { SettingsAlert } from "@/app/components/SettingsAlert/SettingsAlert"; import { SettingsInput } from "@/app/components/SettingsInput/SettingsInput"; import { TextChain } from "@/app/components/TextChain/TextChain"; -import { decodeWithPassword } from "@/app/crypto/crypto"; +import { decodeWithPassword } from "@/app/workers/crypto/crypto"; import { useAccount } from "@/app/providers/AccountProvider/useAccount"; import { Text } from "@mantine/core"; import { useState } from "react"; diff --git a/app/views/Lockscreen/Lockscreen.tsx b/app/views/Lockscreen/Lockscreen.tsx index 80697fc..c634c61 100644 --- a/app/views/Lockscreen/Lockscreen.tsx +++ b/app/views/Lockscreen/Lockscreen.tsx @@ -3,7 +3,7 @@ import classes from './Lockscreen.module.css' import { useEffect, useState } from "react"; import { useNavigate } from "react-router-dom"; import useWindow from "@/app/hooks/useWindow"; -import { decodeWithPassword, generateHashFromPrivateKey } from "@/app/crypto/crypto"; +import { decodeWithPassword, generateHashFromPrivateKey } from "@/app/workers/crypto/crypto"; import { useAccountProvider } from "@/app/providers/AccountProvider/useAccountProvider"; import { Account, AccountBase } from "@/app/providers/AccountProvider/AccountProvider"; import { useUserCache } from "@/app/providers/InformationProvider/useUserCache"; diff --git a/app/views/SetPassword/SetPassword.tsx b/app/views/SetPassword/SetPassword.tsx index 82e729a..11692ab 100644 --- a/app/views/SetPassword/SetPassword.tsx +++ b/app/views/SetPassword/SetPassword.tsx @@ -7,7 +7,7 @@ import { mnemonicToSeed } from "web-bip39"; import { useNavigate } from "react-router-dom"; import { modals } from "@mantine/modals"; import { Buffer } from 'buffer' -import { encodeWithPassword, generateHashFromPrivateKey, generateKeyPairFromSeed } from "@/app/crypto/crypto"; +import { encodeWithPassword, generateHashFromPrivateKey, generateKeyPairFromSeed } from "@/app/workers/crypto/crypto"; import { useAccountProvider } from "@/app/providers/AccountProvider/useAccountProvider"; import { Account } from "@/app/providers/AccountProvider/AccountProvider"; import { useRosettaColors } from "@/app/hooks/useRosettaColors"; diff --git a/app/crypto/crypto.ts b/app/workers/crypto/crypto.ts similarity index 98% rename from app/crypto/crypto.ts rename to app/workers/crypto/crypto.ts index f7913bf..f809f28 100644 --- a/app/crypto/crypto.ts +++ b/app/workers/crypto/crypto.ts @@ -1,5 +1,5 @@ import { sha256, md5 } from "node-forge"; -import { generateRandomKey } from "../utils/utils"; +import { generateRandomKey } from "../../utils/utils"; import * as secp256k1 from '@noble/secp256k1'; const worker = new Worker(new URL('./crypto.worker.ts', import.meta.url), { type: 'module' }); diff --git a/app/crypto/crypto.worker.ts b/app/workers/crypto/crypto.worker.ts similarity index 100% rename from app/crypto/crypto.worker.ts rename to app/workers/crypto/crypto.worker.ts