From a6dd25d1c566bf7463b3191003fb9f95e1b78a91 Mon Sep 17 00:00:00 2001 From: bjarneo Date: Sat, 27 Jan 2024 18:46:31 +0100 Subject: [PATCH] chore: run prettier format with new plugins --- .prettierrc | 5 +- package-lock.json | 108 ++++++++++++++++-- package.json | 6 +- src/client/actions/index.js | 2 +- src/client/admin-shell.jsx | 10 +- src/client/app-shell.jsx | 2 +- src/client/app.jsx | 2 +- src/client/components/header/index.jsx | 17 ++- src/client/components/header/nav.jsx | 6 +- src/client/components/qrlink/index.jsx | 5 +- src/client/components/settings/main-links.jsx | 4 +- .../components/settings/secondary-links.jsx | 2 +- src/client/components/spinner/index.jsx | 1 - .../components/spinner/style.module.css | 104 ++++++++++++----- src/client/reducers/index.js | 2 +- src/client/routes.jsx | 4 +- src/client/routes/account/account.jsx | 18 +-- src/client/routes/account/index.jsx | 4 +- src/client/routes/account/secrets.jsx | 6 +- src/client/routes/account/settings.jsx | 6 +- src/client/routes/account/users.jsx | 22 ++-- src/client/routes/api-docs/index.jsx | 3 +- src/client/routes/home/index.jsx | 46 ++++---- src/client/routes/privacy/index.jsx | 3 +- src/client/routes/public/index.jsx | 8 +- src/client/routes/secret/index.jsx | 16 +-- src/client/routes/signin/index.jsx | 12 +- src/client/routes/signout/index.jsx | 8 +- src/client/routes/signup/index.jsx | 12 +- src/client/routes/terms/index.jsx | 3 +- src/index.jsx | 4 +- src/server/bootstrap.js | 2 +- src/server/controllers/account.js | 2 +- src/server/controllers/admin/settings.js | 2 +- src/server/controllers/authentication.js | 4 +- src/server/controllers/download.js | 2 +- src/server/controllers/secret.js | 6 +- src/server/decorators/allowed-ip.js | 2 +- src/server/decorators/user-features.js | 2 +- src/server/prehandlers/read-only.js | 2 +- src/server/services/disk.js | 2 +- src/server/services/do.js | 4 +- src/server/services/prisma.js | 1 - src/service-worker.js | 2 +- src/shared/helpers/crypto.js | 2 +- 45 files changed, 312 insertions(+), 174 deletions(-) diff --git a/.prettierrc b/.prettierrc index 8f14ab1e..e634b777 100644 --- a/.prettierrc +++ b/.prettierrc @@ -5,5 +5,6 @@ "singleQuote": true, "arrowParens": "always", "jsxSingleQuote": false, - "printWidth": 100 -} \ No newline at end of file + "printWidth": 100, + "plugins": ["prettier-plugin-prisma", "prettier-plugin-organize-imports"] +} diff --git a/package-lock.json b/package-lock.json index 600c35fa..9f22ab12 100644 --- a/package-lock.json +++ b/package-lock.json @@ -66,7 +66,9 @@ "lint-staged": "^11.0.0", "mocha": "^10.0.0", "nodemon": "^2.0.7", - "prettier": "^2.3.1", + "prettier": "^3.2.4", + "prettier-plugin-organize-imports": "^3.2.4", + "prettier-plugin-prisma": "^5.0.0", "prisma": "^4.12.0", "react": "^17.0.2", "react-dom": "^17.0.2", @@ -2291,6 +2293,12 @@ "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-4.12.0-67.659ef412370fa3b41cd7bf6e94587c1dfb7f67e7.tgz", "integrity": "sha512-JIHNj5jlXb9mcaJwakM0vpgRYJIAurxTUqM0iX0tfEQA5XLZ9ONkIckkhuAKdAzocZ+80GYg7QSsfpjg7OxbOA==" }, + "node_modules/@prisma/prisma-schema-wasm": { + "version": "4.17.0-26.6b0aef69b7cdfc787f822ecd7cdc76d5f1991584", + "resolved": "https://registry.npmjs.org/@prisma/prisma-schema-wasm/-/prisma-schema-wasm-4.17.0-26.6b0aef69b7cdfc787f822ecd7cdc76d5f1991584.tgz", + "integrity": "sha512-JFdsnSgBPN8reDTLOI9Vh/6ccCb2aD1LbY/LWQnkcIgNo6IdpzvuM+qRVbBuA6IZP2SdqQI8Lu6RL2P8EFBQUA==", + "dev": true + }, "node_modules/@radix-ui/number": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/@radix-ui/number/-/number-1.0.0.tgz", @@ -6715,15 +6723,54 @@ } }, "node_modules/prettier": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.3.2.tgz", - "integrity": "sha512-lnJzDfJ66zkMy58OL5/NY5zp70S7Nz6KqcKkXYzn2tMVrNxvbqaBpg7H3qHaLxCJ5lNMsGuM8+ohS7cZrthdLQ==", + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.4.tgz", + "integrity": "sha512-FWu1oLHKCrtpO1ypU6J0SbK2d9Ckwysq6bHj/uaCP26DxrPpppCLQRGVuqAxSTvhF00AcvDRyYrLNW7ocBhFFQ==", "dev": true, "bin": { - "prettier": "bin-prettier.js" + "prettier": "bin/prettier.cjs" }, "engines": { - "node": ">=10.13.0" + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/prettier-plugin-organize-imports": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/prettier-plugin-organize-imports/-/prettier-plugin-organize-imports-3.2.4.tgz", + "integrity": "sha512-6m8WBhIp0dfwu0SkgfOxJqh+HpdyfqSSLfKKRZSFbDuEQXDDndb8fTpRWkUrX/uBenkex3MgnVk0J3b3Y5byog==", + "dev": true, + "peerDependencies": { + "@volar/vue-language-plugin-pug": "^1.0.4", + "@volar/vue-typescript": "^1.0.4", + "prettier": ">=2.0", + "typescript": ">=2.9" + }, + "peerDependenciesMeta": { + "@volar/vue-language-plugin-pug": { + "optional": true + }, + "@volar/vue-typescript": { + "optional": true + } + } + }, + "node_modules/prettier-plugin-prisma": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/prettier-plugin-prisma/-/prettier-plugin-prisma-5.0.0.tgz", + "integrity": "sha512-jTJV04D9+yF7ziOOMs7CJe4ijgAH7DEGjt0SAWAToGNRy1H6BEhvcKA2UQH6gC6KVW5zeeOSAvsoiDDTt9oKXg==", + "dev": true, + "dependencies": { + "@prisma/prisma-schema-wasm": "4.17.0-26.6b0aef69b7cdfc787f822ecd7cdc76d5f1991584" + }, + "engines": { + "node": ">=14", + "npm": ">=8" + }, + "peerDependencies": { + "prettier": ">=2 || >=3" } }, "node_modules/pretty-bytes": { @@ -8103,6 +8150,20 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/typescript": { + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", + "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", + "dev": true, + "peer": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, "node_modules/undefsafe": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", @@ -10300,6 +10361,12 @@ "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-4.12.0-67.659ef412370fa3b41cd7bf6e94587c1dfb7f67e7.tgz", "integrity": "sha512-JIHNj5jlXb9mcaJwakM0vpgRYJIAurxTUqM0iX0tfEQA5XLZ9ONkIckkhuAKdAzocZ+80GYg7QSsfpjg7OxbOA==" }, + "@prisma/prisma-schema-wasm": { + "version": "4.17.0-26.6b0aef69b7cdfc787f822ecd7cdc76d5f1991584", + "resolved": "https://registry.npmjs.org/@prisma/prisma-schema-wasm/-/prisma-schema-wasm-4.17.0-26.6b0aef69b7cdfc787f822ecd7cdc76d5f1991584.tgz", + "integrity": "sha512-JFdsnSgBPN8reDTLOI9Vh/6ccCb2aD1LbY/LWQnkcIgNo6IdpzvuM+qRVbBuA6IZP2SdqQI8Lu6RL2P8EFBQUA==", + "dev": true + }, "@radix-ui/number": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/@radix-ui/number/-/number-1.0.0.tgz", @@ -13570,11 +13637,27 @@ } }, "prettier": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.3.2.tgz", - "integrity": "sha512-lnJzDfJ66zkMy58OL5/NY5zp70S7Nz6KqcKkXYzn2tMVrNxvbqaBpg7H3qHaLxCJ5lNMsGuM8+ohS7cZrthdLQ==", + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.4.tgz", + "integrity": "sha512-FWu1oLHKCrtpO1ypU6J0SbK2d9Ckwysq6bHj/uaCP26DxrPpppCLQRGVuqAxSTvhF00AcvDRyYrLNW7ocBhFFQ==", "dev": true }, + "prettier-plugin-organize-imports": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/prettier-plugin-organize-imports/-/prettier-plugin-organize-imports-3.2.4.tgz", + "integrity": "sha512-6m8WBhIp0dfwu0SkgfOxJqh+HpdyfqSSLfKKRZSFbDuEQXDDndb8fTpRWkUrX/uBenkex3MgnVk0J3b3Y5byog==", + "dev": true, + "requires": {} + }, + "prettier-plugin-prisma": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/prettier-plugin-prisma/-/prettier-plugin-prisma-5.0.0.tgz", + "integrity": "sha512-jTJV04D9+yF7ziOOMs7CJe4ijgAH7DEGjt0SAWAToGNRy1H6BEhvcKA2UQH6gC6KVW5zeeOSAvsoiDDTt9oKXg==", + "dev": true, + "requires": { + "@prisma/prisma-schema-wasm": "4.17.0-26.6b0aef69b7cdfc787f822ecd7cdc76d5f1991584" + } + }, "pretty-bytes": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-4.0.2.tgz", @@ -14599,6 +14682,13 @@ "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", "dev": true }, + "typescript": { + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", + "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", + "dev": true, + "peer": true + }, "undefsafe": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", diff --git a/package.json b/package.json index 50ef782c..aeebb490 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "docker-run": "docker run -p 3000:3000 -d --name=hemmelig -v ./data/hemmelig/:/var/tmp/hemmelig/upload/files -v ./database/:/home/node/hemmelig/database/ hemmelig", "production-test": "npm run docker-build && npm run docker-run", "prepare": "husky install", - "prettier": "prettier --write --ignore-unknown src/", + "prettier": "prettier --write --ignore-unknown src/ prisma/", "publish-cli": "rm -rf dist/ && npx microbundle build --target node -i cli.js -o dist/ && npm publish", "pkg": "rm -rf dist/ bin/ && npx esbuild cli.js --bundle --platform=node --outfile=dist/cli.cjs --define:import.meta.url=__dirname && npx pkg dist/cli.cjs --targets=node18-linux-arm64 --output=bin/hemmelig" }, @@ -88,7 +88,9 @@ "lint-staged": "^11.0.0", "mocha": "^10.0.0", "nodemon": "^2.0.7", - "prettier": "^2.3.1", + "prettier": "^3.2.4", + "prettier-plugin-organize-imports": "^3.2.4", + "prettier-plugin-prisma": "^5.0.0", "prisma": "^4.12.0", "react": "^17.0.2", "react-dom": "^17.0.2", diff --git a/src/client/actions/index.js b/src/client/actions/index.js index ddef195c..01519254 100644 --- a/src/client/actions/index.js +++ b/src/client/actions/index.js @@ -1,4 +1,4 @@ -import { USER_LOGIN_CHANGED, USER_LOGIN } from '../util/constants'; +import { USER_LOGIN, USER_LOGIN_CHANGED } from '../util/constants'; export const userLoginChanged = (payload) => { return { diff --git a/src/client/admin-shell.jsx b/src/client/admin-shell.jsx index 37e223aa..538bd2ca 100644 --- a/src/client/admin-shell.jsx +++ b/src/client/admin-shell.jsx @@ -1,11 +1,11 @@ -import { Outlet, Link } from 'react-router-dom'; -import { AppShell, Anchor, Navbar, Header, Group, useMantineTheme } from '@mantine/core'; +import { Anchor, AppShell, Group, Header, Navbar, useMantineTheme } from '@mantine/core'; +import { Link, Outlet } from 'react-router-dom'; -import MainLinks from './components/settings/main-links'; -import SecondaryLinks from './components/settings/secondary-links'; -import Nav from './components/header/nav'; import Logo from './components/header/logo'; +import Nav from './components/header/nav'; import logoStyles from './components/header/style.module.css'; +import MainLinks from './components/settings/main-links'; +import SecondaryLinks from './components/settings/secondary-links'; const AdminShell = () => { const theme = useMantineTheme(); diff --git a/src/client/app-shell.jsx b/src/client/app-shell.jsx index 3a9c25ef..f32a8b78 100644 --- a/src/client/app-shell.jsx +++ b/src/client/app-shell.jsx @@ -1,5 +1,5 @@ +import { Anchor, AppShell, Footer, Group, Header, Text, useMantineTheme } from '@mantine/core'; import { Link, Outlet } from 'react-router-dom'; -import { AppShell, Anchor, Header, Footer, Text, useMantineTheme, Group } from '@mantine/core'; import { useMediaQuery } from '@mantine/hooks'; import { useTranslation } from 'react-i18next'; diff --git a/src/client/app.jsx b/src/client/app.jsx index 0ad7a483..d258af5a 100644 --- a/src/client/app.jsx +++ b/src/client/app.jsx @@ -1,6 +1,6 @@ -import { BrowserRouter } from 'react-router-dom'; import { MantineProvider } from '@mantine/core'; import { ModalsProvider } from '@mantine/modals'; +import { BrowserRouter } from 'react-router-dom'; import AppRoutes from './routes.jsx'; const HemmeligApplication = () => { diff --git a/src/client/components/header/index.jsx b/src/client/components/header/index.jsx index d3dfc29e..5b7a5ab1 100644 --- a/src/client/components/header/index.jsx +++ b/src/client/components/header/index.jsx @@ -1,18 +1,17 @@ -import { Link } from 'react-router-dom'; -import { useEffect, useState } from 'react'; -import { useDispatch, useSelector } from 'react-redux'; -import { Navigate } from 'react-router-dom'; -import { Anchor, Burger, Container, Group, Grid, Modal, Button } from '@mantine/core'; +import { Anchor, Burger, Button, Container, Grid, Group, Modal } from '@mantine/core'; import { useDisclosure } from '@mantine/hooks'; +import { useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; +import { useDispatch, useSelector } from 'react-redux'; +import { Link, Navigate } from 'react-router-dom'; -import Nav from './nav'; -import { userLoginChanged, userLogin } from '../../actions/'; -import Logo from './logo.jsx'; +import { userLogin, userLoginChanged } from '../../actions/'; import { getCookie, refreshCookie } from '../../helpers/cookie'; +import Logo from './logo.jsx'; +import Nav from './nav'; -import style from './style.module.css'; import { refresh } from '../../api/authentication.js'; +import style from './style.module.css'; const Header = () => { const { t } = useTranslation(); diff --git a/src/client/components/header/nav.jsx b/src/client/components/header/nav.jsx index 1b63da33..0a74f537 100644 --- a/src/client/components/header/nav.jsx +++ b/src/client/components/header/nav.jsx @@ -1,8 +1,8 @@ -import { Link } from 'react-router-dom'; -import { NavLink, Group } from '@mantine/core'; +import { Group, NavLink } from '@mantine/core'; import { useMediaQuery } from '@mantine/hooks'; -import { IconUser, IconLockOff, IconLogin, IconFingerprint, IconList } from '@tabler/icons'; +import { IconFingerprint, IconList, IconLockOff, IconLogin, IconUser } from '@tabler/icons'; import { useTranslation } from 'react-i18next'; +import { Link } from 'react-router-dom'; import style from './style.module.css'; diff --git a/src/client/components/qrlink/index.jsx b/src/client/components/qrlink/index.jsx index 74896e94..af2c7604 100644 --- a/src/client/components/qrlink/index.jsx +++ b/src/client/components/qrlink/index.jsx @@ -1,7 +1,6 @@ -import React from 'react'; -import style from './style.module.css'; -import QRCode from 'react-qr-code'; import { Center } from '@mantine/core'; +import QRCode from 'react-qr-code'; +import style from './style.module.css'; const QRLink = ({ value }) => (
diff --git a/src/client/components/settings/main-links.jsx b/src/client/components/settings/main-links.jsx index 73b05a6d..2d284493 100644 --- a/src/client/components/settings/main-links.jsx +++ b/src/client/components/settings/main-links.jsx @@ -1,5 +1,5 @@ -import { IconUser, IconLock, IconSettings } from '@tabler/icons'; -import { ThemeIcon, UnstyledButton, Group, Text } from '@mantine/core'; +import { Group, Text, ThemeIcon, UnstyledButton } from '@mantine/core'; +import { IconLock, IconSettings, IconUser } from '@tabler/icons'; import { useTranslation } from 'react-i18next'; import { useNavigate } from 'react-router-dom'; diff --git a/src/client/components/settings/secondary-links.jsx b/src/client/components/settings/secondary-links.jsx index bb97b4ac..47082f4c 100644 --- a/src/client/components/settings/secondary-links.jsx +++ b/src/client/components/settings/secondary-links.jsx @@ -1,5 +1,5 @@ +import { Box, Group, Text, ThemeIcon, UnstyledButton, rem, useMantineTheme } from '@mantine/core'; import { IconFingerprint, IconList, IconLockOff } from '@tabler/icons'; -import { ThemeIcon, UnstyledButton, Group, Text, Box, useMantineTheme, rem } from '@mantine/core'; import { useTranslation } from 'react-i18next'; import { useNavigate } from 'react-router-dom'; diff --git a/src/client/components/spinner/index.jsx b/src/client/components/spinner/index.jsx index ca1d6c04..27942f71 100644 --- a/src/client/components/spinner/index.jsx +++ b/src/client/components/spinner/index.jsx @@ -1,4 +1,3 @@ -import React from 'react'; import style from './style.module.css'; const Spinner = () =>
Loading...
; diff --git a/src/client/components/spinner/style.module.css b/src/client/components/spinner/style.module.css index d43f8373..1acf68d2 100644 --- a/src/client/components/spinner/style.module.css +++ b/src/client/components/spinner/style.module.css @@ -12,64 +12,116 @@ -webkit-transform: translateZ(0); -ms-transform: translateZ(0); transform: translateZ(0); - -webkit-animation: load6 1.7s infinite ease, round 1.7s infinite ease; - animation: load6 1.7s infinite ease, round 1.7s infinite ease; + -webkit-animation: + load6 1.7s infinite ease, + round 1.7s infinite ease; + animation: + load6 1.7s infinite ease, + round 1.7s infinite ease; } @-webkit-keyframes load6 { 0% { - box-shadow: 0 -0.83em 0 -0.4em, 0 -0.83em 0 -0.42em, 0 -0.83em 0 -0.44em, - 0 -0.83em 0 -0.46em, 0 -0.83em 0 -0.477em; + box-shadow: + 0 -0.83em 0 -0.4em, + 0 -0.83em 0 -0.42em, + 0 -0.83em 0 -0.44em, + 0 -0.83em 0 -0.46em, + 0 -0.83em 0 -0.477em; } 5%, 95% { - box-shadow: 0 -0.83em 0 -0.4em, 0 -0.83em 0 -0.42em, 0 -0.83em 0 -0.44em, - 0 -0.83em 0 -0.46em, 0 -0.83em 0 -0.477em; + box-shadow: + 0 -0.83em 0 -0.4em, + 0 -0.83em 0 -0.42em, + 0 -0.83em 0 -0.44em, + 0 -0.83em 0 -0.46em, + 0 -0.83em 0 -0.477em; } 10%, 59% { - box-shadow: 0 -0.83em 0 -0.4em, -0.087em -0.825em 0 -0.42em, -0.173em -0.812em 0 -0.44em, - -0.256em -0.789em 0 -0.46em, -0.297em -0.775em 0 -0.477em; + box-shadow: + 0 -0.83em 0 -0.4em, + -0.087em -0.825em 0 -0.42em, + -0.173em -0.812em 0 -0.44em, + -0.256em -0.789em 0 -0.46em, + -0.297em -0.775em 0 -0.477em; } 20% { - box-shadow: 0 -0.83em 0 -0.4em, -0.338em -0.758em 0 -0.42em, -0.555em -0.617em 0 -0.44em, - -0.671em -0.488em 0 -0.46em, -0.749em -0.34em 0 -0.477em; + box-shadow: + 0 -0.83em 0 -0.4em, + -0.338em -0.758em 0 -0.42em, + -0.555em -0.617em 0 -0.44em, + -0.671em -0.488em 0 -0.46em, + -0.749em -0.34em 0 -0.477em; } 38% { - box-shadow: 0 -0.83em 0 -0.4em, -0.377em -0.74em 0 -0.42em, -0.645em -0.522em 0 -0.44em, - -0.775em -0.297em 0 -0.46em, -0.82em -0.09em 0 -0.477em; + box-shadow: + 0 -0.83em 0 -0.4em, + -0.377em -0.74em 0 -0.42em, + -0.645em -0.522em 0 -0.44em, + -0.775em -0.297em 0 -0.46em, + -0.82em -0.09em 0 -0.477em; } 100% { - box-shadow: 0 -0.83em 0 -0.4em, 0 -0.83em 0 -0.42em, 0 -0.83em 0 -0.44em, - 0 -0.83em 0 -0.46em, 0 -0.83em 0 -0.477em; + box-shadow: + 0 -0.83em 0 -0.4em, + 0 -0.83em 0 -0.42em, + 0 -0.83em 0 -0.44em, + 0 -0.83em 0 -0.46em, + 0 -0.83em 0 -0.477em; } } @keyframes load6 { 0% { - box-shadow: 0 -0.83em 0 -0.4em, 0 -0.83em 0 -0.42em, 0 -0.83em 0 -0.44em, - 0 -0.83em 0 -0.46em, 0 -0.83em 0 -0.477em; + box-shadow: + 0 -0.83em 0 -0.4em, + 0 -0.83em 0 -0.42em, + 0 -0.83em 0 -0.44em, + 0 -0.83em 0 -0.46em, + 0 -0.83em 0 -0.477em; } 5%, 95% { - box-shadow: 0 -0.83em 0 -0.4em, 0 -0.83em 0 -0.42em, 0 -0.83em 0 -0.44em, - 0 -0.83em 0 -0.46em, 0 -0.83em 0 -0.477em; + box-shadow: + 0 -0.83em 0 -0.4em, + 0 -0.83em 0 -0.42em, + 0 -0.83em 0 -0.44em, + 0 -0.83em 0 -0.46em, + 0 -0.83em 0 -0.477em; } 10%, 59% { - box-shadow: 0 -0.83em 0 -0.4em, -0.087em -0.825em 0 -0.42em, -0.173em -0.812em 0 -0.44em, - -0.256em -0.789em 0 -0.46em, -0.297em -0.775em 0 -0.477em; + box-shadow: + 0 -0.83em 0 -0.4em, + -0.087em -0.825em 0 -0.42em, + -0.173em -0.812em 0 -0.44em, + -0.256em -0.789em 0 -0.46em, + -0.297em -0.775em 0 -0.477em; } 20% { - box-shadow: 0 -0.83em 0 -0.4em, -0.338em -0.758em 0 -0.42em, -0.555em -0.617em 0 -0.44em, - -0.671em -0.488em 0 -0.46em, -0.749em -0.34em 0 -0.477em; + box-shadow: + 0 -0.83em 0 -0.4em, + -0.338em -0.758em 0 -0.42em, + -0.555em -0.617em 0 -0.44em, + -0.671em -0.488em 0 -0.46em, + -0.749em -0.34em 0 -0.477em; } 38% { - box-shadow: 0 -0.83em 0 -0.4em, -0.377em -0.74em 0 -0.42em, -0.645em -0.522em 0 -0.44em, - -0.775em -0.297em 0 -0.46em, -0.82em -0.09em 0 -0.477em; + box-shadow: + 0 -0.83em 0 -0.4em, + -0.377em -0.74em 0 -0.42em, + -0.645em -0.522em 0 -0.44em, + -0.775em -0.297em 0 -0.46em, + -0.82em -0.09em 0 -0.477em; } 100% { - box-shadow: 0 -0.83em 0 -0.4em, 0 -0.83em 0 -0.42em, 0 -0.83em 0 -0.44em, - 0 -0.83em 0 -0.46em, 0 -0.83em 0 -0.477em; + box-shadow: + 0 -0.83em 0 -0.4em, + 0 -0.83em 0 -0.42em, + 0 -0.83em 0 -0.44em, + 0 -0.83em 0 -0.46em, + 0 -0.83em 0 -0.477em; } } @-webkit-keyframes round { diff --git a/src/client/reducers/index.js b/src/client/reducers/index.js index 55516c76..472a794e 100644 --- a/src/client/reducers/index.js +++ b/src/client/reducers/index.js @@ -1,4 +1,4 @@ -import { USER_LOGIN_CHANGED, USER_LOGIN } from '../util/constants'; +import { USER_LOGIN, USER_LOGIN_CHANGED } from '../util/constants'; const initialState = { isLoggedIn: false, diff --git a/src/client/routes.jsx b/src/client/routes.jsx index a27fcec4..ff37d46a 100644 --- a/src/client/routes.jsx +++ b/src/client/routes.jsx @@ -1,7 +1,7 @@ import { lazy } from 'react'; -import { Routes, Route } from 'react-router-dom'; -import ApplicationShell from './app-shell.jsx'; +import { Route, Routes } from 'react-router-dom'; import AdminShell from './admin-shell.jsx'; +import ApplicationShell from './app-shell.jsx'; const Home = lazy(() => import('./routes/home')); const Secret = lazy(() => import('./routes/secret')); diff --git a/src/client/routes/account/account.jsx b/src/client/routes/account/account.jsx index e3c42924..4a044db9 100644 --- a/src/client/routes/account/account.jsx +++ b/src/client/routes/account/account.jsx @@ -1,25 +1,25 @@ -import { useEffect, useState } from 'react'; -import { Navigate } from 'react-router-dom'; import { - Stack, Button, - Group, - TextInput, - Text, - PasswordInput, Container, + Group, Loader, + PasswordInput, + Stack, + Text, + TextInput, } from '@mantine/core'; import { useForm } from '@mantine/form'; import { openConfirmModal } from '@mantine/modals'; -import { IconAt, IconLock, IconEdit, IconTrash } from '@tabler/icons'; +import { IconAt, IconEdit, IconLock, IconTrash } from '@tabler/icons'; +import { useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; +import { Navigate } from 'react-router-dom'; import ErrorBox from '../../components/error-box'; import SuccessBox from '../../components/success-box'; import style from './account.module.css'; -import { getUser, updateUser, deleteUser } from '../../api/account'; +import { deleteUser, getUser, updateUser } from '../../api/account'; const Account = () => { const [success, setSuccess] = useState(false); diff --git a/src/client/routes/account/index.jsx b/src/client/routes/account/index.jsx index 53da2402..5a718fd5 100644 --- a/src/client/routes/account/index.jsx +++ b/src/client/routes/account/index.jsx @@ -1,10 +1,10 @@ +import { Container, Loader, Stack, Text } from '@mantine/core'; import { useEffect, useState } from 'react'; -import { Container, Loader, Text, Stack } from '@mantine/core'; import { Navigate } from 'react-router-dom'; import ErrorBox from '../../components/error-box'; -import { getUser } from '../../api/account'; import { useTranslation } from 'react-i18next'; +import { getUser } from '../../api/account'; const HomeAccount = () => { const { t } = useTranslation(); diff --git a/src/client/routes/account/secrets.jsx b/src/client/routes/account/secrets.jsx index 65003477..b35ffce9 100644 --- a/src/client/routes/account/secrets.jsx +++ b/src/client/routes/account/secrets.jsx @@ -1,15 +1,15 @@ -import { useEffect, useState } from 'react'; -import { ActionIcon, Text, Stack, Group, Table, Container, Loader } from '@mantine/core'; +import { ActionIcon, Container, Group, Loader, Stack, Table, Text } from '@mantine/core'; import { useForm } from '@mantine/form'; import { openConfirmModal } from '@mantine/modals'; import { IconTrash } from '@tabler/icons'; import dayjs from 'dayjs'; import relativeTime from 'dayjs/plugin/relativeTime'; +import { useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; import ErrorBox from '../../components/error-box'; import SuccessBox from '../../components/success-box'; -import { getSecrets, burnSecret } from '../../api/secret'; +import { burnSecret, getSecrets } from '../../api/secret'; dayjs.extend(relativeTime); diff --git a/src/client/routes/account/settings.jsx b/src/client/routes/account/settings.jsx index 82513e7c..2b24e345 100644 --- a/src/client/routes/account/settings.jsx +++ b/src/client/routes/account/settings.jsx @@ -1,7 +1,7 @@ -import { useEffect, useState } from 'react'; -import { Stack, Button, Checkbox, Group, Input, Text, Container, Loader } from '@mantine/core'; +import { Button, Checkbox, Container, Group, Input, Loader, Stack, Text } from '@mantine/core'; import { useForm } from '@mantine/form'; -import { IconEdit, IconAt } from '@tabler/icons'; +import { IconAt, IconEdit } from '@tabler/icons'; +import { useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; import ErrorBox from '../../components/error-box'; import SuccessBox from '../../components/success-box'; diff --git a/src/client/routes/account/users.jsx b/src/client/routes/account/users.jsx index 68ce2dfb..0d485feb 100644 --- a/src/client/routes/account/users.jsx +++ b/src/client/routes/account/users.jsx @@ -1,26 +1,26 @@ -import React, { useEffect, useState } from 'react'; import { ActionIcon, - Container, - Center, - Text, - Stack, - Select, Button, + Center, + Container, Group, - TextInput, + Loader, + Modal, PasswordInput, + Select, + Stack, Table, - Modal, - Loader, + Text, + TextInput, } from '@mantine/core'; import { useForm } from '@mantine/form'; import { useDisclosure } from '@mantine/hooks'; import { openConfirmModal } from '@mantine/modals'; -import { IconEdit, IconAt, IconUser, IconChefHat, IconPlus, IconTrash } from '@tabler/icons'; +import { IconAt, IconChefHat, IconEdit, IconPlus, IconTrash, IconUser } from '@tabler/icons'; +import { useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; -import { getUsers, updateUser, addUser, deleteUser } from '../../api/users'; +import { addUser, deleteUser, getUsers, updateUser } from '../../api/users'; import ErrorBox from '../../components/error-box'; import SuccessBox from '../../components/success-box'; diff --git a/src/client/routes/api-docs/index.jsx b/src/client/routes/api-docs/index.jsx index f48f1b94..506ece8e 100644 --- a/src/client/routes/api-docs/index.jsx +++ b/src/client/routes/api-docs/index.jsx @@ -1,6 +1,5 @@ -import React from 'react'; +import { Anchor, Code, Container, Stack, Text, Title } from '@mantine/core'; import { Link } from 'react-router-dom'; -import { Code, Container, Stack, Title, Text, Anchor } from '@mantine/core'; const ApiDocs = () => { return ( diff --git a/src/client/routes/home/index.jsx b/src/client/routes/home/index.jsx index 74da509c..3cd2494d 100644 --- a/src/client/routes/home/index.jsx +++ b/src/client/routes/home/index.jsx @@ -1,47 +1,47 @@ -import React, { useEffect, useState, useRef } from 'react'; -import passwordGenerator from 'generate-password-browser'; import { + ActionIcon, + Badge, + Box, Button, Checkbox, Container, - TextInput, - Select, CopyButton, - ActionIcon, - Tooltip, - Group, - Stack, - Title, - Text, Divider, FileButton, + Group, NumberInput, - Badge, - Box, + Select, + Stack, + Text, + TextInput, + Title, + Tooltip, } from '@mantine/core'; import { useForm } from '@mantine/form'; import { useMediaQuery } from '@mantine/hooks'; import { - IconSquarePlus, - IconTrash, - IconLock, - IconLockAccess, - IconLink, - IconCopy, IconCheck, + IconCopy, IconHeading, + IconLink, + IconLock, + IconLockAccess, IconShare, IconShieldLock, + IconSquarePlus, + IconTrash, } from '@tabler/icons'; +import passwordGenerator from 'generate-password-browser'; +import { useEffect, useRef, useState } from 'react'; import { useSelector } from 'react-redux'; -import Quill from '../../components/quill'; -import QRLink from '../../components/qrlink'; import ErrorBox from '../../components/error-box'; +import QRLink from '../../components/qrlink'; +import Quill from '../../components/quill'; -import { zipFiles } from '../../helpers/zip'; -import { createSecret, burnSecret } from '../../api/secret'; -import { generateKey, encrypt } from '../../../shared/helpers/crypto'; import { useTranslation } from 'react-i18next'; +import { encrypt, generateKey } from '../../../shared/helpers/crypto'; +import { burnSecret, createSecret } from '../../api/secret'; +import { zipFiles } from '../../helpers/zip'; import config from '../../config'; diff --git a/src/client/routes/privacy/index.jsx b/src/client/routes/privacy/index.jsx index e86577aa..8a6a976a 100644 --- a/src/client/routes/privacy/index.jsx +++ b/src/client/routes/privacy/index.jsx @@ -1,5 +1,4 @@ -import React from 'react'; -import { Container, Stack, Title, Text } from '@mantine/core'; +import { Container, Stack, Text, Title } from '@mantine/core'; const Privacy = () => { return ( diff --git a/src/client/routes/public/index.jsx b/src/client/routes/public/index.jsx index c16e0c64..2364f718 100644 --- a/src/client/routes/public/index.jsx +++ b/src/client/routes/public/index.jsx @@ -1,9 +1,9 @@ -import { useEffect, useState } from 'react'; -import { Link } from 'react-router-dom'; -import { Anchor, Stack, Group, Title, Table, Container, Loader } from '@mantine/core'; -import { useTranslation } from 'react-i18next'; +import { Anchor, Container, Group, Loader, Stack, Table, Title } from '@mantine/core'; import dayjs from 'dayjs'; import relativeTime from 'dayjs/plugin/relativeTime'; +import { useEffect, useState } from 'react'; +import { useTranslation } from 'react-i18next'; +import { Link } from 'react-router-dom'; import { getPublicSecrets } from '../../api/secret'; diff --git a/src/client/routes/secret/index.jsx b/src/client/routes/secret/index.jsx index c339a66a..2233d144 100644 --- a/src/client/routes/secret/index.jsx +++ b/src/client/routes/secret/index.jsx @@ -1,23 +1,23 @@ -import React, { useEffect, useState } from 'react'; -import { useParams, Link, useLocation } from 'react-router-dom'; +import { useEffect, useState } from 'react'; +import { Link, useLocation, useParams } from 'react-router-dom'; -import { Button, Group, Container, TextInput, Stack, Title, Text } from '@mantine/core'; +import { Button, Container, Group, Stack, Text, TextInput, Title } from '@mantine/core'; import { - IconSquarePlus, IconDownload, - IconLock, IconEye, - IconPerspective, IconHeading, + IconLock, + IconPerspective, IconShieldLock, + IconSquarePlus, } from '@tabler/icons'; -import Quill from '../../components/quill'; import ErrorBox from '../../components/error-box'; +import Quill from '../../components/quill'; +import { decrypt } from '../../../shared/helpers/crypto'; import { getSecret, secretExists } from '../../api/secret'; import { downloadFile } from '../../api/upload'; -import { decrypt } from '../../../shared/helpers/crypto'; import { useTranslation } from 'react-i18next'; diff --git a/src/client/routes/signin/index.jsx b/src/client/routes/signin/index.jsx index 1416ff57..3e875a23 100644 --- a/src/client/routes/signin/index.jsx +++ b/src/client/routes/signin/index.jsx @@ -1,15 +1,15 @@ -import React, { useState } from 'react'; -import { Navigate } from 'react-router-dom'; -import { Button, Container, TextInput, Stack, Title, Text, PasswordInput } from '@mantine/core'; -import { useDispatch } from 'react-redux'; +import { Button, Container, PasswordInput, Stack, Text, TextInput, Title } from '@mantine/core'; import { useForm } from '@mantine/form'; -import { IconLock, IconUser, IconLogin } from '@tabler/icons'; +import { IconLock, IconLogin, IconUser } from '@tabler/icons'; +import { useState } from 'react'; import { useTranslation } from 'react-i18next'; +import { useDispatch } from 'react-redux'; +import { Navigate } from 'react-router-dom'; import ErrorBox from '../../components/error-box'; import SuccessBox from '../../components/success-box'; -import { signIn } from '../../api/authentication'; import { userLogin } from '../../actions'; +import { signIn } from '../../api/authentication'; const SignIn = () => { const [success, setSuccess] = useState(false); diff --git a/src/client/routes/signout/index.jsx b/src/client/routes/signout/index.jsx index a39b7161..d5654750 100644 --- a/src/client/routes/signout/index.jsx +++ b/src/client/routes/signout/index.jsx @@ -1,10 +1,10 @@ +import { Center, Container, Image, Stack, Text, Title } from '@mantine/core'; import { useEffect, useState } from 'react'; -import { Navigate } from 'react-router-dom'; import { useDispatch } from 'react-redux'; -import { Container, Title, Center, Text, Image, Stack } from '@mantine/core'; -import { userLoginChanged, userLogin } from '../../actions'; -import { removeCookie } from '../../helpers/cookie'; +import { Navigate } from 'react-router-dom'; +import { userLogin, userLoginChanged } from '../../actions'; import { signOut } from '../../api/authentication'; +import { removeCookie } from '../../helpers/cookie'; import styles from './style.module.css'; const SignOut = () => { diff --git a/src/client/routes/signup/index.jsx b/src/client/routes/signup/index.jsx index 10fd0852..4fdbacd8 100644 --- a/src/client/routes/signup/index.jsx +++ b/src/client/routes/signup/index.jsx @@ -1,15 +1,15 @@ -import { useState } from 'react'; -import { Navigate } from 'react-router-dom'; -import { Button, Container, TextInput, Stack, Title, Text, PasswordInput } from '@mantine/core'; -import { useDispatch } from 'react-redux'; +import { Button, Container, PasswordInput, Stack, Text, TextInput, Title } from '@mantine/core'; import { useForm } from '@mantine/form'; -import { IconLock, IconUser, IconLogin, IconAt } from '@tabler/icons'; +import { IconAt, IconLock, IconLogin, IconUser } from '@tabler/icons'; +import { useState } from 'react'; import { useTranslation } from 'react-i18next'; +import { useDispatch } from 'react-redux'; +import { Navigate } from 'react-router-dom'; import ErrorBox from '../../components/error-box'; import SuccessBox from '../../components/success-box'; -import { signUp } from '../../api/authentication'; import { userLogin } from '../../actions'; +import { signUp } from '../../api/authentication'; const SignUp = () => { const [success, setSuccess] = useState(false); diff --git a/src/client/routes/terms/index.jsx b/src/client/routes/terms/index.jsx index 12b2a9aa..6acf3ee6 100644 --- a/src/client/routes/terms/index.jsx +++ b/src/client/routes/terms/index.jsx @@ -1,5 +1,4 @@ -import React from 'react'; -import { Container, Stack, Title, Text } from '@mantine/core'; +import { Container, Stack, Text, Title } from '@mantine/core'; const TermsAndCondition = () => { return ( diff --git a/src/index.jsx b/src/index.jsx index 8077cfff..9befca58 100644 --- a/src/index.jsx +++ b/src/index.jsx @@ -1,9 +1,9 @@ -import React, { Suspense } from 'react'; +import { Suspense } from 'react'; import ReactDOM from 'react-dom'; import { Provider } from 'react-redux'; -import './i18n'; import { LoadingOverlay } from '@mantine/core'; +import './i18n'; import HemmeligApplication from './client/app'; import configureStore from './client/helpers/configureStore'; diff --git a/src/server/bootstrap.js b/src/server/bootstrap.js index 6c139335..80a4f3de 100644 --- a/src/server/bootstrap.js +++ b/src/server/bootstrap.js @@ -1,7 +1,7 @@ import config from 'config'; -import prisma from './services/prisma.js'; import adminSettings from './adminSettings.js'; import { hash } from './helpers/password.js'; +import prisma from './services/prisma.js'; const username = config.get('account.root.user'); const email = config.get('account.root.email'); diff --git a/src/server/controllers/account.js b/src/server/controllers/account.js index f875a173..b947dd03 100644 --- a/src/server/controllers/account.js +++ b/src/server/controllers/account.js @@ -1,5 +1,5 @@ import emailValidator from 'email-validator'; -import { hash, compare } from '../helpers/password.js'; +import { compare, hash } from '../helpers/password.js'; import prisma from '../services/prisma.js'; const PASSWORD_LENGTH = 5; diff --git a/src/server/controllers/admin/settings.js b/src/server/controllers/admin/settings.js index ad631d23..8b3f95fd 100644 --- a/src/server/controllers/admin/settings.js +++ b/src/server/controllers/admin/settings.js @@ -1,6 +1,6 @@ import extractDomain from 'extract-domain'; -import prisma from '../../services/prisma.js'; import { updateAdminSettings } from '../../bootstrap.js'; +import prisma from '../../services/prisma.js'; async function settings(fastify) { fastify.get( diff --git a/src/server/controllers/authentication.js b/src/server/controllers/authentication.js index 06c52219..db099462 100644 --- a/src/server/controllers/authentication.js +++ b/src/server/controllers/authentication.js @@ -1,8 +1,8 @@ -import emailValidator from 'email-validator'; import config from 'config'; +import emailValidator from 'email-validator'; import prisma from '../services/prisma.js'; -import { hash, compare } from '../helpers/password.js'; +import { compare, hash } from '../helpers/password.js'; const validUsername = /^[A-Za-z0-9_-]*$/is; diff --git a/src/server/controllers/download.js b/src/server/controllers/download.js index 0bb0a857..86d37c23 100644 --- a/src/server/controllers/download.js +++ b/src/server/controllers/download.js @@ -1,6 +1,6 @@ import sanitize from 'sanitize-filename'; -import prisma from '../services/prisma.js'; import fileAdapter from '../services/file-adapter.js'; +import prisma from '../services/prisma.js'; import { isValidSecretId } from '../helpers/regexp.js'; diff --git a/src/server/controllers/secret.js b/src/server/controllers/secret.js index 10a89809..a0f66560 100644 --- a/src/server/controllers/secret.js +++ b/src/server/controllers/secret.js @@ -1,9 +1,9 @@ +import config from 'config'; import prettyBytes from 'pretty-bytes'; import validator from 'validator'; -import config from 'config'; -import prisma from '../services/prisma.js'; -import { hash, compare } from '../helpers/password.js'; import getClientIp from '../helpers/client-ip.js'; +import { compare, hash } from '../helpers/password.js'; +import prisma from '../services/prisma.js'; import { isValidSecretId } from '../helpers/regexp.js'; diff --git a/src/server/decorators/allowed-ip.js b/src/server/decorators/allowed-ip.js index 7ac50903..bb86852d 100644 --- a/src/server/decorators/allowed-ip.js +++ b/src/server/decorators/allowed-ip.js @@ -1,7 +1,7 @@ import fp from 'fastify-plugin'; import ipRangeCheck from 'ip-range-check'; -import prisma from '../services/prisma.js'; import getClientIp from '../helpers/client-ip.js'; +import prisma from '../services/prisma.js'; export default fp(async (fastify) => { fastify.decorate('allowedIp', async (request, reply) => { diff --git a/src/server/decorators/user-features.js b/src/server/decorators/user-features.js index 67c811d2..7b41f41a 100644 --- a/src/server/decorators/user-features.js +++ b/src/server/decorators/user-features.js @@ -1,6 +1,6 @@ +import config from 'config'; import fp from 'fastify-plugin'; import adminSettings from '../adminSettings.js'; -import config from 'config'; export default fp(async (fastify) => { fastify.decorate('userFeatures', async (req, reply) => { diff --git a/src/server/prehandlers/read-only.js b/src/server/prehandlers/read-only.js index fb1a27dd..d3945345 100644 --- a/src/server/prehandlers/read-only.js +++ b/src/server/prehandlers/read-only.js @@ -1,5 +1,5 @@ -import prisma from '../services/prisma.js'; import adminSettings from '../adminSettings.js'; +import prisma from '../services/prisma.js'; const secretRegex = /^\/api\/secret$/i; diff --git a/src/server/services/disk.js b/src/server/services/disk.js index 84e33cff..57f84762 100644 --- a/src/server/services/disk.js +++ b/src/server/services/disk.js @@ -1,6 +1,6 @@ +import config from 'config'; import fs from 'fs/promises'; import { nanoid } from 'nanoid'; -import config from 'config'; const getFilePath = (key) => `${config.get('disk.folder')}${key}.json`; diff --git a/src/server/services/do.js b/src/server/services/do.js index 2ed3db7f..ba49993f 100644 --- a/src/server/services/do.js +++ b/src/server/services/do.js @@ -1,7 +1,7 @@ -import { Upload } from '@aws-sdk/lib-storage'; import { S3 } from '@aws-sdk/client-s3'; -import { nanoid } from 'nanoid'; +import { Upload } from '@aws-sdk/lib-storage'; import config from 'config'; +import { nanoid } from 'nanoid'; function createConfig() { if (config.get('aws.s3.region')) { diff --git a/src/server/services/prisma.js b/src/server/services/prisma.js index 387257f5..4e54f7a7 100644 --- a/src/server/services/prisma.js +++ b/src/server/services/prisma.js @@ -1,5 +1,4 @@ import { PrismaClient } from '@prisma/client'; -import adminSettings from '../adminSettings.js'; const prisma = new PrismaClient(); diff --git a/src/service-worker.js b/src/service-worker.js index 877064e3..0a826968 100644 --- a/src/service-worker.js +++ b/src/service-worker.js @@ -1,6 +1,6 @@ import { clientsClaim } from 'workbox-core'; import { ExpirationPlugin } from 'workbox-expiration'; -import { precacheAndRoute, createHandlerBoundToURL } from 'workbox-precaching'; +import { createHandlerBoundToURL, precacheAndRoute } from 'workbox-precaching'; import { registerRoute } from 'workbox-routing'; import { StaleWhileRevalidate } from 'workbox-strategies'; diff --git a/src/shared/helpers/crypto.js b/src/shared/helpers/crypto.js index e7b3bac5..27db1522 100644 --- a/src/shared/helpers/crypto.js +++ b/src/shared/helpers/crypto.js @@ -1,7 +1,7 @@ +import { Buffer } from 'buffer/'; import { nanoid } from 'nanoid'; import tweetnacl from 'tweetnacl'; import tweetnaclUtil from 'tweetnacl-util'; -import { Buffer } from 'buffer/'; const { secretbox, randomBytes } = tweetnacl; const { decodeUTF8, encodeUTF8, encodeBase64, decodeBase64 } = tweetnaclUtil;