Add restoreSecrets

This commit is contained in:
Sosthene 2024-11-30 18:56:59 +01:00
parent 0b45ff3962
commit 113f036838
2 changed files with 17 additions and 0 deletions

View File

@ -104,6 +104,7 @@ async function init(): Promise<void> {
await services.restoreDevice(device);
}
await services.restoreProcesses();
await services.restoreSecrets();
if (services.isPaired()) {
await navigate('process');

View File

@ -488,6 +488,22 @@ export default class Services {
}
public async restoreSecrets() {
const db = await Database.getInstance();
try {
const sharedSecrets: Record<string, string> = await db.dumpStore('shared_secrets');
const unconfirmedSecrets = await db.dumpStore('unconfirmed_secrets');
const secretsStore = {
'shared_secrets': sharedSecrets,
'unconfirmed_secrets': Object.values(unconfirmedSecrets),
};
this.sdkClient.set_shared_secrets(JSON.stringify(secretsStore));
} catch (e) {
throw e;
}
}
getNotifications(): INotification[] {
return [
{