Добавить кошелек блокчейна и озвучивание агента

This commit is contained in:
AidarKC
2026-05-29 23:48:44 +04:00
parent 775b655aac
commit 3a5856c7f0
19 changed files with 1301 additions and 28 deletions
+14 -4
View File
@@ -852,16 +852,26 @@ export class AuthService {
const cleanLogin = (login || '').trim();
if (!cleanLogin) throw new Error('Введите логин');
const user = await this.getUser(cleanLogin);
if (!user.exists) throw new Error('Пользователь не найден');
const keyBundle = await this.derivePasswordKeyBundle(cleanLogin, password);
const session = await this.createAuthSession(cleanLogin, keyBundle);
return { ...session, keyBundle };
}
async persistSelectedKeys(login, storagePwd, keyBundle, saveOptions = { saveRoot: true, saveBlockchain: true }) {
const secrets = { deviceKey: keyBundle.devicePair.privatePkcs8B64 };
let currentSecrets = {};
try {
const loaded = await loadEncryptedUserSecrets(login, storagePwd);
if (loaded && typeof loaded === 'object') {
currentSecrets = loaded;
}
} catch {
// Если контейнера ещё нет или пароль новый для этого логина — создадим новый ниже.
}
const secrets = {
...currentSecrets,
deviceKey: keyBundle.devicePair.privatePkcs8B64,
};
if (saveOptions.saveRoot) secrets.rootKey = keyBundle.rootPair.privatePkcs8B64;
if (saveOptions.saveBlockchain) secrets.blockchainKey = keyBundle.blockchainPair.privatePkcs8B64;
await saveEncryptedUserSecrets(login, storagePwd, secrets);