mirror of
https://github.com/kmc7468/arkvault.git
synced 2025-12-14 22:08:45 +00:00
페이지가 열릴 때 영구 저장소 사용을 요청하도록 개선
This commit is contained in:
@@ -4,6 +4,15 @@ import { prepareFileCache } from "$lib/modules/file";
|
|||||||
import { prepareOpfs } from "$lib/modules/opfs";
|
import { prepareOpfs } from "$lib/modules/opfs";
|
||||||
import { clientKeyStore, masterKeyStore, hmacSecretStore } from "$lib/stores";
|
import { clientKeyStore, masterKeyStore, hmacSecretStore } from "$lib/stores";
|
||||||
|
|
||||||
|
const requestPersistentStorage = async () => {
|
||||||
|
const isPersistent = await navigator.storage.persist();
|
||||||
|
if (isPersistent) {
|
||||||
|
console.log("[ArkVault] Persistent storage granted.");
|
||||||
|
} else {
|
||||||
|
console.warn("[ArkVault] Persistent storage not granted.");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const prepareClientKeyStore = async () => {
|
const prepareClientKeyStore = async () => {
|
||||||
const [encryptKey, decryptKey, signKey, verifyKey] = await Promise.all([
|
const [encryptKey, decryptKey, signKey, verifyKey] = await Promise.all([
|
||||||
getClientKey("encrypt"),
|
getClientKey("encrypt"),
|
||||||
@@ -32,6 +41,7 @@ const prepareHmacSecretStore = async () => {
|
|||||||
|
|
||||||
export const init: ClientInit = async () => {
|
export const init: ClientInit = async () => {
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
|
requestPersistentStorage(),
|
||||||
prepareFileCache(),
|
prepareFileCache(),
|
||||||
prepareClientKeyStore(),
|
prepareClientKeyStore(),
|
||||||
prepareMasterKeyStore(),
|
prepareMasterKeyStore(),
|
||||||
|
|||||||
Reference in New Issue
Block a user