Page MenuHomePhabricator

D6941.id23424.diff
No OneTemporary

D6941.id23424.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
@@ -1,6 +1,7 @@
// @flow
import invariant from 'invariant';
+import { getRustAPI } from 'rust-node-addon';
import bcrypt from 'twin-bcrypt';
import ashoat from 'lib/facts/ashoat.js';
@@ -16,7 +17,10 @@
RegisterResponse,
RegisterRequest,
} from 'lib/types/account-types.js';
-import type { SignedIdentityKeysBlob } from 'lib/types/crypto-types.js';
+import type {
+ SignedIdentityKeysBlob,
+ IdentityKeysBlob,
+} from 'lib/types/crypto-types.js';
import type {
PlatformDetails,
DeviceTokenUpdateRequest,
@@ -45,6 +49,7 @@
fetchKnownUserInfos,
} from '../fetchers/user-fetchers.js';
import { verifyCalendarQueryThreadIDs } from '../responders/entry-responders.js';
+import { handleAsyncPromise } from '../responders/handlers.js';
import { createNewUserCookie, setNewSession } from '../session/cookies.js';
import { createScriptViewer } from '../session/scripts.js';
import type { Viewer } from '../session/viewer.js';
@@ -81,7 +86,7 @@
WHERE LCASE(username) = LCASE(${request.username})
`;
const promises = [dbQuery(usernameQuery)];
- const { calendarQuery } = request;
+ const { calendarQuery, signedIdentityKeysBlob } = request;
if (calendarQuery) {
promises.push(verifyCalendarQueryThreadIDs(calendarQuery));
}
@@ -113,12 +118,13 @@
VALUES ${[newUserRow]}
`;
- const [userViewerData] = await Promise.all([
+ const [userViewerData, rustAPI] = await Promise.all([
createNewUserCookie(id, {
platformDetails: request.platformDetails,
deviceToken,
- signedIdentityKeysBlob: request.signedIdentityKeysBlob,
+ signedIdentityKeysBlob,
}),
+ getRustAPI(),
deleteCookie(viewer.cookieID),
dbQuery(newUserQuery),
]);
@@ -191,6 +197,22 @@
...messageInfos,
];
+ if (signedIdentityKeysBlob) {
+ const identityKeys: IdentityKeysBlob = JSON.parse(
+ signedIdentityKeysBlob.payload,
+ );
+
+ handleAsyncPromise(
+ rustAPI.registerUser(
+ id,
+ identityKeys.primaryIdentityPublicKeys.ed25519,
+ request.username,
+ request.password,
+ signedIdentityKeysBlob,
+ ),
+ );
+ }
+
return {
id,
rawMessageInfos,
diff --git a/lib/types/rust-binding-types.js b/lib/types/rust-binding-types.js
--- a/lib/types/rust-binding-types.js
+++ b/lib/types/rust-binding-types.js
@@ -18,10 +18,10 @@
type RustNativeBindingAPI = {
+registerUser: (
userId: string,
- deviceId: string,
+ signingPublicKey: string,
username: string,
password: string,
- userPublicKey: string,
+ sessionInitializationInfo: SignedIdentityKeysBlob,
) => Promise<string>,
+loginUserPake: (
userId: string,

File Metadata

Mime Type
text/plain
Expires
Mon, Dec 23, 1:04 PM (19 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2693978
Default Alt Text
D6941.id23424.diff (2 KB)

Event Timeline