mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-18 09:35:20 +02:00
25 lines
815 B
TypeScript
25 lines
815 B
TypeScript
import KeychainServiceDriverBase from './KeychainServiceDriverBase';
|
|
import shim from '../../shim';
|
|
|
|
export default class KeychainServiceDriver extends KeychainServiceDriverBase {
|
|
public override readonly driverId: string = 'node-keytar';
|
|
|
|
public async supported(): Promise<boolean> {
|
|
return !!shim.keytar();
|
|
}
|
|
|
|
public async setPassword(name: string, password: string): Promise<boolean> {
|
|
await shim.keytar().setPassword(`${this.appId}.${name}`, `${this.clientId}@joplin`, password);
|
|
return true;
|
|
}
|
|
|
|
public async password(name: string): Promise<string> {
|
|
return shim.keytar().getPassword(`${this.appId}.${name}`, `${this.clientId}@joplin`);
|
|
}
|
|
|
|
public async deletePassword(name: string): Promise<void> {
|
|
await shim.keytar().deletePassword(`${this.appId}.${name}`, `${this.clientId}@joplin`);
|
|
}
|
|
|
|
}
|