feat: remove unused util
This commit is contained in:
@ -1,30 +0,0 @@
|
|||||||
import { deriveDeviceKey, getDeviceId } from "./deviceId";
|
|
||||||
import { encryptToken } from "./token";
|
|
||||||
|
|
||||||
const storeTokensForAccount = async (
|
|
||||||
accountId: string,
|
|
||||||
accessToken: string,
|
|
||||||
refreshToken: string
|
|
||||||
) => {
|
|
||||||
const deviceKeyId = await getDeviceId();
|
|
||||||
const key = await deriveDeviceKey(deviceKeyId);
|
|
||||||
|
|
||||||
const access = await encryptToken(accessToken, key);
|
|
||||||
const refresh = await encryptToken(refreshToken, key);
|
|
||||||
|
|
||||||
const entry = {
|
|
||||||
accountId,
|
|
||||||
label: `Account for ${accountId}`,
|
|
||||||
access: {
|
|
||||||
data: Array.from(new Uint8Array(access.cipherText)),
|
|
||||||
iv: Array.from(access.iv),
|
|
||||||
},
|
|
||||||
refresh: {
|
|
||||||
data: Array.from(new Uint8Array(refresh.cipherText)),
|
|
||||||
iv: Array.from(refresh.iv),
|
|
||||||
},
|
|
||||||
updatedAt: new Date().toISOString(),
|
|
||||||
};
|
|
||||||
|
|
||||||
// Save this `entry` in IndexedDB (or use a localforage wrapper)
|
|
||||||
};
|
|
Reference in New Issue
Block a user