feat: use a higher kdf number for DB encryption

This commit is contained in:
Richard Ramos 2022-08-12 09:11:36 -04:00
parent b43dfaa59e
commit 71454e0e3d
4 changed files with 9 additions and 4 deletions

View File

@ -23,6 +23,7 @@ type AccountDto* = object
images*: seq[Image] images*: seq[Image]
colorHash*: ColorHashDto colorHash*: ColorHashDto
colorId*: int colorId*: int
kdfIterations*: int
proc isValid*(self: AccountDto): bool = proc isValid*(self: AccountDto): bool =
result = self.name.len > 0 and self.keyUid.len > 0 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("keycard-pairing", result.keycardPairing)
discard jsonObj.getProp("key-uid", result.keyUid) discard jsonObj.getProp("key-uid", result.keyUid)
discard jsonObj.getProp("colorId", result.colorId) discard jsonObj.getProp("colorId", result.colorId)
discard jsonObj.getProp("kdfIterations", result.kdfIterations)
if jsonObj.hasKey("colorHash"): if jsonObj.hasKey("colorHash"):
result.colorHash = toColorHashDto(jsonObj["colorHash"]) result.colorHash = toColorHashDto(jsonObj["colorHash"])

View File

@ -176,7 +176,8 @@ proc prepareAccountJsonObject(self: Service, account: GeneratedAccountDto, displ
"name": if displayName == "": account.alias else: displayName, "name": if displayName == "": account.alias else: displayName,
"address": account.address, "address": account.address,
"key-uid": account.keyUid, "key-uid": account.keyUid,
"keycard-pairing": nil "keycard-pairing": nil,
"kdfIterations": KDF_ITERATIONS,
} }
proc getAccountDataForAccountId(self: Service, accountId: string, displayName: string): JsonNode = proc getAccountDataForAccountId(self: Service, accountId: string, displayName: string): JsonNode =
@ -530,7 +531,7 @@ proc login*(self: Service, account: AccountDto, password: string): string =
"UDPPort": wV2Port, "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) largeImage, $nodeCfg)
var error = "response doesn't contain \"error\"" var error = "response doesn't contain \"error\""
if(response.result.contains("error")): if(response.result.contains("error")):

View File

@ -251,7 +251,7 @@ proc convertToKeycardAccount*(keyStoreDir: string, account: JsonNode, settings:
error "error doing rpc request", methodName = "convertToKeycardAccount", exception=e.msg error "error doing rpc request", methodName = "convertToKeycardAccount", exception=e.msg
raise newException(RpcException, 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] RpcResponse[JsonNode]
{.raises: [Exception].} = {.raises: [Exception].} =
try: try:
@ -259,6 +259,7 @@ proc login*(name, keyUid, hashedPassword, thumbnail, large: string, nodeCfgObj:
"name": name, "name": name,
"key-uid": keyUid, "key-uid": keyUid,
"identityImage": newJNull(), "identityImage": newJNull(),
"kdfIterations": kdfIterations,
} }
if(thumbnail.len>0 and large.len > 0): if(thumbnail.len>0 and large.len > 0):

2
vendor/status-go vendored

@ -1 +1 @@
Subproject commit d89c0c8d9e333dc9b0c4ea36fd9c49c09a9b7d19 Subproject commit 1eb8a5cc2cd892fd6aaaac823752c71139b99c5e