Details
Run this code in keyserver-connection-handler (both web and native)
const devices = await identityClient?.getOutboundKeysForUser( '3CF3B2B6-FE28-4475-8CB3-68609A246D06', //3CF3B2B6-FE28-4475-8CB3-68609A246D06 ); console.log('Keys: ', devices); for (const deviceKeys of devices) { if (!deviceKeys.keys) { console.log(`No keys for device: ${deviceKeys.deviceID}`); continue; } try { const initMessage = await olmSessionCreatorContext.contentSessionCreator( deviceKeys.keys.identityKeysBlob.primaryIdentityPublicKeys, deviceKeys.keys.contentInitializationInfo, ); console.log( `Session with device ${deviceKeys.deviceID} created: ${initMessage}`, ); } catch (e) { console.log( `Session with device ${deviceKeys.deviceID} creation error: ${e.message}`, ); } }
(if someone want to also test it please use different deviceID)
Diff Detail
- Repository
- rCOMM Comm
- Branch
- publish-web-outbound
- Lint
No Lint Coverage - Unit
No Test Coverage
Event Timeline
web/account/account-hooks.js | ||
---|---|---|
181 | This function is confusingly named... it says it creates a new notif session, but it appears to actually create a brand new Olm account We don't want to use separate Olm accounts for the notif identity depending on keyserver, right? If that's correct, shouldn't the creation of the olm.Account be separated from the creation of the olm.Session? Am I missing something? | |
263 | Same comment here. On the native side, commCoreModule.initializeContentOutboundSession seems to handle this correctly (using an existing, persisted account instead of creating a new one every time) |
I'm confused - we don't create a new account every time. We use the idempotent method getOrCreateCryptoStore which returned existing olm account or create new one if needed.
I know in code there is new olm.Account() but it's used only to create an object which is two lines below filled with pickled account from the crypto store.
As far as I know, creating a new account is done by account.create(); and we don't do that here. In theory, this code could result in creating a new account when there isn't any account yet, but we call this function on login so I think this code uses only previously created account.
We creating an outbound session which should result in creating a new session and I think does not change the account - inbound is different because we have to also delete used one-time keys, but this has not been implemented yet.