From 71454e0e3d27e81e8fc2a136a83682b55196eb5e Mon Sep 17 00:00:00 2001 From: Richard Ramos Date: Fri, 12 Aug 2022 09:11:36 -0400 Subject: [PATCH] feat: use a higher kdf number for DB encryption --- src/app_service/service/accounts/dto/accounts.nim | 3 +++ src/app_service/service/accounts/service.nim | 5 +++-- src/backend/accounts.nim | 3 ++- vendor/status-go | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/app_service/service/accounts/dto/accounts.nim b/src/app_service/service/accounts/dto/accounts.nim index 8347cecd30..c99abd8c85 100644 --- a/src/app_service/service/accounts/dto/accounts.nim +++ b/src/app_service/service/accounts/dto/accounts.nim @@ -23,6 +23,7 @@ type AccountDto* = object images*: seq[Image] colorHash*: ColorHashDto colorId*: int + kdfIterations*: int proc isValid*(self: AccountDto): bool = result = self.name.len > 0 and self.keyUid.len > 0 @@ -44,6 +45,8 @@ proc toAccountDto*(jsonObj: JsonNode): AccountDto = discard jsonObj.getProp("keycard-pairing", result.keycardPairing) discard jsonObj.getProp("key-uid", result.keyUid) discard jsonObj.getProp("colorId", result.colorId) + discard jsonObj.getProp("kdfIterations", result.kdfIterations) + if jsonObj.hasKey("colorHash"): result.colorHash = toColorHashDto(jsonObj["colorHash"]) diff --git a/src/app_service/service/accounts/service.nim b/src/app_service/service/accounts/service.nim index 84625f8fbd..d04e57d7f3 100644 --- a/src/app_service/service/accounts/service.nim +++ b/src/app_service/service/accounts/service.nim @@ -176,7 +176,8 @@ proc prepareAccountJsonObject(self: Service, account: GeneratedAccountDto, displ "name": if displayName == "": account.alias else: displayName, "address": account.address, "key-uid": account.keyUid, - "keycard-pairing": nil + "keycard-pairing": nil, + "kdfIterations": KDF_ITERATIONS, } proc getAccountDataForAccountId(self: Service, accountId: string, displayName: string): JsonNode = @@ -530,7 +531,7 @@ proc login*(self: Service, account: AccountDto, password: string): string = "UDPPort": wV2Port, }) - let response = status_account.login(account.name, account.keyUid, hashedPassword, thumbnailImage, + let response = status_account.login(account.name, account.keyUid, account.kdfIterations, hashedPassword, thumbnailImage, largeImage, $nodeCfg) var error = "response doesn't contain \"error\"" if(response.result.contains("error")): diff --git a/src/backend/accounts.nim b/src/backend/accounts.nim index 85f64ea286..6456fa05a9 100644 --- a/src/backend/accounts.nim +++ b/src/backend/accounts.nim @@ -251,7 +251,7 @@ proc convertToKeycardAccount*(keyStoreDir: string, account: JsonNode, settings: error "error doing rpc request", methodName = "convertToKeycardAccount", exception=e.msg raise newException(RpcException, e.msg) -proc login*(name, keyUid, hashedPassword, thumbnail, large: string, nodeCfgObj: string): +proc login*(name, keyUid: string, kdfIterations: int, hashedPassword, thumbnail, large: string, nodeCfgObj: string): RpcResponse[JsonNode] {.raises: [Exception].} = try: @@ -259,6 +259,7 @@ proc login*(name, keyUid, hashedPassword, thumbnail, large: string, nodeCfgObj: "name": name, "key-uid": keyUid, "identityImage": newJNull(), + "kdfIterations": kdfIterations, } if(thumbnail.len>0 and large.len > 0): diff --git a/vendor/status-go b/vendor/status-go index d89c0c8d9e..1eb8a5cc2c 160000 --- a/vendor/status-go +++ b/vendor/status-go @@ -1 +1 @@ -Subproject commit d89c0c8d9e333dc9b0c4ea36fd9c49c09a9b7d19 +Subproject commit 1eb8a5cc2cd892fd6aaaac823752c71139b99c5e