Page MenuHomePhabricator

D6953.diff
No OneTemporary

D6953.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
@@ -118,13 +118,12 @@
VALUES ${[newUserRow]}
`;
- const [userViewerData, rustAPI] = await Promise.all([
+ const [userViewerData] = await Promise.all([
createNewUserCookie(id, {
platformDetails: request.platformDetails,
deviceToken,
signedIdentityKeysBlob,
}),
- getRustAPI(),
deleteCookie(viewer.cookieID),
dbQuery(newUserQuery),
]);
@@ -203,13 +202,16 @@
);
handleAsyncPromise(
- rustAPI.registerUser(
- id,
- identityKeys.primaryIdentityPublicKeys.ed25519,
- request.username,
- request.password,
- signedIdentityKeysBlob,
- ),
+ (async () => {
+ const rustAPI = await getRustAPI();
+ await rustAPI.registerUser(
+ id,
+ identityKeys.primaryIdentityPublicKeys.ed25519,
+ request.username,
+ request.password,
+ signedIdentityKeysBlob,
+ );
+ })(),
);
}
diff --git a/keyserver/src/deleters/account-deleters.js b/keyserver/src/deleters/account-deleters.js
--- a/keyserver/src/deleters/account-deleters.js
+++ b/keyserver/src/deleters/account-deleters.js
@@ -49,7 +49,6 @@
const deletedUserID = viewer.userID;
await rescindPushNotifs(SQL`n.user = ${deletedUserID}`, SQL`NULL`);
- const rustAPIPromise = getRustAPI();
const knownUserInfos = await fetchKnownUserInfos(viewer);
const usersToUpdate = values(knownUserInfos).filter(
userID => userID !== deletedUserID,
@@ -97,9 +96,13 @@
deviceToken: viewer.deviceToken,
});
}
- promises.rustAPI = rustAPIPromise;
- const { anonymousViewerData, rustAPI } = await promiseAll(promises);
- handleAsyncPromise(rustAPI.deleteUser(deletedUserID));
+ const { anonymousViewerData } = await promiseAll(promises);
+ handleAsyncPromise(
+ (async () => {
+ const rustAPI = await getRustAPI();
+ await rustAPI.deleteUser(deletedUserID);
+ })(),
+ );
if (anonymousViewerData) {
viewer.setNewCookie(anonymousViewerData);
}
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
@@ -405,10 +405,8 @@
WHERE LCASE(username) = LCASE(${username})
`;
promises.userQuery = dbQuery(userQuery);
- promises.rustAPI = getRustAPI();
const {
userQuery: [userResult],
- rustAPI,
} = await promiseAll(promises);
if (userResult.length === 0) {
@@ -428,13 +426,17 @@
const id = userRow.id.toString();
if (identityKeys && signedIdentityKeysBlob) {
+ const constIdentityKeys = identityKeys;
handleAsyncPromise(
- rustAPI.loginUserPake(
- id,
- identityKeys.primaryIdentityPublicKeys.ed25519,
- request.password,
- signedIdentityKeysBlob,
- ),
+ (async () => {
+ const rustAPI = await getRustAPI();
+ await rustAPI.loginUserPake(
+ id,
+ constIdentityKeys.primaryIdentityPublicKeys.ed25519,
+ request.password,
+ signedIdentityKeysBlob,
+ );
+ })(),
);
}
@@ -578,7 +580,7 @@
handleAsyncPromise(
(async () => {
const rustAPI = await getRustAPI();
- rustAPI.loginUserWallet(
+ await rustAPI.loginUserWallet(
userIDCopy,
identityKeysCopy.primaryIdentityPublicKeys.ed25519,
siweMessage.toMessage(),

File Metadata

Mime Type
text/plain
Expires
Sun, Dec 22, 8:19 PM (15 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2692344
Default Alt Text
D6953.diff (3 KB)

Event Timeline