Control priv access via # (#286)

This commit is contained in:
Jaco Greeff
2020-02-22 18:19:35 +01:00
committed by GitHub
parent 3b71f10d1e
commit e69e98182b
13 changed files with 332 additions and 378 deletions
+4 -4
View File
@@ -10,19 +10,19 @@ import path from 'path';
// NOTE untested and unused by any known apps, probably broken in various mysterious ways
export default class FileStore implements KeyringStore {
private _path: string;
#path: string;
constructor (path: string) {
if (!fs.existsSync(path)) {
mkdirp.sync(path);
}
this._path = path;
this.#path = path;
}
public all (cb: (key: string, value: KeyringJson) => void): void {
fs
.readdirSync(this._path)
.readdirSync(this.#path)
.filter((key): boolean => !['.', '..'].includes(key))
.forEach((key): void => {
cb(key, this._readKey(key));
@@ -44,7 +44,7 @@ export default class FileStore implements KeyringStore {
}
private _getPath (key: string): string {
return path.join(this._path, key);
return path.join(this.#path, key);
}
private _readKey (key: string): KeyringJson {