feat: prettier integration
This commit is contained in:
@ -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"],
|
||||
);
|
||||
};
|
||||
|
@ -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 };
|
||||
};
|
||||
|
Reference in New Issue
Block a user