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

@ -37,7 +37,7 @@ export const deriveDeviceKey = async (deviceKeyId: string) => {
encoder.encode(deviceKeyId),
{ name: "PBKDF2" },
false,
["deriveKey"]
["deriveKey"],
);
return crypto.subtle.deriveKey(
{
@ -49,6 +49,6 @@ export const deriveDeviceKey = async (deviceKeyId: string) => {
baseKey,
{ name: "AES-GCM", length: 256 },
false,
["encrypt", "decrypt"]
["encrypt", "decrypt"],
);
};

View File

@ -5,14 +5,14 @@ export type EncryptedToken = {
export const encryptToken = async (
token: string,
key: CryptoKey
key: CryptoKey,
): Promise<EncryptedToken> => {
const encoder = new TextEncoder();
const iv = crypto.getRandomValues(new Uint8Array(12));
const cipherText = await crypto.subtle.encrypt(
{ name: "AES-GCM", iv },
key,
encoder.encode(token)
encoder.encode(token),
);
return { cipherText, iv };
};