import { readFile } from "node:fs/promises";
import path from "node:path";
export class FileSystemTufMetadataStore {
    metadataDir;
    constructor(metadataDir) {
        this.metadataDir = metadataDir;
    }
    async load() {
        const [root, targets, snapshot, timestamp] = await Promise.all([
            readJson(path.join(this.metadataDir, "root.json")),
            readJson(path.join(this.metadataDir, "targets.json")),
            readJson(path.join(this.metadataDir, "snapshot.json")),
            readJson(path.join(this.metadataDir, "timestamp.json")),
        ]);
        return { root, targets, snapshot, timestamp };
    }
}
async function readJson(filePath) {
    const text = await readFile(filePath, "utf8");
    return JSON.parse(text);
}
