From a117b325cf1bf3ba4765eeab50b9bcb34d3918de Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Wed, 24 Nov 2021 02:24:39 +0100 Subject: [PATCH] also check for presence of pub & priv key --- backend/src/graphql/resolver/UserResolver.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/backend/src/graphql/resolver/UserResolver.ts b/backend/src/graphql/resolver/UserResolver.ts index 3bb264cf6..a32dc6aed 100644 --- a/backend/src/graphql/resolver/UserResolver.ts +++ b/backend/src/graphql/resolver/UserResolver.ts @@ -168,6 +168,10 @@ export class UserResolver { // TODO we want to catch this on the frontend and ask the user to check his emails or resend code throw new Error('User has no password set yet') } + if (!loginUser.pubKey || !loginUser.privKey) { + // TODO we want to catch this on the frontend and ask the user to check his emails or resend code + throw new Error('User has no private or publicKey') + } const passwordHash = SecretKeyCryptographyCreateKey(email, password) // return short and long hash const loginUserPassword = BigInt(loginUser.password.toString()) if (loginUserPassword !== passwordHash[0].readBigUInt64LE()) {