@openclaw/matrix 2026.8.1 → 2026.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{account-selection-C8nnBTxi.js → account-selection-DA-jfx22.js} +11 -9
- package/dist/{accounts-fC57n-Jo.js → accounts-DR1c4xF_.js} +2 -2
- package/dist/api.js +5 -5
- package/dist/{approval-handler.runtime-BBjFZw1t.js → approval-handler.runtime-xcVrZw9o.js} +5 -5
- package/dist/{approval-ids-DTIdXV-m.js → approval-ids-hmvhDNBj.js} +1 -1
- package/dist/{approval-reaction-auth-BDONXxnF.js → approval-reaction-auth-DziFGHSk.js} +2 -2
- package/dist/{approval-reactions-tXh9KYrW.js → approval-reactions-1fwEhoK9.js} +1 -1
- package/dist/{channel-BkEcVUs_.js → channel-D6-ajB_u.js} +51 -53
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel.runtime-CTLSBFsP.js → channel.runtime-BMA0dG2k.js} +16 -12
- package/dist/{channel.setup-CSacbORr.js → channel.setup-OIEzCzSs.js} +21 -19
- package/dist/{cli-DRVtgrq5.js → cli-B6HF7Hmn.js} +38 -29
- package/dist/{cli-metadata-Ddx_y4Os.js → cli-metadata-Mtzu5-AY.js} +1 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/{client-CZ_JvrO0.js → client-B0yMDho1.js} +2 -2
- package/dist/{client-kSi51NKp.js → client-DFsRJEgB.js} +69 -16
- package/dist/{client-bootstrap-D8irSL2i.js → client-bootstrap-DjXCKEtg.js} +1 -1
- package/dist/{config-update-DC0fWBxc.js → config-update-BnX26jCO.js} +46 -28
- package/dist/contract-api.js +2 -2
- package/dist/{credentials-BdAaWuiR.js → credentials-DJj2xs3q.js} +4 -8
- package/dist/{credentials-read-B37cQknZ.js → credentials-read-mexhw-Ur.js} +7 -5
- package/dist/{credentials-write.runtime-nAV2-5uR.js → credentials-write.runtime-DQt-kgJq.js} +1 -1
- package/dist/{crypto-runtime-C4WDYxlP.js → crypto-runtime-QvlgyCkj.js} +6 -6
- package/dist/{deps-CcVJfvRM.js → deps-mtxF2mHI.js} +1 -1
- package/dist/{directory-live-DKr0w35b.js → directory-live-Drh343TW.js} +8 -6
- package/dist/{doctor-EWf9CDso.js → doctor-CJE8wO6y.js} +1 -1
- package/dist/{doctor-contract-DEt4O4Zt.js → doctor-contract-HyWFZQVG.js} +5 -4
- package/dist/doctor-contract-api.js +7 -7
- package/dist/{draft-stream-0CEpNrBk.js → draft-stream-DhGHVdO4.js} +1 -1
- package/dist/{encryption-guidance-D4ZdAqzM.js → encryption-guidance-BNcZNQZI.js} +3 -2
- package/dist/helper-api.js +1 -1
- package/dist/{http-client-D8o8b9u6.js → http-client-DOmFvKvB.js} +10 -7
- package/dist/{idb-persistence-DfgW720p.js → idb-persistence-D4NGNQxt.js} +2 -2
- package/dist/{idb-persistence-lock-DAJ49nZX.js → idb-persistence-lock-B3fZXyF_.js} +1 -1
- package/dist/{inbound-dedupe-RvSLqdsz.js → inbound-dedupe-Ch33GU06.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/{messages-DaGRt-tu.js → messages-DlMQaC02.js} +2 -2
- package/dist/{monitor-CLPbPcR9.js → monitor-U2LcVtHt.js} +49 -74
- package/dist/plugin-entry.handlers.runtime.js +1 -1
- package/dist/probe.runtime-CNo-5_iz.js +2 -0
- package/dist/{profile-update-zXVCMg7y.js → profile-update-CsyKA9jI.js} +5 -4
- package/dist/{profile-D-Wubo0A.js → profile-vmjsmhh4.js} +1 -1
- package/dist/{reaction-events-CjVUiqcY.js → reaction-events-lwNc5I1X.js} +8 -6
- package/dist/{resolve-targets-qG6gceps.js → resolve-targets-D3Eakgzs.js} +1 -1
- package/dist/{resolver.runtime-zX3TR3TN.js → resolver.runtime-DJQxR35r.js} +1 -1
- package/dist/{room-info-yheP1mod.js → room-info-DIU67XLP.js} +3 -3
- package/dist/runtime-api.js +2 -2
- package/dist/{sdk-TZYyo0XQ.js → sdk-Jl2CgAbJ.js} +518 -23
- package/dist/{send-BL_iH5Ox.js → send-DfS5ciUL.js} +13 -9
- package/dist/session-binding-contract-api.js +1 -1
- package/dist/{setup-bootstrap-D8M7FmcO.js → setup-bootstrap-CWoIWudw.js} +2 -2
- package/dist/{setup-core-r6L0nno-.js → setup-core-CZM496H-.js} +7 -6
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{setup-surface-g174ElFO.js → setup-surface-DSZtOsWK.js} +83 -77
- package/dist/{startup-verification-Cs08ca8u.js → startup-verification-1Ney1mmI.js} +2 -2
- package/dist/{storage-BsGuHngK.js → storage-BVf4uucD.js} +5 -4
- package/dist/{subagent-hooks-CMoZaARG.js → subagent-hooks-DeICLbU5.js} +5 -1
- package/dist/subagent-hooks-api.js +1 -1
- package/dist/sync-cache-state-d-A_OhbU.js +234 -0
- package/dist/{thread-bindings-ERWNousC.js → thread-bindings-2HN2AyLu.js} +2 -2
- package/dist/{tool-actions.runtime-DcBCSwY4.js → tool-actions.runtime-CFZZPG5g.js} +225 -163
- package/dist/{verification-4vsW_WSn.js → verification-CD7k5vE9.js} +2 -2
- package/node_modules/matrix-js-sdk/lib/client.d.ts +2 -1
- package/node_modules/matrix-js-sdk/lib/client.js +6 -2
- package/node_modules/matrix-js-sdk/lib/sync.js +8 -8
- package/node_modules/matrix-js-sdk/src/client.ts +7 -3
- package/node_modules/matrix-js-sdk/src/sync.ts +8 -8
- package/node_modules/typebox/build/format/email.mjs +1 -1
- package/node_modules/typebox/build/format/idna/idn-hostname.mjs +19 -1
- package/node_modules/typebox/package.json +1 -1
- package/package.json +5 -5
- package/dist/file-sync-store-DjskBX2o.js +0 -436
- package/dist/probe.runtime-Bxpr1FFy.js +0 -2
- package/dist/recovery-key-store-CognuDys.js +0 -276
|
@@ -1,276 +0,0 @@
|
|
|
1
|
-
import { A as writeMatrixRecoveryKeyStateForPath, E as readMatrixRecoveryKeyStateForPath, S as readLegacyMatrixRecoveryKeyFile, _ as migrateLegacyMatrixRecoveryKeyFilePathToStore } from "./storage-BsGuHngK.js";
|
|
2
|
-
import { n as LogService } from "./logger-B_71hN6W.js";
|
|
3
|
-
import { t as formatMatrixErrorReason } from "./errors-DKVS3_DO.js";
|
|
4
|
-
import path from "node:path";
|
|
5
|
-
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
6
|
-
import { decodeRecoveryKey } from "matrix-js-sdk/lib/crypto-api/recovery-key.js";
|
|
7
|
-
//#region extensions/matrix/src/matrix/sdk/recovery-key-store.ts
|
|
8
|
-
function isRepairableSecretStorageAccessError(err) {
|
|
9
|
-
const message = formatMatrixErrorReason(err);
|
|
10
|
-
if (!message) return false;
|
|
11
|
-
if (message.includes("getsecretstoragekey callback returned falsey")) return true;
|
|
12
|
-
if (message.includes("decrypting secret") && message.includes("bad mac")) return true;
|
|
13
|
-
return false;
|
|
14
|
-
}
|
|
15
|
-
var MatrixRecoveryKeyStore = class {
|
|
16
|
-
constructor(recoveryKeyPath) {
|
|
17
|
-
this.secretStorageKeyCache = /* @__PURE__ */ new Map();
|
|
18
|
-
this.stagedRecoveryKey = null;
|
|
19
|
-
this.stagedRecoveryKeyUsed = false;
|
|
20
|
-
this.stagedCacheKeyIds = /* @__PURE__ */ new Set();
|
|
21
|
-
this.recoveryKeyPath = recoveryKeyPath;
|
|
22
|
-
this.storageRootDir = recoveryKeyPath ? path.dirname(recoveryKeyPath) : void 0;
|
|
23
|
-
if (this.recoveryKeyPath) try {
|
|
24
|
-
migrateLegacyMatrixRecoveryKeyFilePathToStore(this.recoveryKeyPath);
|
|
25
|
-
} catch (err) {
|
|
26
|
-
this.legacyRecoveryKeyPathOnMigrationFailure = this.recoveryKeyPath;
|
|
27
|
-
LogService.warn("MatrixClientLite", "Failed to migrate Matrix recovery key state:", err);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
buildCryptoCallbacks() {
|
|
31
|
-
return {
|
|
32
|
-
getSecretStorageKey: async ({ keys }) => {
|
|
33
|
-
const requestedKeyIds = Object.keys(keys ?? {});
|
|
34
|
-
if (requestedKeyIds.length === 0) return null;
|
|
35
|
-
const staged = this.resolveStagedSecretStorageKey(requestedKeyIds);
|
|
36
|
-
if (staged) return staged;
|
|
37
|
-
for (const keyId of requestedKeyIds) {
|
|
38
|
-
const cached = this.secretStorageKeyCache.get(keyId);
|
|
39
|
-
if (cached) return [keyId, new Uint8Array(cached.key)];
|
|
40
|
-
}
|
|
41
|
-
const stored = this.loadStoredRecoveryKey();
|
|
42
|
-
if (!stored?.privateKeyBase64) return null;
|
|
43
|
-
const privateKey = new Uint8Array(Buffer.from(stored.privateKeyBase64, "base64"));
|
|
44
|
-
if (privateKey.length === 0) return null;
|
|
45
|
-
if (stored.keyId && requestedKeyIds.includes(stored.keyId)) {
|
|
46
|
-
this.rememberSecretStorageKey(stored.keyId, privateKey, stored.keyInfo);
|
|
47
|
-
return [stored.keyId, privateKey];
|
|
48
|
-
}
|
|
49
|
-
const firstRequestedKeyId = requestedKeyIds[0];
|
|
50
|
-
if (!firstRequestedKeyId) return null;
|
|
51
|
-
this.rememberSecretStorageKey(firstRequestedKeyId, privateKey, stored.keyInfo);
|
|
52
|
-
return [firstRequestedKeyId, privateKey];
|
|
53
|
-
},
|
|
54
|
-
cacheSecretStorageKey: (keyId, keyInfo, key) => {
|
|
55
|
-
const privateKey = new Uint8Array(key);
|
|
56
|
-
const normalizedKeyInfo = {
|
|
57
|
-
passphrase: keyInfo?.passphrase,
|
|
58
|
-
name: typeof keyInfo?.name === "string" ? keyInfo.name : void 0
|
|
59
|
-
};
|
|
60
|
-
this.rememberSecretStorageKey(keyId, privateKey, normalizedKeyInfo);
|
|
61
|
-
const stored = this.loadStoredRecoveryKey();
|
|
62
|
-
this.saveRecoveryKeyToDisk({
|
|
63
|
-
keyId,
|
|
64
|
-
keyInfo: normalizedKeyInfo,
|
|
65
|
-
privateKey,
|
|
66
|
-
encodedPrivateKey: stored?.encodedPrivateKey
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
getRecoveryKeySummary() {
|
|
72
|
-
const stored = this.loadStoredRecoveryKey();
|
|
73
|
-
if (!stored) return null;
|
|
74
|
-
return {
|
|
75
|
-
encodedPrivateKey: stored.encodedPrivateKey,
|
|
76
|
-
keyId: stored.keyId,
|
|
77
|
-
createdAt: stored.createdAt
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
getSecretStorageKeyCandidate(keyId) {
|
|
81
|
-
const normalizedKeyId = keyId.trim();
|
|
82
|
-
if (!normalizedKeyId) return null;
|
|
83
|
-
const staged = this.resolveStagedSecretStorageKey([normalizedKeyId]);
|
|
84
|
-
if (staged) return staged[1];
|
|
85
|
-
const stored = this.loadStoredRecoveryKey();
|
|
86
|
-
if (!stored?.privateKeyBase64) return null;
|
|
87
|
-
const privateKey = new Uint8Array(Buffer.from(stored.privateKeyBase64, "base64"));
|
|
88
|
-
if (privateKey.length === 0) return null;
|
|
89
|
-
this.rememberSecretStorageKey(normalizedKeyId, privateKey, stored.keyInfo);
|
|
90
|
-
return privateKey;
|
|
91
|
-
}
|
|
92
|
-
resolveEncodedRecoveryKeyInput(params) {
|
|
93
|
-
const encodedPrivateKey = params.encodedPrivateKey.trim();
|
|
94
|
-
if (!encodedPrivateKey) throw new Error("Matrix recovery key is required");
|
|
95
|
-
let privateKey;
|
|
96
|
-
try {
|
|
97
|
-
privateKey = decodeRecoveryKey(encodedPrivateKey);
|
|
98
|
-
} catch (err) {
|
|
99
|
-
throw new Error(`Invalid Matrix recovery key: ${formatErrorMessage(err)}`, { cause: err });
|
|
100
|
-
}
|
|
101
|
-
const keyId = typeof params.keyId === "string" && params.keyId.trim() ? params.keyId.trim() : null;
|
|
102
|
-
return {
|
|
103
|
-
encodedPrivateKey,
|
|
104
|
-
privateKey,
|
|
105
|
-
keyId,
|
|
106
|
-
keyInfo: params.keyInfo ?? this.loadStoredRecoveryKey()?.keyInfo
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
storeEncodedRecoveryKey(params) {
|
|
110
|
-
const prepared = this.resolveEncodedRecoveryKeyInput(params);
|
|
111
|
-
this.saveRecoveryKeyToDisk({
|
|
112
|
-
keyId: prepared.keyId,
|
|
113
|
-
keyInfo: prepared.keyInfo,
|
|
114
|
-
privateKey: prepared.privateKey,
|
|
115
|
-
encodedPrivateKey: prepared.encodedPrivateKey
|
|
116
|
-
});
|
|
117
|
-
if (prepared.keyId) this.rememberSecretStorageKey(prepared.keyId, prepared.privateKey, prepared.keyInfo);
|
|
118
|
-
return this.getRecoveryKeySummary() ?? {};
|
|
119
|
-
}
|
|
120
|
-
stageEncodedRecoveryKey(params) {
|
|
121
|
-
const prepared = this.resolveEncodedRecoveryKeyInput(params);
|
|
122
|
-
this.discardStagedRecoveryKey();
|
|
123
|
-
this.stagedRecoveryKey = {
|
|
124
|
-
version: 1,
|
|
125
|
-
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
126
|
-
keyId: prepared.keyId,
|
|
127
|
-
encodedPrivateKey: prepared.encodedPrivateKey,
|
|
128
|
-
privateKeyBase64: Buffer.from(prepared.privateKey).toString("base64"),
|
|
129
|
-
keyInfo: prepared.keyInfo
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
hasStagedRecoveryKeyBeenUsed() {
|
|
133
|
-
return this.stagedRecoveryKeyUsed;
|
|
134
|
-
}
|
|
135
|
-
commitStagedRecoveryKey(params) {
|
|
136
|
-
if (!this.stagedRecoveryKey) return this.getRecoveryKeySummary();
|
|
137
|
-
const staged = this.stagedRecoveryKey;
|
|
138
|
-
const privateKey = new Uint8Array(Buffer.from(staged.privateKeyBase64, "base64"));
|
|
139
|
-
const keyId = typeof params?.keyId === "string" && params.keyId.trim() ? params.keyId.trim() : staged.keyId;
|
|
140
|
-
this.saveRecoveryKeyToDisk({
|
|
141
|
-
keyId,
|
|
142
|
-
keyInfo: params?.keyInfo ?? staged.keyInfo,
|
|
143
|
-
privateKey,
|
|
144
|
-
encodedPrivateKey: staged.encodedPrivateKey
|
|
145
|
-
});
|
|
146
|
-
this.clearStagedRecoveryKeyTracking();
|
|
147
|
-
return this.getRecoveryKeySummary();
|
|
148
|
-
}
|
|
149
|
-
discardStagedRecoveryKey() {
|
|
150
|
-
for (const keyId of this.stagedCacheKeyIds) this.secretStorageKeyCache.delete(keyId);
|
|
151
|
-
this.clearStagedRecoveryKeyTracking();
|
|
152
|
-
}
|
|
153
|
-
async bootstrapSecretStorageWithRecoveryKey(crypto, options = {}) {
|
|
154
|
-
let status = null;
|
|
155
|
-
const getSecretStorageStatus = crypto.getSecretStorageStatus;
|
|
156
|
-
if (typeof getSecretStorageStatus === "function") try {
|
|
157
|
-
status = await getSecretStorageStatus.call(crypto);
|
|
158
|
-
} catch (err) {
|
|
159
|
-
LogService.warn("MatrixClientLite", "Failed to read secret storage status:", err);
|
|
160
|
-
}
|
|
161
|
-
const hasDefaultSecretStorageKey = Boolean(status?.defaultKeyId);
|
|
162
|
-
const hasKnownInvalidSecrets = Object.values(status?.secretStorageKeyValidityMap ?? {}).some((valid) => !valid);
|
|
163
|
-
let generatedRecoveryKey = false;
|
|
164
|
-
const storedRecovery = this.loadStoredRecoveryKey();
|
|
165
|
-
const stagedRecovery = this.stagedRecoveryKey;
|
|
166
|
-
const sourceRecovery = options.forceNewRecoveryKey === true ? null : stagedRecovery ?? storedRecovery;
|
|
167
|
-
let recoveryKey = sourceRecovery ? {
|
|
168
|
-
keyInfo: sourceRecovery.keyInfo,
|
|
169
|
-
privateKey: new Uint8Array(Buffer.from(sourceRecovery.privateKeyBase64, "base64")),
|
|
170
|
-
encodedPrivateKey: sourceRecovery.encodedPrivateKey
|
|
171
|
-
} : null;
|
|
172
|
-
if (recoveryKey && status?.defaultKeyId) {
|
|
173
|
-
const defaultKeyId = status.defaultKeyId;
|
|
174
|
-
if (!stagedRecovery) {
|
|
175
|
-
this.rememberSecretStorageKey(defaultKeyId, recoveryKey.privateKey, recoveryKey.keyInfo);
|
|
176
|
-
if (storedRecovery && storedRecovery.keyId !== defaultKeyId) this.saveRecoveryKeyToDisk({
|
|
177
|
-
keyId: defaultKeyId,
|
|
178
|
-
keyInfo: recoveryKey.keyInfo,
|
|
179
|
-
privateKey: recoveryKey.privateKey,
|
|
180
|
-
encodedPrivateKey: recoveryKey.encodedPrivateKey
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
const ensureRecoveryKey = async () => {
|
|
185
|
-
if (recoveryKey) {
|
|
186
|
-
if (stagedRecovery) this.stagedRecoveryKeyUsed = true;
|
|
187
|
-
return recoveryKey;
|
|
188
|
-
}
|
|
189
|
-
if (typeof crypto.createRecoveryKeyFromPassphrase !== "function") throw new Error("Matrix crypto backend does not support recovery key generation (createRecoveryKeyFromPassphrase missing)");
|
|
190
|
-
recoveryKey = await crypto.createRecoveryKeyFromPassphrase();
|
|
191
|
-
this.saveRecoveryKeyToDisk(recoveryKey);
|
|
192
|
-
generatedRecoveryKey = true;
|
|
193
|
-
return recoveryKey;
|
|
194
|
-
};
|
|
195
|
-
const shouldRecreateSecretStorage = options.forceNewSecretStorage === true || !hasDefaultSecretStorageKey || !recoveryKey && status?.ready === false || hasKnownInvalidSecrets;
|
|
196
|
-
if (hasKnownInvalidSecrets) recoveryKey = null;
|
|
197
|
-
const secretStorageOptions = { setupNewKeyBackup: options.setupNewKeyBackup === true };
|
|
198
|
-
if (shouldRecreateSecretStorage) {
|
|
199
|
-
secretStorageOptions.setupNewSecretStorage = true;
|
|
200
|
-
secretStorageOptions.createSecretStorageKey = ensureRecoveryKey;
|
|
201
|
-
}
|
|
202
|
-
try {
|
|
203
|
-
await crypto.bootstrapSecretStorage(secretStorageOptions);
|
|
204
|
-
} catch (err) {
|
|
205
|
-
if (!(options.allowSecretStorageRecreateWithoutRecoveryKey === true && hasDefaultSecretStorageKey && isRepairableSecretStorageAccessError(err))) throw err;
|
|
206
|
-
recoveryKey = null;
|
|
207
|
-
LogService.warn("MatrixClientLite", "Secret storage exists on the server but local recovery material cannot unlock it; recreating secret storage during explicit bootstrap.");
|
|
208
|
-
await crypto.bootstrapSecretStorage({
|
|
209
|
-
setupNewSecretStorage: true,
|
|
210
|
-
setupNewKeyBackup: options.setupNewKeyBackup === true,
|
|
211
|
-
createSecretStorageKey: ensureRecoveryKey
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
if (generatedRecoveryKey && this.storageRootDir) LogService.warn("MatrixClientLite", "Generated Matrix recovery key and saved it to Matrix SQLite state. Keep the displayed recovery key secure.");
|
|
215
|
-
}
|
|
216
|
-
clearStagedRecoveryKeyTracking() {
|
|
217
|
-
this.stagedRecoveryKey = null;
|
|
218
|
-
this.stagedRecoveryKeyUsed = false;
|
|
219
|
-
this.stagedCacheKeyIds.clear();
|
|
220
|
-
}
|
|
221
|
-
resolveStagedSecretStorageKey(requestedKeyIds) {
|
|
222
|
-
const staged = this.stagedRecoveryKey;
|
|
223
|
-
if (!staged?.privateKeyBase64) return null;
|
|
224
|
-
const privateKey = new Uint8Array(Buffer.from(staged.privateKeyBase64, "base64"));
|
|
225
|
-
if (privateKey.length === 0) return null;
|
|
226
|
-
const keyId = staged.keyId && requestedKeyIds.includes(staged.keyId) ? staged.keyId : requestedKeyIds[0];
|
|
227
|
-
if (!keyId) return null;
|
|
228
|
-
this.rememberStagedSecretStorageKey(keyId, privateKey, staged.keyInfo);
|
|
229
|
-
this.stagedCacheKeyIds.add(keyId);
|
|
230
|
-
return [keyId, privateKey];
|
|
231
|
-
}
|
|
232
|
-
rememberStagedSecretStorageKey(keyId, key, keyInfo) {
|
|
233
|
-
this.stagedRecoveryKeyUsed = true;
|
|
234
|
-
this.rememberSecretStorageKey(keyId, key, keyInfo);
|
|
235
|
-
}
|
|
236
|
-
rememberSecretStorageKey(keyId, key, keyInfo) {
|
|
237
|
-
if (!keyId.trim()) return;
|
|
238
|
-
this.secretStorageKeyCache.set(keyId, {
|
|
239
|
-
key: new Uint8Array(key),
|
|
240
|
-
keyInfo
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
|
-
loadStoredRecoveryKey() {
|
|
244
|
-
if (!this.recoveryKeyPath) return null;
|
|
245
|
-
try {
|
|
246
|
-
const stored = readMatrixRecoveryKeyStateForPath(this.recoveryKeyPath);
|
|
247
|
-
if (stored) return stored;
|
|
248
|
-
} catch {}
|
|
249
|
-
if (this.legacyRecoveryKeyPathOnMigrationFailure) return readLegacyMatrixRecoveryKeyFile(this.legacyRecoveryKeyPathOnMigrationFailure);
|
|
250
|
-
return null;
|
|
251
|
-
}
|
|
252
|
-
saveRecoveryKeyToDisk(params) {
|
|
253
|
-
if (!this.recoveryKeyPath) return;
|
|
254
|
-
try {
|
|
255
|
-
const payload = {
|
|
256
|
-
version: 1,
|
|
257
|
-
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
258
|
-
keyId: typeof params.keyId === "string" ? params.keyId : null,
|
|
259
|
-
encodedPrivateKey: params.encodedPrivateKey,
|
|
260
|
-
privateKeyBase64: Buffer.from(params.privateKey).toString("base64"),
|
|
261
|
-
keyInfo: params.keyInfo ? {
|
|
262
|
-
passphrase: params.keyInfo.passphrase,
|
|
263
|
-
name: params.keyInfo.name
|
|
264
|
-
} : void 0
|
|
265
|
-
};
|
|
266
|
-
writeMatrixRecoveryKeyStateForPath({
|
|
267
|
-
recoveryKeyPath: this.recoveryKeyPath,
|
|
268
|
-
payload
|
|
269
|
-
});
|
|
270
|
-
} catch (err) {
|
|
271
|
-
LogService.warn("MatrixClientLite", "Failed to persist recovery key:", err);
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
};
|
|
275
|
-
//#endregion
|
|
276
|
-
export { isRepairableSecretStorageAccessError as n, MatrixRecoveryKeyStore as t };
|