자잘한 리팩토링

This commit is contained in:
static
2025-01-09 03:56:06 +09:00
parent 66daebe577
commit 8873337ede
13 changed files with 46 additions and 64 deletions

View File

@@ -19,7 +19,7 @@
}}
class="w-full rounded-xl active:bg-gray-100"
>
<div class="flex w-full items-stretch justify-between p-2 transition active:scale-95">
<div class="flex w-full justify-between p-2 transition active:scale-95">
<div>
{@render children?.()}
</div>

View File

@@ -4,12 +4,12 @@
import { AdaptiveDiv } from "$lib/components/divs";
interface Props {
bottom?: string;
icon: Component<SvelteHTMLElements["svg"]>;
offset?: string;
onclick?: () => void;
}
let { bottom = "bottom-20", icon: Icon, onclick }: Props = $props();
let { icon: Icon, offset = "bottom-20", onclick }: Props = $props();
const click = () => {
setTimeout(() => {
@@ -19,13 +19,13 @@
</script>
<div class="pointer-events-none fixed inset-0">
<div class="absolute right-0 w-full {bottom}">
<div class="absolute w-full {offset}">
<AdaptiveDiv>
<div class="relative">
<div class="pointer-events-auto absolute bottom-4 right-4">
<div class="absolute bottom-4 right-4">
<button
onclick={click}
class="flex h-14 w-14 items-center justify-center rounded-full bg-gray-300 shadow-lg transition active:scale-95 active:bg-gray-400"
class="pointer-events-auto flex h-14 w-14 items-center justify-center rounded-full bg-gray-300 shadow-lg transition active:scale-95 active:bg-gray-400"
>
<Icon class="text-xl" />
</button>

View File

@@ -13,9 +13,7 @@ export const requestTokenUpgrade = async (
) => {
let res = await fetch("/api/auth/upgradeToken", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
encPubKey: encryptKeyBase64,
sigPubKey: verifyKeyBase64,
@@ -29,9 +27,7 @@ export const requestTokenUpgrade = async (
res = await fetch("/api/auth/upgradeToken/verify", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
answer: encodeToBase64(answer),
answerSig: encodeToBase64(answerSig),

View File

@@ -50,7 +50,7 @@ export const requestMasterKeyDownload = async (decryptKey: CryptoKey, verifyKey:
return {
version,
state,
masterKey,
key: masterKey,
isValid: await verifyMasterKeyWrapped(
masterKeyWrapped,
version,
@@ -63,17 +63,8 @@ export const requestMasterKeyDownload = async (decryptKey: CryptoKey, verifyKey:
);
if (!masterKeys.every(({ isValid }) => isValid)) return false;
await storeMasterKeys(
masterKeys.map(({ version, state, masterKey }) => ({ version, state, key: masterKey })),
);
masterKeyStore.set(
new Map(
masterKeys.map(({ version, state, masterKey }) => [
version,
{ version, state, key: masterKey },
]),
),
);
await storeMasterKeys(masterKeys);
masterKeyStore.set(new Map(masterKeys.map((masterKey) => [masterKey.version, masterKey])));
return true;
};