feat: prettier integration

This commit is contained in:
2025-05-29 17:17:38 +02:00
parent 83c26bb94a
commit 725cc74102
19 changed files with 71 additions and 47 deletions

View File

@ -61,7 +61,7 @@ export const encryptToken = async (token: string) => {
const cipherText = await crypto.subtle.encrypt(
{ name: "AES-GCM", iv },
deviceKey,
encoder.encode(token)
encoder.encode(token),
);
return {
@ -84,7 +84,7 @@ export const decryptToken = async (encrypted: {
iv: new Uint8Array(encrypted.iv),
},
deviceKey,
new Uint8Array(encrypted.data)
new Uint8Array(encrypted.data),
);
return decoder.decode(decrypted);
@ -92,7 +92,7 @@ export const decryptToken = async (encrypted: {
export const saveAccount = async (
db: IDBPDatabase,
req: CreateAccountRequest
req: CreateAccountRequest,
): Promise<LocalAccount> => {
const access = await encryptToken(req.access);
const refresh = await encryptToken(req.refresh);
@ -141,7 +141,7 @@ export const getAllAccounts = async (db: IDBPDatabase) => {
} catch (err) {
console.warn(`Failed to decrypt account ${account.label}:`, err);
}
})
}),
)
).filter((acc) => acc !== undefined);
@ -186,7 +186,7 @@ export const getAccountRaw = async (db: IDBPDatabase, accountId: string) => {
export const updateAccountTokens = async (
db: IDBPDatabase,
req: UpdateAccountTokensRequest
req: UpdateAccountTokensRequest,
) => {
const account = await getAccountRaw(db, req.accountId);
@ -204,7 +204,7 @@ export const updateAccountTokens = async (
export const updateAccountInfo = async (
db: IDBPDatabase,
req: UpdateAccountInfoRequest
req: UpdateAccountInfoRequest,
) => {
const account = await getAccountRaw(db, req.accountId);
await db?.put?.("accounts", {
@ -229,7 +229,7 @@ export const useAccountRepo = () => {
return saveAccount(db, req);
},
[db]
[db],
);
const loadAll = useCallback(async () => {
@ -244,7 +244,7 @@ export const useAccountRepo = () => {
return getAccount(db, accountId);
},
[db]
[db],
);
return { save, loadAll, getOne };