-
Notifications
You must be signed in to change notification settings - Fork 3
Sync profile and apps #105
base: master
Are you sure you want to change the base?
Conversation
f636a03
to
0085be8
Compare
const { dbExists } = common.utils | ||
const { genAESKey, exportKey } = common.crypto | ||
|
||
const waitForSync = async (db1, db2) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A function similar to this one could help us detect if a DB is synced with another one. We will move this to another file
|
||
// register current device if it does not exist | ||
const device = await this.getDevice() | ||
if (!device) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: move this to a function. This should add the device once and for all, for each new device
|
||
await new Promise((resolve) => { setTimeout(resolve, 5000) }) | ||
|
||
expect(masq.appsDBs['app2' + '-copy']._authorized).to.have.lengthOf(2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this copy
things need to be refactored
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's that bad as it's only in the context of the tests. We absolutely need to replicate data between two different Indexeddb databases
src/lib/sync-profile.js
Outdated
|
||
data = await waitForDataFromPeer(this.peer) | ||
const { msg, id, key, publicProfile } = await decryptJSON(data, this.key) | ||
debug('pullProfile received', msg, id, key) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't it 'pullProfile' that is received ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant "pullProfile received" like "pullProfile (the function's name) received: [the message]"
src/lib/sync-profile.js
Outdated
const { msg: msg2, key } = await decryptJSON(data, this.key) | ||
debug('pushProfile received', msg2, key) | ||
|
||
if (!key || msg2 !== 'requestWriteAccess') throw new Error('msg not expected' + msg2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
more specific error should be used
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what would you prefer ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Specify the context e.g. function and message expected
c8108d4
to
fa1c71b
Compare
5997c0e
to
715d502
Compare
1958e83
to
8030338
Compare
* add promise timeout method * Close sw if user click on close modal or click outside modal * Add getter for this.sw * Update call to joinSecureChannel with timeout + custom error message * Increase timeout delay * Remove setstate, message will eventually be updated with the default case * Remove getSW, not needed * Update translations * Transform QRCOdeModal into class component * Small refactor
* Improve modals responsiveness * Handle scanner error with an error msg * Add translations * Sync: remove extra spaces * Modal: Different padding on mobile and desktop * Card: remove width * Update fr.json
* Add migration from version alpha to 0.16 In the old version of masq alpha, the device entry in the profile db did not contain the apps info after an activation with maps. We therefore add : - _checkversion during openProfile - _addVersion for addProfile - _migration in case we need it * update .env * fix missing await for _addVersion * update device entry with apps in a generic way * rm old code before refactor * Move migration to a specific file + according changes * Fix import * Rm check getDevice (already done in openProfile)
No description provided.