current stand

This commit is contained in:
Myzel394 2022-12-28 18:50:29 +01:00
parent 61291147c2
commit d3276e7e6e
4 changed files with 43 additions and 6 deletions

View File

@ -0,0 +1,13 @@
import getEncryptionPassword from "../src/utils/get-encryption-password"
describe("getEncryptionPassword", () => {
it("is defined", () => {
expect(getEncryptionPassword).toBeDefined()
})
it("returns a string", async () => {
const result = await getEncryptionPassword("test@kleckrelay.example", "password", "salt")
expect(typeof result).toBe("string")
})
})

View File

@ -6,7 +6,8 @@
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
"build": "tsc && vite build", "build": "tsc && vite build",
"preview": "vite preview" "preview": "vite preview",
"test": "jest"
}, },
"dependencies": { "dependencies": {
"@emotion/react": "^11.10.4", "@emotion/react": "^11.10.4",
@ -49,13 +50,14 @@
"yup-locales": "^1.2.10" "yup-locales": "^1.2.10"
}, },
"devDependencies": { "devDependencies": {
"@peculiar/webcrypto": "^1.4.1",
"@types/crypto-js": "^4.1.1", "@types/crypto-js": "^4.1.1",
"@types/date-fns": "^2.6.0", "@types/date-fns": "^2.6.0",
"@types/deep-equal": "^1.0.1", "@types/deep-equal": "^1.0.1",
"@types/group-array": "^1.0.1", "@types/group-array": "^1.0.1",
"@types/jest": "^29.2.4",
"@types/node": "^18.11.18",
"@types/openpgp": "^4.4.18", "@types/openpgp": "^4.4.18",
"@types/react": "^18.0.17",
"@types/react-dom": "^18.0.6",
"@types/react-icons": "^3.0.0", "@types/react-icons": "^3.0.0",
"@types/react-router": "^5.1.19", "@types/react-router": "^5.1.19",
"@types/react-router-dom": "^5.3.3", "@types/react-router-dom": "^5.3.3",
@ -72,12 +74,33 @@
"eslint-plugin-ordered-imports": "^0.6.0", "eslint-plugin-ordered-imports": "^0.6.0",
"eslint-plugin-react": "^7.31.10", "eslint-plugin-react": "^7.31.10",
"eslint-plugin-react-i18n": "^1.0.3", "eslint-plugin-react-i18n": "^1.0.3",
"jest": "^29.3.1",
"jest-environment-jsdom": "^29.3.1",
"prettier": "^2.7.1", "prettier": "^2.7.1",
"ts-jest": "^29.0.3",
"typescript": "^4.6.4", "typescript": "^4.6.4",
"vite": "^3.1.0" "vite": "^3.1.0"
}, },
"browserslist": [ "browserslist": [
"defaults", "defaults",
"not op_mini all" "not op_mini all"
] ],
"jest": {
"preset": "ts-jest",
"testEnvironment": "jsdom",
"transform": {
"^.+\\.tsx?$": "ts-jest"
},
"testMatch": [
"**/__tests__/**/*.test.ts?(x)"
],
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"jsx",
"json",
"node"
]
}
} }

View File

@ -79,6 +79,7 @@ export interface ServerSettings {
emailResendWaitTime: number emailResendWaitTime: number
emailLoginExpirationInSeconds: number emailLoginExpirationInSeconds: number
customAliasSuffixLength: number customAliasSuffixLength: number
instanceSalt: string
} }
export interface Alias { export interface Alias {

View File

@ -1,5 +1,5 @@
import Crypto from "crypto-js" import Crypto from "crypto-js"
export default function encryptString(value: string, password: string): string { export default function encryptString(value: string, key: CryptoKey): string {
return Crypto.AES.encrypt(value, password).toString() return Crypto.AES.encrypt(value).toString()
} }