mirror of
https://github.com/kmc7468/arkvault.git
synced 2026-03-22 23:36:55 +09:00
사소한 리팩토링 2
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { TRPCClientError } from "@trpc/client";
|
||||
import { encodeToBase64, decryptChallenge, signMessageRSA } from "$lib/modules/crypto";
|
||||
import { useTRPC } from "$trpc/client";
|
||||
import { trpc } from "$trpc/client";
|
||||
|
||||
export const requestSessionUpgrade = async (
|
||||
encryptKeyBase64: string,
|
||||
@@ -9,10 +9,9 @@ export const requestSessionUpgrade = async (
|
||||
signKey: CryptoKey,
|
||||
force = false,
|
||||
) => {
|
||||
const trpc = useTRPC();
|
||||
let id, challenge;
|
||||
try {
|
||||
({ id, challenge } = await trpc.auth.upgrade.mutate({
|
||||
({ id, challenge } = await trpc().auth.upgrade.mutate({
|
||||
encPubKey: encryptKeyBase64,
|
||||
sigPubKey: verifyKeyBase64,
|
||||
}));
|
||||
@@ -26,7 +25,7 @@ export const requestSessionUpgrade = async (
|
||||
const answerSig = await signMessageRSA(answer, signKey);
|
||||
|
||||
try {
|
||||
await trpc.auth.verifyUpgrade.mutate({
|
||||
await trpc().auth.verifyUpgrade.mutate({
|
||||
id,
|
||||
answerSig: encodeToBase64(answerSig),
|
||||
force,
|
||||
@@ -42,9 +41,8 @@ export const requestSessionUpgrade = async (
|
||||
};
|
||||
|
||||
export const requestLogout = async () => {
|
||||
const trpc = useTRPC();
|
||||
try {
|
||||
await trpc.auth.logout.mutate();
|
||||
await trpc().auth.logout.mutate();
|
||||
return true;
|
||||
} catch {
|
||||
// TODO: Error Handling
|
||||
|
||||
Reference in New Issue
Block a user