Page MenuHomePhorge

D7657.1767323215.diff
No OneTemporary

Size
4 KB
Referenced Files
None
Subscribers
None

D7657.1767323215.diff

diff --git a/keyserver/src/creators/account-creator.js b/keyserver/src/creators/account-creator.js
--- a/keyserver/src/creators/account-creator.js
+++ b/keyserver/src/creators/account-creator.js
@@ -32,6 +32,7 @@
import createIDs from './id-creator.js';
import createMessages from './message-creator.js';
+import { createOlmSession } from './olm-session-creator.js';
import {
createThread,
createPrivateThread,
@@ -83,7 +84,11 @@
WHERE LCASE(username) = LCASE(${request.username})
`;
const promises = [dbQuery(usernameQuery)];
- const { calendarQuery, signedIdentityKeysBlob } = request;
+ const {
+ calendarQuery,
+ signedIdentityKeysBlob,
+ initialNotificationsEncryptedMessage,
+ } = request;
if (calendarQuery) {
promises.push(verifyCalendarQueryThreadIDs(calendarQuery));
}
@@ -130,6 +135,16 @@
await setNewSession(viewer, calendarQuery, 0);
}
+ const olmSessionPromise = (async () => {
+ if (userViewerData.cookieID && initialNotificationsEncryptedMessage) {
+ await createOlmSession(
+ initialNotificationsEncryptedMessage,
+ 'notifications',
+ userViewerData.cookieID,
+ );
+ }
+ })();
+
await Promise.all([
updateThread(
createScriptViewer(ashoat.id),
@@ -140,6 +155,7 @@
{ forceAddMembers: true, silenceMessages: true, ignorePermissions: true },
),
viewerAcknowledgmentUpdater(viewer, policyTypes.tosAndPrivacyPolicy),
+ olmSessionPromise,
]);
const [privateThreadResult, ashoatThreadResult] = await Promise.all([
diff --git a/keyserver/src/responders/user-responders.js b/keyserver/src/responders/user-responders.js
--- a/keyserver/src/responders/user-responders.js
+++ b/keyserver/src/responders/user-responders.js
@@ -280,6 +280,7 @@
// old clients, but we no longer do anything with it.
primaryIdentityPublicKey: t.maybe(tRegex(primaryIdentityPublicKeyRegex)),
signedIdentityKeysBlob: t.maybe(signedIdentityKeysBlobValidator),
+ initialNotificationsEncryptedMessage: t.maybe(t.String),
});
export const registerResponseValidator: TInterface<RegisterResponse> =
diff --git a/lib/types/account-types.js b/lib/types/account-types.js
--- a/lib/types/account-types.js
+++ b/lib/types/account-types.js
@@ -58,6 +58,7 @@
+platformDetails: PlatformDetails,
+primaryIdentityPublicKey?: empty,
+signedIdentityKeysBlob?: SignedIdentityKeysBlob,
+ +initialNotificationsEncryptedMessage?: string,
};
export type RegisterResponse = {
diff --git a/native/account/register-panel.react.js b/native/account/register-panel.react.js
--- a/native/account/register-panel.react.js
+++ b/native/account/register-panel.react.js
@@ -37,6 +37,7 @@
import { useSelector } from '../redux/redux-utils.js';
import { nativeLogInExtraInfoSelector } from '../selectors/account-selectors.js';
import type { KeyPressEvent } from '../types/react-native.js';
+import { useInitialNotificationsEncryptedMessage } from '../utils/crypto-utils.js';
import { type StateContainer } from '../utils/state-container.js';
export type RegisterState = {
@@ -55,6 +56,7 @@
+logInExtraInfo: () => Promise<LogInExtraInfo>,
+dispatchActionPromise: DispatchActionPromise,
+register: (registerInfo: RegisterInfo) => Promise<RegisterResult>,
+ +getInitialNotificationsEncryptedMessage: () => Promise<string>,
};
type State = {
+confirmPasswordFocused: boolean,
@@ -289,9 +291,14 @@
} else {
Keyboard.dismiss();
const extraInfo = await this.props.logInExtraInfo();
+ const initialNotificationsEncryptedMessage =
+ await this.props.getInitialNotificationsEncryptedMessage();
this.props.dispatchActionPromise(
registerActionTypes,
- this.registerAction(extraInfo),
+ this.registerAction({
+ ...extraInfo,
+ initialNotificationsEncryptedMessage,
+ }),
undefined,
({ calendarQuery: extraInfo.calendarQuery }: LogInStartingPayload),
);
@@ -457,6 +464,8 @@
const dispatchActionPromise = useDispatchActionPromise();
const callRegister = useServerCall(register);
+ const getInitialNotificationsEncryptedMessage =
+ useInitialNotificationsEncryptedMessage();
return (
<RegisterPanel
@@ -465,6 +474,9 @@
logInExtraInfo={logInExtraInfo}
dispatchActionPromise={dispatchActionPromise}
register={callRegister}
+ getInitialNotificationsEncryptedMessage={
+ getInitialNotificationsEncryptedMessage
+ }
/>
);
});

File Metadata

Mime Type
text/plain
Expires
Fri, Jan 2, 3:06 AM (6 m, 17 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5876788
Default Alt Text
D7657.1767323215.diff (4 KB)

Event Timeline