import { invoke } from "@tauri-apps/api/core"; export interface Profile { id: string; name: string; color: string; pin_hash: string | null; db_filename: string; created_at: string; } export interface ProfilesConfig { active_profile_id: string; profiles: Profile[]; } export async function loadProfiles(): Promise { return invoke("load_profiles"); } export async function saveProfiles(config: ProfilesConfig): Promise { return invoke("save_profiles", { config }); } export async function deleteProfileDb(dbFilename: string): Promise { return invoke("delete_profile_db", { dbFilename }); } export async function getNewProfileInitSql(): Promise { return invoke("get_new_profile_init_sql"); } export async function hashPin(pin: string): Promise { return invoke("hash_pin", { pin }); } export interface VerifyPinResult { valid: boolean; /** New Argon2id hash when a legacy SHA-256 PIN was re-hashed on successful verification */ rehashed: string | null; } export async function verifyPin(pin: string, storedHash: string): Promise { return invoke("verify_pin", { pin, storedHash }); }