{"size": 937, "ext": "js", "max_stars_repo_path": "dist/KeyStore.js", "max_stars_repo_name": "pvh/hypermerge", "max_stars_repo_stars_event_min_datetime": "2018-02-24T01:51:23.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-30T22:17:45.000Z", "max_issues_repo_path": "dist/KeyStore.js", "max_issues_repo_name": "pvh/hypermerge", "max_issues_repo_issues_event_min_datetime": "2018-02-21T08:06:11.000Z", "max_issues_repo_issues_event_max_datetime": "2021-12-03T16:44:03.000Z", "max_forks_repo_path": "dist/KeyStore.js", "max_forks_repo_name": "pvh/hypermerge", "max_forks_repo_forks_event_min_datetime": "2018-03-16T20:18:06.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-29T21:31:46.000Z"}
{"max_stars_count": 1149, "max_issues_count": 49, "max_forks_count": 65, "avg_line_length": 37.48, "max_line_length": 102, "alphanum_fraction": 0.6424759872}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class KeyStore {
    constructor(db) {
        this.db = db;
        this.preparedGet = this.db.prepare(`SELECT * FROM Keys WHERE name=?`);
        this.preparedSet = this.db.prepare(`
        INSERT INTO Keys (name, publicKey, secretKey) VALUES (?, ?, ?)
        ON CONFLICT (name) DO UPDATE SET publicKey=excluded.publicKey, secretKey=excluded.secretKey`);
        this.preparedClear = this.db.prepare(`DELETE FROM Keys WHERE name=?`);
    }
    get(name) {
        const res = this.preparedGet.get(name);
        return res ? { publicKey: res.publicKey, secretKey: res.secretKey } : undefined;
    }
    set(name, keyPair) {
        this.preparedSet.run(name, keyPair.publicKey, keyPair.secretKey);
        return keyPair;
    }
    clear(name) {
        this.preparedClear.run(name);
    }
}
exports.default = KeyStore;
//# sourceMappingURL=KeyStore.js.map