Skip to content

Commit

Permalink
clean
Browse files Browse the repository at this point in the history
  • Loading branch information
hazae41 committed Aug 16, 2024
1 parent d5bacf8 commit d9f1089
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 25 deletions.
15 changes: 0 additions & 15 deletions src/libs/emojis/emojis.ts

This file was deleted.

8 changes: 2 additions & 6 deletions src/mods/background/service_worker/entities/users/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,15 @@ export namespace UserRef {
export interface UserInit {
readonly uuid: string,
readonly name: string,

readonly color: number
readonly emoji: string

readonly password: string
}

export interface UserData {
readonly uuid: string,
readonly name: string,

readonly color: number
readonly emoji: string

readonly keyParamsBase64: HmacPbkdf2ParamsBase64
readonly valueParamsBase64: AesGcmPbkdf2ParamsBase64
Expand Down Expand Up @@ -117,7 +113,7 @@ export namespace BgUser {
}

export async function createOrThrow(init: UserInit): Promise<UserData> {
const { uuid, name, color, emoji, password } = init
const { uuid, name, color, password } = init

const pbkdf2 = await crypto.subtle.importKey("raw", Bytes.fromUtf8(password), { name: "PBKDF2" }, false, ["deriveBits"])

Expand Down Expand Up @@ -158,7 +154,7 @@ export namespace BgUser {
const passwordHashBytes = new Uint8Array(await crypto.subtle.deriveBits(passwordParamsBytes, pbkdf2, 256))
const passwordHashBase64 = Base64.get().encodePaddedOrThrow(passwordHashBytes)

return { uuid, name, color, emoji, keyParamsBase64, valueParamsBase64, passwordParamsBase64, passwordHashBase64 }
return { uuid, name, color, keyParamsBase64, valueParamsBase64, passwordParamsBase64, passwordHashBase64 }
}

}
6 changes: 2 additions & 4 deletions src/mods/foreground/entities/users/all/create.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Color } from "@/libs/colors/colors";
import { Emojis } from "@/libs/emojis/emojis";
import { Errors } from "@/libs/errors/errors";
import { Outline } from "@/libs/icons/icons";
import { useModhash } from "@/libs/modhash/modhash";
Expand Down Expand Up @@ -29,7 +28,6 @@ export function UserCreateDialog(props: { next?: string }) {

const modhash = useModhash(uuid)
const color = Color.get(modhash)
const emoji = Emojis.get(modhash)

const [rawNameInput = "", setRawNameInput] = useState<string>()

Expand Down Expand Up @@ -60,7 +58,7 @@ export function UserCreateDialog(props: { next?: string }) {
}, [])

const createOrAlert = useAsyncUniqueCallback(() => Errors.runAndLogAndAlert(async () => {
const user: UserInit = { uuid, name: finalNameInput, color: Color.all.indexOf(color), emoji, password: defPasswordInput }
const user: UserInit = { uuid, name: finalNameInput, color: Color.all.indexOf(color), password: defPasswordInput }

await background.requestOrThrow<User[]>({
method: "brume_createUser",
Expand All @@ -80,7 +78,7 @@ export function UserCreateDialog(props: { next?: string }) {
location.assign(next)

return
}), [uuid, finalNameInput, color, emoji, defPasswordInput, background, close, next])
}), [uuid, finalNameInput, color, defPasswordInput, background, close, next])

const onKeyDown = useCallback((e: KeyboardEvent) => {
if (e.key !== "Enter")
Expand Down

0 comments on commit d9f1089

Please sign in to comment.