fix: removing unused navigate

This commit is contained in:
Chubby Granny Chaser 2025-01-15 17:08:22 +00:00
parent c59b039eb4
commit 8b47082047
No known key found for this signature in database
7 changed files with 74 additions and 0 deletions

3
src/main/level/index.ts Normal file
View File

@ -0,0 +1,3 @@
export { db } from "./level";
export * from "./sublevels";

4
src/main/level/level.ts Normal file
View File

@ -0,0 +1,4 @@
import { levelDatabasePath } from "@main/constants";
import { Level } from "level";
export const db = new Level(levelDatabasePath, { valueEncoding: "json" });

View File

@ -0,0 +1,7 @@
import { Game } from "@types";
import { db } from "../level";
import { levelKeys } from "./keys";
export const gamesSublevel = db.sublevel<string, Game>(levelKeys.games, {
valueEncoding: "json",
});

View File

@ -0,0 +1 @@
export * from "./games";

View File

@ -0,0 +1,8 @@
import type { GameShop } from "@types";
export const levelKeys = {
games: "games",
game: (shop: GameShop, objectId: string) => `${shop}:${objectId}`,
user: "user",
auth: "auth",
};

View File

@ -0,0 +1,28 @@
import { safeStorage } from "electron";
import { logger } from "./logger";
export class Crypto {
public static encrypt(str: string) {
if (safeStorage.isEncryptionAvailable()) {
return safeStorage.encryptString(str).toString("base64");
} else {
logger.warn(
"Encrypt method returned raw string because encryption is not available"
);
return str;
}
}
public static decrypt(b64: string) {
if (safeStorage.isEncryptionAvailable()) {
return safeStorage.decryptString(Buffer.from(b64, "base64"));
} else {
logger.warn(
"Decrypt method returned raw string because encryption is not available"
);
return b64;
}
}
}

23
src/types/level.types.ts Normal file
View File

@ -0,0 +1,23 @@
export type SubscriptionStatus = "active" | "pending" | "cancelled";
export interface Subscription {
id: string;
status: SubscriptionStatus;
plan: { id: string; name: string };
expiresAt: string | null;
paymentMethod: "pix" | "paypal";
}
export interface Auth {
accessToken: string;
refreshToken: string;
tokenExpirationTimestamp: number;
}
export interface User {
id: string;
displayName: string;
profileImageUrl: string | null;
backgroundImageUrl: string | null;
subscription: Subscription | null;
}