Minor fixes
This commit is contained in:
parent
9efc5b089a
commit
bd72302c25
@ -215,17 +215,17 @@ export default class Services {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async sendNewTxMessage(message: string) {
|
async sendNewTxMessage(message: string) {
|
||||||
await sendMessage('NewTx', message);
|
sendMessage('NewTx', message);
|
||||||
}
|
}
|
||||||
|
|
||||||
async sendCommitMessage(message: string) {
|
async sendCommitMessage(message: string) {
|
||||||
await sendMessage('Commit', message);
|
sendMessage('Commit', message);
|
||||||
}
|
}
|
||||||
|
|
||||||
async sendCipherMessages(ciphers: string[]) {
|
async sendCipherMessages(ciphers: string[]) {
|
||||||
for (let i = 0; i < ciphers.length; i++) {
|
for (let i = 0; i < ciphers.length; i++) {
|
||||||
const cipher = ciphers[i];
|
const cipher = ciphers[i];
|
||||||
await sendMessage('Cipher', cipher);
|
sendMessage('Cipher', cipher);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -235,8 +235,8 @@ export default class Services {
|
|||||||
|
|
||||||
async parseCipher(message: string) {
|
async parseCipher(message: string) {
|
||||||
try {
|
try {
|
||||||
console.log('parsing new cipher');
|
// console.log('parsing new cipher');
|
||||||
const apiReturn = await this.sdkClient.parse_cipher(message);
|
const apiReturn = this.sdkClient.parse_cipher(message);
|
||||||
console.log('🚀 ~ Services ~ parseCipher ~ apiReturn:', apiReturn);
|
console.log('🚀 ~ Services ~ parseCipher ~ apiReturn:', apiReturn);
|
||||||
await this.handleApiReturn(apiReturn);
|
await this.handleApiReturn(apiReturn);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@ -247,12 +247,11 @@ export default class Services {
|
|||||||
|
|
||||||
async parseNewTx(tx: string) {
|
async parseNewTx(tx: string) {
|
||||||
try {
|
try {
|
||||||
const parsedTx = await this.sdkClient.parse_new_tx(tx, 0);
|
const parsedTx = this.sdkClient.parse_new_tx(tx, 0);
|
||||||
if (parsedTx) {
|
if (parsedTx) {
|
||||||
console.log('🚀 ~ Services ~ parseNewTx ~ parsedTx:', parsedTx);
|
|
||||||
try {
|
try {
|
||||||
await this.handleApiReturn(parsedTx);
|
await this.handleApiReturn(parsedTx);
|
||||||
const newDevice = await this.dumpDevice();
|
const newDevice = this.dumpDevice();
|
||||||
await this.saveDevice(newDevice);
|
await this.saveDevice(newDevice);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('Failed to update device with new tx');
|
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 }));
|
const entries = Object.entries(confirmedSecrets).map(([key, value]) => ({ key, value }));
|
||||||
for (const entry of entries) {
|
for (const entry of entries) {
|
||||||
db.addObject({
|
try {
|
||||||
storeName: 'shared_secrets',
|
db.addObject({
|
||||||
object: entry.value,
|
storeName: 'shared_secrets',
|
||||||
key: entry.key,
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user