Changeset View
Standalone View
web/selectors/socket-selectors.js
// @flow | // @flow | ||||
import olm from '@matrix-org/olm'; | import olm from '@matrix-org/olm'; | ||||
import { createSelector } from 'reselect'; | import { createSelector } from 'reselect'; | ||||
import { | import { | ||||
getClientResponsesSelector, | getClientResponsesSelector, | ||||
sessionStateFuncSelector, | sessionStateFuncSelector, | ||||
} from 'lib/selectors/socket-selectors.js'; | } from 'lib/selectors/socket-selectors.js'; | ||||
import { createOpenSocketFunction } from 'lib/shared/socket-utils.js'; | import { createOpenSocketFunction } from 'lib/shared/socket-utils.js'; | ||||
import type { | import type { | ||||
OLMIdentityKeys, | OLMIdentityKeys, | ||||
PickledOLMAccount, | PickledOLMAccount, | ||||
SignedIdentityKeysBlob, | SignedIdentityKeysBlob, | ||||
IdentityKeysBlob, | |||||
} from 'lib/types/crypto-types.js'; | } from 'lib/types/crypto-types.js'; | ||||
import type { | import type { | ||||
ClientServerRequest, | ClientServerRequest, | ||||
ClientClientResponse, | ClientClientResponse, | ||||
} from 'lib/types/request-types.js'; | } from 'lib/types/request-types.js'; | ||||
import type { | import type { | ||||
SessionIdentification, | SessionIdentification, | ||||
SessionState, | SessionState, | ||||
Show All 30 Lines | ) => { | ||||
} | } | ||||
const primaryOLMAccount = new olm.Account(); | const primaryOLMAccount = new olm.Account(); | ||||
primaryOLMAccount.unpickle( | primaryOLMAccount.unpickle( | ||||
primaryAccount.picklingKey, | primaryAccount.picklingKey, | ||||
primaryAccount.pickledAccount, | primaryAccount.pickledAccount, | ||||
); | ); | ||||
const payloadToBeSigned = JSON.stringify({ | const identityKeysBlob: IdentityKeysBlob = { | ||||
primaryIdentityKeys, | primaryIdentityPublicKeys: primaryIdentityKeys, | ||||
notificationIdentityKeys, | notificationIdentityPublicKeys: notificationIdentityKeys, | ||||
ashoat: This seems like a really significant change. Tons of questions pop up...
1. Are we changing… | |||||
atulAuthorUnsubmitted Done Inline Actions
No
The keys in Redux CryptoStore are primaryIdentityKeys and notificationIdentityKeys. Those can be changed in a migration to primaryIdentityPublicKeys and notificationIdentityPublicKeys for consistency. I have a diff locally to make this exact change.
Yes, this was an issue that was caught locally and never got to prod. The selector is being used for the first time in this diff and the issue was found in the course of testing thanks to the validators on the keyserver side.
Sure atul: > Are we changing the format of this in the database? Do we need a migration?
No
> If I… | |||||
}); | }; | ||||
const payloadToBeSigned: string = JSON.stringify(identityKeysBlob); | |||||
const signedIdentityKeysBlob: SignedIdentityKeysBlob = { | const signedIdentityKeysBlob: SignedIdentityKeysBlob = { | ||||
payload: payloadToBeSigned, | payload: payloadToBeSigned, | ||||
signature: primaryOLMAccount.sign(payloadToBeSigned), | signature: primaryOLMAccount.sign(payloadToBeSigned), | ||||
}; | }; | ||||
return signedIdentityKeysBlob; | return signedIdentityKeysBlob; | ||||
}, | }, | ||||
); | ); | ||||
▲ Show 20 Lines • Show All 47 Lines • ▼ Show 20 Lines | ( | ||||
) => | ) => | ||||
() => | () => | ||||
sessionStateFunc(calendarActive), | sessionStateFunc(calendarActive), | ||||
); | ); | ||||
export { | export { | ||||
openSocketSelector, | openSocketSelector, | ||||
sessionIdentificationSelector, | sessionIdentificationSelector, | ||||
signedIdentityKeysBlobSelector, | |||||
webGetClientResponsesSelector, | webGetClientResponsesSelector, | ||||
webSessionStateFuncSelector, | webSessionStateFuncSelector, | ||||
}; | }; |
This seems like a really significant change. Tons of questions pop up...
Looking at the MySQL database on my personal keyserver, it appears like "Public" has been included previously, so perhaps this is just you fixing up an error that never got to prod? (I hope so...)
Separately, high-level meta-point: you should really expect your reviewer to call you out for things like this. It will save everyone some time if you annotate changes like this ahead-of-time.