Minor fixes

This commit is contained in:
Sosthene 2024-11-30 20:08:32 +01:00
parent 9efc5b089a
commit bd72302c25

View File

@ -215,17 +215,17 @@ export default class Services {
}
async sendNewTxMessage(message: string) {
await sendMessage('NewTx', message);
sendMessage('NewTx', message);
}
async sendCommitMessage(message: string) {
await sendMessage('Commit', message);
sendMessage('Commit', message);
}
async sendCipherMessages(ciphers: string[]) {
for (let i = 0; i < ciphers.length; i++) {
const cipher = ciphers[i];
await sendMessage('Cipher', cipher);
sendMessage('Cipher', cipher);
}
}
@ -235,8 +235,8 @@ export default class Services {
async parseCipher(message: string) {
try {
console.log('parsing new cipher');
const apiReturn = await this.sdkClient.parse_cipher(message);
// console.log('parsing new cipher');
const apiReturn = this.sdkClient.parse_cipher(message);
console.log('🚀 ~ Services ~ parseCipher ~ apiReturn:', apiReturn);
await this.handleApiReturn(apiReturn);
} catch (e) {
@ -247,12 +247,11 @@ export default class Services {
async parseNewTx(tx: string) {
try {
const parsedTx = await this.sdkClient.parse_new_tx(tx, 0);
const parsedTx = this.sdkClient.parse_new_tx(tx, 0);
if (parsedTx) {
console.log('🚀 ~ Services ~ parseNewTx ~ parsedTx:', parsedTx);
try {
await this.handleApiReturn(parsedTx);
const newDevice = await this.dumpDevice();
const newDevice = this.dumpDevice();
await this.saveDevice(newDevice);
} catch (e) {
console.error('Failed to update device with new tx');
@ -296,11 +295,18 @@ export default class Services {
}
const entries = Object.entries(confirmedSecrets).map(([key, value]) => ({ key, value }));
for (const entry of entries) {
try {
db.addObject({
storeName: 'shared_secrets',
object: entry.value,
key: entry.key,
});
} catch (e) {
throw e;
}
// We don't want to throw an error, it could simply be that we registered directly the shared secret
// this.removeUnconfirmedSecret(entry.value);
}
}