feat: Initial clean release of CHM
一些检查失败了
automerge / automerge (push) Has been cancelled
react-native-android-build-apk / AssembleRelease (push) Has been cancelled
Build macOS M1 / Main (push) Has been cancelled
Joplin Continuous Integration / Main (macos-15-intel) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-11-vs2026-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-2025) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04-arm) (push) Has been cancelled
Joplin UI tests / Main (ubuntu-22.04) (push) Has been cancelled
Joplin UI tests / Main (windows-2025) (push) Has been cancelled
Joplin UI tests / Mobile (push) Has been cancelled
Close stale issues / ProcessStaleIssues (push) Has been cancelled
一些检查失败了
automerge / automerge (push) Has been cancelled
react-native-android-build-apk / AssembleRelease (push) Has been cancelled
Build macOS M1 / Main (push) Has been cancelled
Joplin Continuous Integration / Main (macos-15-intel) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-11-vs2026-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-2025) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04-arm) (push) Has been cancelled
Joplin UI tests / Main (ubuntu-22.04) (push) Has been cancelled
Joplin UI tests / Main (windows-2025) (push) Has been cancelled
Joplin UI tests / Mobile (push) Has been cancelled
Close stale issues / ProcessStaleIssues (push) Has been cancelled
这个提交包含在:
@@ -0,0 +1,75 @@
|
||||
import KeychainServiceDriverBase from './KeychainServiceDriverBase';
|
||||
import shim from '../../shim';
|
||||
import Logger from '@joplin/utils/Logger';
|
||||
import KvStore from '../KvStore';
|
||||
import Setting from '../../models/Setting';
|
||||
|
||||
const logger = Logger.create('KeychainServiceDriver.electron');
|
||||
|
||||
const canUseSafeStorage = () => {
|
||||
return !!shim.electronBridge?.()?.safeStorage?.isEncryptionAvailable();
|
||||
};
|
||||
|
||||
const kvStorePrefix = 'KeychainServiceDriver.secureStore.';
|
||||
|
||||
export default class KeychainServiceDriver extends KeychainServiceDriverBase {
|
||||
public override readonly driverId = 'electron-safeStorage';
|
||||
|
||||
public constructor(appId: string, clientId: string) {
|
||||
super(appId, clientId);
|
||||
|
||||
if (canUseSafeStorage() && shim.isLinux()) {
|
||||
logger.info('KeychainService Linux backend: ', shim.electronBridge()?.safeStorage?.getSelectedStorageBackend());
|
||||
}
|
||||
}
|
||||
|
||||
public async supported() {
|
||||
return canUseSafeStorage();
|
||||
}
|
||||
|
||||
public async setPassword(name: string, password: string): Promise<boolean> {
|
||||
if (canUseSafeStorage()) {
|
||||
logger.debug('Saving password with electron safe storage. ID: ', name);
|
||||
|
||||
let encrypted;
|
||||
try {
|
||||
encrypted = await shim.electronBridge().safeStorage.encryptString(password);
|
||||
} catch (error) {
|
||||
logger.warn('Encrypting a setting failed. Missing keychain permission?', error);
|
||||
return false;
|
||||
}
|
||||
await KvStore.instance().setValue(`${kvStorePrefix}${name}`, encrypted);
|
||||
} else {
|
||||
// Unsupported.
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public async password(name: string): Promise<string> {
|
||||
let result: string|null = null;
|
||||
|
||||
if (canUseSafeStorage()) {
|
||||
const data = await KvStore.instance().value(`${kvStorePrefix}${name}`);
|
||||
if (data !== null && typeof data === 'string') {
|
||||
try {
|
||||
result = await shim.electronBridge().safeStorage.decryptString(data);
|
||||
} catch (e) {
|
||||
logger.warn('Decryption of a setting failed. Corrupted data or new keychain password? Error:', e);
|
||||
if (shim.isLinux() && Setting.value('env') === 'dev') {
|
||||
logger.warn('If running Joplin in development mode with NodeJS installed from the Snap store, consider retrying with NodeJS installed from a different source.');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public async deletePassword(name: string): Promise<void> {
|
||||
if (canUseSafeStorage()) {
|
||||
logger.debug('Trying to delete encrypted password with id ', name);
|
||||
await KvStore.instance().deleteValue(`${kvStorePrefix}${name}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
在新工单中引用
屏蔽一个用户