Page MenuHomePhabricator

D6883.diff
No OneTemporary

D6883.diff

diff --git a/web/account/log-in-form.react.js b/web/account/log-in-form.react.js
--- a/web/account/log-in-form.react.js
+++ b/web/account/log-in-form.react.js
@@ -4,6 +4,7 @@
import { useConnectModal } from '@rainbow-me/rainbowkit';
import * as React from 'react';
import { useDispatch } from 'react-redux';
+import uuid from 'uuid';
import { useSigner } from 'wagmi';
import css from './log-in-form.css';
@@ -14,6 +15,8 @@
import {
setPrimaryIdentityKeys,
setNotificationIdentityKeys,
+ setPickledPrimaryAccount,
+ setPickledNotificationAccount,
} from '../redux/crypto-store-reducer.js';
import { useSelector } from '../redux/redux-utils.js';
@@ -51,6 +54,19 @@
payload: { ed25519: identityED25519, curve25519: identityCurve25519 },
});
+ const identityAccountPicklingKey = uuid.v4();
+ const pickledIdentityAccount = identityAccount.pickle(
+ identityAccountPicklingKey,
+ );
+
+ dispatch({
+ type: setPickledPrimaryAccount,
+ payload: {
+ picklingKey: identityAccountPicklingKey,
+ pickledAccount: pickledIdentityAccount,
+ },
+ });
+
const notificationAccount = new olm.Account();
notificationAccount.create();
const {
@@ -65,6 +81,19 @@
curve25519: notificationCurve25519,
},
});
+
+ const notificationAccountPicklingKey = uuid.v4();
+ const pickledNotificationAccount = notificationAccount.pickle(
+ notificationAccountPicklingKey,
+ );
+
+ dispatch({
+ type: setPickledNotificationAccount,
+ payload: {
+ picklingKey: notificationAccountPicklingKey,
+ pickledAccount: pickledNotificationAccount,
+ },
+ });
})();
}, [dispatch, notificationIdentityPublicKeys, primaryIdentityPublicKeys]);
diff --git a/web/package.json b/web/package.json
--- a/web/package.json
+++ b/web/package.json
@@ -79,6 +79,7 @@
"simple-markdown": "^0.7.2",
"siwe": "^1.1.6",
"tinycolor2": "^1.4.1",
+ "uuid": "^3.3.3",
"visibilityjs": "^2.0.2",
"wagmi": "^0.8.10"
},
diff --git a/web/redux/crypto-store-reducer.js b/web/redux/crypto-store-reducer.js
--- a/web/redux/crypto-store-reducer.js
+++ b/web/redux/crypto-store-reducer.js
@@ -11,6 +11,8 @@
const setPrimaryIdentityKeys = 'SET_PRIMARY_IDENTITY_KEYS';
const setNotificationIdentityKeys = 'SET_NOTIFICATION_IDENTITY_KEYS';
+const setPickledPrimaryAccount = 'SET_PICKLED_PRIMARY_ACCOUNT';
+const setPickledNotificationAccount = 'SET_PICKLED_NOTIFICATION_ACCOUNT';
function reduceCryptoStore(state: CryptoStore, action: Action): CryptoStore {
if (action.type === setPrimaryIdentityKeys) {
@@ -23,6 +25,16 @@
...state,
notificationIdentityKeys: action.payload,
};
+ } else if (action.type === setPickledPrimaryAccount) {
+ return {
+ ...state,
+ primaryAccount: action.payload,
+ };
+ } else if (action.type === setPickledNotificationAccount) {
+ return {
+ ...state,
+ notificationAccount: action.payload,
+ };
} else if (
action.type === logOutActionTypes.success ||
action.type === deleteAccountActionTypes.success ||
@@ -42,5 +54,7 @@
export {
setPrimaryIdentityKeys,
setNotificationIdentityKeys,
+ setPickledPrimaryAccount,
+ setPickledNotificationAccount,
reduceCryptoStore,
};
diff --git a/web/redux/redux-setup.js b/web/redux/redux-setup.js
--- a/web/redux/redux-setup.js
+++ b/web/redux/redux-setup.js
@@ -13,7 +13,11 @@
import { isLoggedIn } from 'lib/selectors/user-selectors.js';
import { invalidSessionDowngrade } from 'lib/shared/account-utils.js';
import type { Shape } from 'lib/types/core.js';
-import type { CryptoStore, OLMIdentityKeys } from 'lib/types/crypto-types.js';
+import type {
+ CryptoStore,
+ OLMIdentityKeys,
+ PickledOLMAccount,
+} from 'lib/types/crypto-types.js';
import type { DraftStore } from 'lib/types/draft-types.js';
import type { EnabledApps } from 'lib/types/enabled-apps.js';
import type { EntryStore } from 'lib/types/entry-types.js';
@@ -44,6 +48,8 @@
reduceCryptoStore,
setPrimaryIdentityKeys,
setNotificationIdentityKeys,
+ setPickledNotificationAccount,
+ setPickledPrimaryAccount,
} from './crypto-store-reducer.js';
import { reduceDeviceID } from './device-id-reducer.js';
import reduceNavInfo from './nav-reducer.js';
@@ -103,6 +109,8 @@
}
| { +type: 'SET_PRIMARY_IDENTITY_KEYS', payload: ?OLMIdentityKeys }
| { +type: 'SET_NOTIFICATION_IDENTITY_KEYS', payload: ?OLMIdentityKeys }
+ | { +type: 'SET_PICKLED_PRIMARY_ACCOUNT', payload: ?PickledOLMAccount }
+ | { +type: 'SET_PICKLED_NOTIFICATION_ACCOUNT', payload: ?PickledOLMAccount }
| {
+type: 'UPDATE_CALENDAR_COMMUNITY_FILTER',
+payload: string,
@@ -188,7 +196,9 @@
action.type !== updateNavInfoActionType &&
action.type !== setDeviceIDActionType &&
action.type !== setPrimaryIdentityKeys &&
- action.type !== setNotificationIdentityKeys
+ action.type !== setNotificationIdentityKeys &&
+ action.type !== setPickledPrimaryAccount &&
+ action.type !== setPickledNotificationAccount
) {
state = baseReducer(state, action).state;
}

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 22, 7:41 PM (17 h, 22 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2564398
Default Alt Text
D6883.diff (5 KB)

Event Timeline