Changeset View
Changeset View
Standalone View
Standalone View
keyserver/src/responders/user-responders.js
Show First 20 Lines • Show All 424 Lines • ▼ Show 20 Lines | ): Promise<LogInResponse> { | ||||
const id = userRow.id.toString(); | const id = userRow.id.toString(); | ||||
if (identityKeys && signedIdentityKeysBlob) { | if (identityKeys && signedIdentityKeysBlob) { | ||||
const constIdentityKeys = identityKeys; | const constIdentityKeys = identityKeys; | ||||
handleAsyncPromise( | handleAsyncPromise( | ||||
(async () => { | (async () => { | ||||
const rustAPI = await getRustAPI(); | const rustAPI = await getRustAPI(); | ||||
try { | |||||
await rustAPI.loginUserPake( | await rustAPI.loginUserPake( | ||||
id, | id, | ||||
constIdentityKeys.primaryIdentityPublicKeys.ed25519, | constIdentityKeys.primaryIdentityPublicKeys.ed25519, | ||||
request.password, | request.password, | ||||
signedIdentityKeysBlob, | signedIdentityKeysBlob, | ||||
); | ); | ||||
} catch (e) { | |||||
if (e.code === 'InvalidArg' && e.message === 'user not found') { | |||||
await rustAPI.registerUser( | |||||
id, | |||||
constIdentityKeys.primaryIdentityPublicKeys.ed25519, | |||||
username, | |||||
request.password, | |||||
signedIdentityKeysBlob, | |||||
); | |||||
} | |||||
} | |||||
})(), | })(), | ||||
); | ); | ||||
} | } | ||||
return await processSuccessfulLogin({ | return await processSuccessfulLogin({ | ||||
viewer, | viewer, | ||||
input, | input, | ||||
userID: id, | userID: id, | ||||
▲ Show 20 Lines • Show All 228 Lines • Show Last 20 Lines |