Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3398564
D7654.id25824.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D7654.id25824.diff
View Options
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
@@ -78,6 +78,7 @@
createAccount,
processSIWEAccountCreation,
} from '../creators/account-creator.js';
+import { createOlmSession } from '../creators/olm-session-creator.js';
import { dbQuery, SQL } from '../database/database.js';
import { deleteAccount } from '../deleters/account-deleters.js';
import { deleteCookie } from '../deleters/cookie-deleters.js';
@@ -252,6 +253,7 @@
+calendarQuery: ?CalendarQuery,
+socialProof?: ?SIWESocialProof,
+signedIdentityKeysBlob?: ?SignedIdentityKeysBlob,
+ +initialNotificationsEncryptedMessage?: string,
};
async function processSuccessfulLogin(
@@ -264,6 +266,7 @@
calendarQuery,
socialProof,
signedIdentityKeysBlob,
+ initialNotificationsEncryptedMessage,
} = params;
const request: LogInRequest = input;
@@ -282,6 +285,17 @@
deleteCookie(viewer.cookieID),
]);
viewer.setNewCookie(userViewerData);
+ if (
+ userViewerData.cookieID &&
+ initialNotificationsEncryptedMessage &&
+ signedIdentityKeysBlob
+ ) {
+ await createOlmSession(
+ initialNotificationsEncryptedMessage,
+ 'notifications',
+ userViewerData.cookieID,
+ );
+ }
if (
notAcknowledgedPolicies.length &&
@@ -361,6 +375,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),
});
async function logInResponder(
@@ -371,7 +386,8 @@
const request: LogInRequest = input;
let identityKeys: ?IdentityKeysBlob;
- const { signedIdentityKeysBlob } = request;
+ const { signedIdentityKeysBlob, initialNotificationsEncryptedMessage } =
+ request;
if (signedIdentityKeysBlob) {
identityKeys = JSON.parse(signedIdentityKeysBlob.payload);
@@ -435,6 +451,7 @@
userID: id,
calendarQuery,
signedIdentityKeysBlob,
+ initialNotificationsEncryptedMessage,
});
}
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
@@ -104,6 +104,7 @@
+calendarQuery: CalendarQuery,
+deviceTokenUpdateRequest?: ?DeviceTokenUpdateRequest,
+signedIdentityKeysBlob?: SignedIdentityKeysBlob,
+ +initialNotificationsEncryptedMessage?: string,
};
export type LogInInfo = {
@@ -123,6 +124,7 @@
+watchedIDs: $ReadOnlyArray<string>,
+source?: LogInActionSource,
+signedIdentityKeysBlob?: SignedIdentityKeysBlob,
+ +initialNotificationsEncryptedMessage?: string,
};
export type LogInResponse = {
diff --git a/native/account/log-in-panel.react.js b/native/account/log-in-panel.react.js
--- a/native/account/log-in-panel.react.js
+++ b/native/account/log-in-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 LogInState = {
@@ -54,6 +55,9 @@
+logInExtraInfo: () => Promise<LogInExtraInfo>,
+dispatchActionPromise: DispatchActionPromise,
+logIn: (logInInfo: LogInInfo) => Promise<LogInResult>,
+ +initialNotificationsEncryptedMessage: (
+ oneTimeKeysCount: number,
+ ) => Promise<string>,
};
class LogInPanel extends React.PureComponent<Props> {
usernameInput: ?TextInput;
@@ -227,9 +231,12 @@
Keyboard.dismiss();
const extraInfo = await this.props.logInExtraInfo();
+ const initialNotificationsEncryptedMessage =
+ await this.props.initialNotificationsEncryptedMessage(1);
+ console.log(initialNotificationsEncryptedMessage);
this.props.dispatchActionPromise(
logInActionTypes,
- this.logInAction(extraInfo),
+ this.logInAction({ ...extraInfo, initialNotificationsEncryptedMessage }),
undefined,
({ calendarQuery: extraInfo.calendarQuery }: LogInStartingPayload),
);
@@ -364,6 +371,8 @@
const dispatchActionPromise = useDispatchActionPromise();
const callLogIn = useServerCall(logIn);
+ const callInitialNotificationsEncryptedMessage =
+ useInitialNotificationsEncryptedMessage();
return (
<LogInPanel
@@ -372,6 +381,9 @@
logInExtraInfo={logInExtraInfo}
dispatchActionPromise={dispatchActionPromise}
logIn={callLogIn}
+ initialNotificationsEncryptedMessage={
+ callInitialNotificationsEncryptedMessage
+ }
/>
);
});
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Dec 2, 11:28 PM (19 h, 38 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2609277
Default Alt Text
D7654.id25824.diff (4 KB)
Attached To
Mode
D7654: Establish olm sessions for notifs on both sides during log-in
Attached
Detach File
Event Timeline
Log In to Comment