mirror of
https://github.com/bitwarden/directory-connector
synced 2026-01-03 17:13:16 +00:00
Apply Prettier (#194)
This commit is contained in:
@@ -1,29 +1,25 @@
|
||||
import {
|
||||
deletePassword,
|
||||
getPassword,
|
||||
setPassword,
|
||||
} from 'keytar';
|
||||
import { deletePassword, getPassword, setPassword } from "keytar";
|
||||
|
||||
import { StorageService } from 'jslib-common/abstractions/storage.service';
|
||||
import { StorageService } from "jslib-common/abstractions/storage.service";
|
||||
|
||||
export class KeytarSecureStorageService implements StorageService {
|
||||
constructor(private serviceName: string) { }
|
||||
constructor(private serviceName: string) {}
|
||||
|
||||
get<T>(key: string): Promise<T> {
|
||||
return getPassword(this.serviceName, key).then(val => {
|
||||
return JSON.parse(val) as T;
|
||||
});
|
||||
}
|
||||
get<T>(key: string): Promise<T> {
|
||||
return getPassword(this.serviceName, key).then((val) => {
|
||||
return JSON.parse(val) as T;
|
||||
});
|
||||
}
|
||||
|
||||
async has(key: string): Promise<boolean> {
|
||||
return (await this.get(key)) != null;
|
||||
}
|
||||
async has(key: string): Promise<boolean> {
|
||||
return (await this.get(key)) != null;
|
||||
}
|
||||
|
||||
save(key: string, obj: any): Promise<any> {
|
||||
return setPassword(this.serviceName, key, JSON.stringify(obj));
|
||||
}
|
||||
save(key: string, obj: any): Promise<any> {
|
||||
return setPassword(this.serviceName, key, JSON.stringify(obj));
|
||||
}
|
||||
|
||||
remove(key: string): Promise<any> {
|
||||
return deletePassword(this.serviceName, key);
|
||||
}
|
||||
remove(key: string): Promise<any> {
|
||||
return deletePassword(this.serviceName, key);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user