const initSqlJs = require('sql.js');
const fs = require('fs');

initSqlJs().then(SQL => {
    const buffer = fs.readFileSync('E:/var/lib/9router/db/data.sqlite');
    const db = new SQL.Database(buffer);
    
    // Get full key data for the first key
    const result = db.exec("SELECT id, key, name, data FROM apiKeys LIMIT 1");
    if (result[0]?.values) {
        console.log('First API Key:');
        console.log('ID:', result[0].values[0][0]);
        console.log('Key:', result[0].values[0][1]);
        console.log('Name:', result[0].values[0][2]);
        console.log('Data:', result[0].values[0][3]);
    }
    
    db.close();
    process.exit(0);
});
