mirror of
https://github.com/element-hq/element-desktop.git
synced 2025-12-24 08:11:03 -05:00
Compare commits
20 Commits
v1.12.5
...
t3chguy/fi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d9fb40bf07 | ||
|
|
ce5016f734 | ||
|
|
bd7d3b67c3 | ||
|
|
545bf3f30c | ||
|
|
90194bbd64 | ||
|
|
c827e806ea | ||
|
|
e63d76558b | ||
|
|
f2a28e33d7 | ||
|
|
d5e27e5b16 | ||
|
|
17a16d6750 | ||
|
|
a2cc5d6dc5 | ||
|
|
b99964c827 | ||
|
|
fde8bc40c8 | ||
|
|
92ff9d19b1 | ||
|
|
db40cee64e | ||
|
|
3eed0b6d43 | ||
|
|
a219672e88 | ||
|
|
5f1178a834 | ||
|
|
eabdab4db7 | ||
|
|
8499e091c9 |
4
.github/workflows/build_and_deploy.yaml
vendored
4
.github/workflows/build_and_deploy.yaml
vendored
@@ -216,7 +216,7 @@ jobs:
|
||||
|
||||
- name: Notify packages.element.io of new files
|
||||
if: needs.prepare.outputs.deploy == 'true'
|
||||
uses: peter-evans/repository-dispatch@5fc4efd1a4797ddb68ffd0714a238564e4cc0e6f # v4
|
||||
uses: peter-evans/repository-dispatch@28959ce8df70de7be546dd1250a005dd32156697 # v4
|
||||
with:
|
||||
token: ${{ secrets.ELEMENT_BOT_TOKEN }}
|
||||
repository: element-hq/packages.element.io
|
||||
@@ -274,7 +274,7 @@ jobs:
|
||||
id-token: write # This is required for requesting the JWT
|
||||
steps:
|
||||
- name: Configure AWS credentials
|
||||
uses: aws-actions/configure-aws-credentials@00943011d9042930efac3dcd3a170e4273319bc8 # v5
|
||||
uses: aws-actions/configure-aws-credentials@61815dcd50bd041e203e49132bacad1fd04d2708 # v5
|
||||
with:
|
||||
role-to-assume: arn:aws:iam::264135176173:role/Push-ElementDesktop-MSI
|
||||
role-session-name: githubaction-run-${{ github.run_id }}
|
||||
|
||||
2
.github/workflows/build_and_test.yaml
vendored
2
.github/workflows/build_and_test.yaml
vendored
@@ -53,7 +53,7 @@ jobs:
|
||||
runs-on: ubuntu-24.04
|
||||
if: ${{ !cancelled() }}
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
|
||||
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6
|
||||
|
||||
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6
|
||||
with:
|
||||
|
||||
2
.github/workflows/build_linux.yaml
vendored
2
.github/workflows/build_linux.yaml
vendored
@@ -105,7 +105,7 @@ jobs:
|
||||
}
|
||||
}
|
||||
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
|
||||
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6
|
||||
with:
|
||||
repository: element-hq/element-desktop
|
||||
ref: ${{ inputs.ref }}
|
||||
|
||||
8
.github/workflows/build_macos.yaml
vendored
8
.github/workflows/build_macos.yaml
vendored
@@ -75,7 +75,7 @@ jobs:
|
||||
runs-on: macos-14 # M1
|
||||
environment: ${{ inputs.sign && 'packages.element.io' || '' }}
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
|
||||
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6
|
||||
with:
|
||||
repository: element-hq/element-desktop
|
||||
ref: ${{ inputs.ref }}
|
||||
@@ -101,7 +101,7 @@ jobs:
|
||||
rustup target add x86_64-apple-darwin
|
||||
|
||||
# M1 macos-14 comes without Python preinstalled
|
||||
- uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6
|
||||
- uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6
|
||||
with:
|
||||
python-version: "3.13"
|
||||
|
||||
@@ -113,10 +113,6 @@ jobs:
|
||||
- name: Install Deps
|
||||
run: "yarn install --frozen-lockfile"
|
||||
|
||||
# Python 3.12 drops distutils which keytar relies on
|
||||
- name: Install setuptools
|
||||
run: pip3 install setuptools
|
||||
|
||||
- name: Build Natives
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
run: yarn build:native:universal
|
||||
|
||||
2
.github/workflows/build_prepare.yaml
vendored
2
.github/workflows/build_prepare.yaml
vendored
@@ -54,7 +54,7 @@ jobs:
|
||||
outputs:
|
||||
nightly-version: ${{ steps.versions.outputs.nightly }}
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
|
||||
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6
|
||||
|
||||
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6
|
||||
with:
|
||||
|
||||
2
.github/workflows/build_test.yaml
vendored
2
.github/workflows/build_test.yaml
vendored
@@ -36,7 +36,7 @@ jobs:
|
||||
name: Test ${{ inputs.project }}
|
||||
runs-on: ${{ inputs.runs-on }}
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
|
||||
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6
|
||||
with:
|
||||
repository: ${{ github.repository == 'element-hq/element-web-pro' && 'element-hq/element-desktop' || github.repository }}
|
||||
|
||||
|
||||
2
.github/workflows/build_windows.yaml
vendored
2
.github/workflows/build_windows.yaml
vendored
@@ -108,7 +108,7 @@ jobs:
|
||||
}
|
||||
}
|
||||
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
|
||||
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6
|
||||
with:
|
||||
repository: element-hq/element-desktop
|
||||
ref: ${{ inputs.ref }}
|
||||
|
||||
2
.github/workflows/dockerbuild.yaml
vendored
2
.github/workflows/dockerbuild.yaml
vendored
@@ -19,7 +19,7 @@ jobs:
|
||||
contents: read
|
||||
packages: write
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
|
||||
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3
|
||||
|
||||
8
.github/workflows/static_analysis.yaml
vendored
8
.github/workflows/static_analysis.yaml
vendored
@@ -9,7 +9,7 @@ jobs:
|
||||
name: "Typescript Syntax Check"
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
|
||||
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6
|
||||
|
||||
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6
|
||||
with:
|
||||
@@ -35,7 +35,7 @@ jobs:
|
||||
name: "ESLint"
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
|
||||
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6
|
||||
|
||||
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6
|
||||
with:
|
||||
@@ -53,7 +53,7 @@ jobs:
|
||||
name: "Workflow Lint"
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
|
||||
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6
|
||||
|
||||
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6
|
||||
with:
|
||||
@@ -71,7 +71,7 @@ jobs:
|
||||
name: "Analyse Dead Code"
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
|
||||
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6
|
||||
|
||||
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6
|
||||
with:
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -18,3 +18,4 @@ yarn-error.log
|
||||
/hak/**/*.js
|
||||
/scripts/hak/**/*.js
|
||||
.DS_Store
|
||||
/playwright-report
|
||||
|
||||
10
CHANGELOG.md
10
CHANGELOG.md
@@ -1,3 +1,13 @@
|
||||
Changes in [1.12.6](https://github.com/element-hq/element-desktop/releases/tag/v1.12.6) (2025-12-03)
|
||||
====================================================================================================
|
||||
This release fixes a bug where 1:1 calling was incorrectly not available if no Element Call focus was set.
|
||||
|
||||
## 🐛 Bug Fixes
|
||||
|
||||
* Add option to pick call options for voice calls. ([#31413](https://github.com/element-hq/element-web/pull/31413)).
|
||||
|
||||
|
||||
|
||||
Changes in [1.12.5](https://github.com/element-hq/element-desktop/releases/tag/v1.12.5) (2025-12-02)
|
||||
====================================================================================================
|
||||
## ✨ Features
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Docker image to facilitate building Element Desktop's native bits using a glibc version (2.31)
|
||||
# with broader compatibility, down to Debian bullseye & Ubuntu focal.
|
||||
FROM rust:bullseye@sha256:8d9b5e80062dcdb7f037b4eef92a6649632034d6811652e028706ea93db64159
|
||||
FROM rust:bullseye@sha256:4886b155a84b46ad61df6a2249905bea8c61fc1eaa903398713233858ff6306b
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
@@ -9,8 +9,6 @@ RUN apt-get -qq update && apt-get -y -qq dist-upgrade && \
|
||||
apt-get -y -qq install --no-install-recommends \
|
||||
# tclsh is required for building SQLite as part of SQLCipher
|
||||
tcl \
|
||||
# libsecret-1-dev is required even for prebuild keytar
|
||||
libsecret-1-dev \
|
||||
# Used by seshat (when not SQLCIPHER_STATIC) \
|
||||
libsqlcipher-dev && \
|
||||
apt-get purge -y --auto-remove && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
21
package.json
21
package.json
@@ -3,7 +3,7 @@
|
||||
"productName": "Element",
|
||||
"main": "lib/electron-main.js",
|
||||
"exports": "./lib/electron-main.js",
|
||||
"version": "1.12.5",
|
||||
"version": "1.12.6",
|
||||
"description": "Element: the future of secure communication",
|
||||
"author": {
|
||||
"name": "Element",
|
||||
@@ -56,7 +56,7 @@
|
||||
"test": "playwright test",
|
||||
"test:open": "yarn test --ui",
|
||||
"test:screenshots:build": "docker build playwright -t element-desktop-playwright --platform linux/amd64",
|
||||
"test:screenshots:run": "docker run --rm --network host -v $(pwd):/work/element-desktop -v /var/run/docker.sock:/var/run/docker.sock --platform linux/amd64 -it element-desktop-playwright",
|
||||
"test:screenshots:run": "docker run --rm --network host -v $(pwd):/work/element-desktop -v element-desktop-playwright:/work/element-desktop/node_modules -v /var/run/docker.sock:/var/run/docker.sock --platform linux/amd64 -it element-desktop-playwright",
|
||||
"postinstall": "patch-package && electron-builder install-app-deps"
|
||||
},
|
||||
"dependencies": {
|
||||
@@ -65,7 +65,6 @@
|
||||
"counterpart": "^0.18.6",
|
||||
"electron-store": "^11.0.0",
|
||||
"electron-window-state": "^5.0.3",
|
||||
"keytar-forked": "7.10.0",
|
||||
"minimist": "^1.2.6",
|
||||
"png-to-ico": "^3.0.0",
|
||||
"uuid": "^13.0.0"
|
||||
@@ -77,7 +76,7 @@
|
||||
"@babel/preset-env": "^7.18.10",
|
||||
"@babel/preset-typescript": "^7.18.6",
|
||||
"@electron/asar": "4.0.1",
|
||||
"@playwright/test": "1.56.1",
|
||||
"@playwright/test": "1.57.0",
|
||||
"@stylistic/eslint-plugin": "^5.0.0",
|
||||
"@types/auto-launch": "^5.0.1",
|
||||
"@types/counterpart": "^0.18.1",
|
||||
@@ -86,12 +85,12 @@
|
||||
"@types/pacote": "^11.1.1",
|
||||
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
||||
"@typescript-eslint/parser": "^8.0.0",
|
||||
"app-builder-lib": "26.1.0",
|
||||
"chokidar": "^4.0.0",
|
||||
"app-builder-lib": "26.2.0",
|
||||
"chokidar": "^5.0.0",
|
||||
"detect-libc": "^2.0.0",
|
||||
"electron": "39.1.1",
|
||||
"electron-builder": "26.1.0",
|
||||
"electron-builder-squirrel-windows": "26.1.0",
|
||||
"electron": "39.2.3",
|
||||
"electron-builder": "26.2.0",
|
||||
"electron-builder-squirrel-windows": "26.2.0",
|
||||
"electron-devtools-installer": "^4.0.0",
|
||||
"eslint": "^8.26.0",
|
||||
"eslint-config-google": "^0.14.0",
|
||||
@@ -100,7 +99,7 @@
|
||||
"eslint-plugin-matrix-org": "^3.0.0",
|
||||
"eslint-plugin-n": "^17.12.0",
|
||||
"eslint-plugin-unicorn": "^56.0.0",
|
||||
"glob": "^11.0.0",
|
||||
"glob": "^13.0.0",
|
||||
"husky": "^9.1.6",
|
||||
"knip": "^5.0.0",
|
||||
"lint-staged": "^16.0.0",
|
||||
@@ -121,6 +120,6 @@
|
||||
"resolutions": {
|
||||
"@types/node": "18.19.130",
|
||||
"config-file-ts": "0.2.8-rc1",
|
||||
"node-abi": "4.17.0"
|
||||
"node-abi": "4.24.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
FROM mcr.microsoft.com/playwright:v1.56.1-jammy@sha256:d518367161e599b64e4e8b83ff180be45bfe22efb78dde77fc4c2942340fe8ca
|
||||
FROM mcr.microsoft.com/playwright:v1.57.0-jammy@sha256:6aca677c27a967caf7673d108ac67ffaf8fed134f27e17b27a05464ca0ace831
|
||||
|
||||
WORKDIR /work/element-desktop
|
||||
|
||||
RUN apt-get update && apt-get -y install xvfb && apt-get purge -y --auto-remove && rm -rf /var/lib/apt/lists/*
|
||||
RUN apt-get update && apt-get -y install xvfb dbus-x11 && apt-get purge -y --auto-remove && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Create node_modules & dist dirs so that the volumes have the correct permissions
|
||||
RUN mkdir node_modules dist && chown 1000:1000 node_modules dist
|
||||
|
||||
USER 1000:1000
|
||||
|
||||
|
||||
@@ -8,4 +8,11 @@ sleep 2
|
||||
|
||||
export DISPLAY=:99
|
||||
|
||||
npx playwright test --update-snapshots --reporter line $1
|
||||
yarn install --frozen-lockfile
|
||||
yarn build -l --dir
|
||||
|
||||
PLAYWRIGHT_HTML_OPEN=never ELEMENT_DESKTOP_EXECUTABLE="./dist/linux-unpacked/element-desktop" \
|
||||
npx playwright test --update-snapshots --reporter line,html "$1"
|
||||
|
||||
# Clean up
|
||||
rm -R core qemu_* || exit 0
|
||||
|
||||
@@ -6,8 +6,6 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Com
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import keytar from "keytar-forked";
|
||||
|
||||
import { test, expect } from "../../element-desktop-test.js";
|
||||
|
||||
declare global {
|
||||
@@ -61,34 +59,6 @@ test.describe("App launch", () => {
|
||||
),
|
||||
).resolves.not.toBeNull();
|
||||
});
|
||||
|
||||
test.describe("migrate from keytar", () => {
|
||||
test.skip(
|
||||
process.env.GITHUB_ACTIONS && ["linux", "darwin"].includes(process.platform),
|
||||
"GitHub Actions hosted runner are not a compatible environment for this test",
|
||||
);
|
||||
|
||||
const pickleKey = "DEADBEEF1234";
|
||||
const keytarService = "element.io";
|
||||
const keytarKey = `${userId}|${deviceId}`;
|
||||
|
||||
test.beforeAll(async () => {
|
||||
await keytar.setPassword(keytarService, keytarKey, pickleKey);
|
||||
await expect(keytar.getPassword(keytarService, keytarKey)).resolves.toBe(pickleKey);
|
||||
});
|
||||
test.afterAll(async () => {
|
||||
await keytar.deletePassword(keytarService, keytarKey);
|
||||
});
|
||||
|
||||
test("should migrate successfully", async ({ page }) => {
|
||||
await expect(
|
||||
page.evaluate(
|
||||
([userId, deviceId]) => window.mxPlatformPeg.get().getPickleKey(userId, deviceId),
|
||||
[userId, deviceId],
|
||||
),
|
||||
).resolves.toBe(pickleKey);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("--no-update", () => {
|
||||
|
||||
@@ -84,7 +84,7 @@ export const test = base.extend<Fixtures>({
|
||||
args.unshift(path.join(__dirname, "..", "lib", "electron-main.js"));
|
||||
}
|
||||
|
||||
console.log(`Launching '${executablePath}' with args ${args.join(" ")}`);
|
||||
console.log(`Launching '${executablePath || "electron"}' with args ${args.join(" ")}`);
|
||||
|
||||
const app = await electron.launch({
|
||||
env: {
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 1.1 MiB |
@@ -111,7 +111,7 @@ ipcMain.on("ipcCall", async function (_ev: IpcMainEvent, payload) {
|
||||
try {
|
||||
ret = await store.getSecret(`${args[0]}|${args[1]}`);
|
||||
} catch {
|
||||
// if an error is thrown (e.g. keytar can't connect to the keychain),
|
||||
// if an error is thrown (e.g. we can't initialise safeStorage),
|
||||
// then return null, which means the default pickle key will be used
|
||||
ret = null;
|
||||
}
|
||||
|
||||
63
src/store.ts
63
src/store.ts
@@ -15,22 +15,10 @@ limitations under the License.
|
||||
*/
|
||||
|
||||
import ElectronStore from "electron-store";
|
||||
import keytar from "keytar-forked";
|
||||
import { app, safeStorage, dialog, type SafeStorage, type Session } from "electron";
|
||||
|
||||
import { _t } from "./language-helper.js";
|
||||
|
||||
/**
|
||||
* Legacy keytar service name for storing secrets.
|
||||
* @deprecated
|
||||
*/
|
||||
const KEYTAR_SERVICE = "element.io";
|
||||
/**
|
||||
* Super legacy keytar service name for reading secrets.
|
||||
* @deprecated
|
||||
*/
|
||||
const LEGACY_KEYTAR_SERVICE = "riot.im";
|
||||
|
||||
/**
|
||||
* String union type representing all the safeStorage backends.
|
||||
* + The "unknown" backend shouldn't exist in practice once the app is ready
|
||||
@@ -147,7 +135,7 @@ const enum Mode {
|
||||
/**
|
||||
* JSON-backed store for settings which need to be accessible by the main process.
|
||||
* Secrets are stored within the `safeStorage` object, encrypted with safeStorage.
|
||||
* Any secrets operations are blocked on Electron app ready emit, and keytar migration if still needed.
|
||||
* Any secrets operations are blocked on Electron app ready emit.
|
||||
*/
|
||||
class Store extends ElectronStore<StoreData> {
|
||||
private static internalInstance?: Store;
|
||||
@@ -283,8 +271,6 @@ class Store extends ElectronStore<StoreData> {
|
||||
|
||||
/**
|
||||
* Prepare the safeStorage backend for use.
|
||||
* We don't eagerly import from keytar as that would bring in data for all Element profiles and not just the current one,
|
||||
* so we import lazily in getSecret.
|
||||
*
|
||||
* This will relaunch the app in some cases, in which case it will return false and the caller should abort startup.
|
||||
*
|
||||
@@ -462,7 +448,6 @@ class Store extends ElectronStore<StoreData> {
|
||||
|
||||
/**
|
||||
* Get the stored secret for the key.
|
||||
* Lazily migrates keys from keytar if they are not yet in the store.
|
||||
*
|
||||
* @param key The string key name.
|
||||
*
|
||||
@@ -470,25 +455,11 @@ class Store extends ElectronStore<StoreData> {
|
||||
*/
|
||||
public async getSecret(key: string): Promise<string | undefined> {
|
||||
await this.safeStorageReady();
|
||||
let secret = this.secrets!.get(key);
|
||||
if (secret) return secret;
|
||||
|
||||
try {
|
||||
secret = await this.getSecretKeytar(key);
|
||||
} catch (e) {
|
||||
console.warn(`Failed to read data from keytar with key='${key}'`, e);
|
||||
}
|
||||
if (secret) {
|
||||
console.debug("Migrating secret from keytar", key);
|
||||
this.secrets!.set(key, secret);
|
||||
}
|
||||
|
||||
return secret;
|
||||
return this.secrets!.get(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the secret for the key to the keychain.
|
||||
* We write to both safeStorage & keytar to support downgrading the application.
|
||||
*
|
||||
* @param key The string key name.
|
||||
* @param secret The string password.
|
||||
@@ -498,46 +469,16 @@ class Store extends ElectronStore<StoreData> {
|
||||
public async setSecret(key: string, secret: string): Promise<void> {
|
||||
await this.safeStorageReady();
|
||||
this.secrets!.set(key, secret);
|
||||
try {
|
||||
await keytar.setPassword(KEYTAR_SERVICE, key, secret);
|
||||
} catch (e) {
|
||||
console.warn(`Failed to write safeStorage backwards-compatibility key='${key}' data to keytar`, e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the stored password for the key.
|
||||
* Removes from safeStorage, keytar & keytar legacy.
|
||||
*
|
||||
* @param key The string key name.
|
||||
*/
|
||||
public async deleteSecret(key: string): Promise<void> {
|
||||
await this.safeStorageReady();
|
||||
this.secrets!.delete(key);
|
||||
try {
|
||||
await this.deleteSecretKeytar(key);
|
||||
} catch (e) {
|
||||
console.warn(`Failed to delete secret with key='${key}' from keytar`, e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated will be removed in the near future
|
||||
*/
|
||||
private async getSecretKeytar(key: string): Promise<string | undefined> {
|
||||
return (
|
||||
(await keytar.getPassword(KEYTAR_SERVICE, key)) ??
|
||||
(await keytar.getPassword(LEGACY_KEYTAR_SERVICE, key)) ??
|
||||
undefined
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated will be removed in the near future
|
||||
*/
|
||||
private async deleteSecretKeytar(key: string): Promise<void> {
|
||||
await keytar.deletePassword(LEGACY_KEYTAR_SERVICE, key);
|
||||
await keytar.deletePassword(KEYTAR_SERVICE, key);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user