status-desktop/src/backend/privacy.nim
Noelia 8f996992b2 feat(onboarding / privacy): Integrate password validation (zxcvbn lib) in new password screens
Use new `PrivacyStore` method getPasswordStrengthScore and link it to the new password strength bar value.

Used backend/general to call to `status-go` method and services/general to define the common `GetPasswordStrengthScore` service.

Added onboarding chain to get password strength score information from `OnboardingStore` to `status-go` call.

Closes #5096
2022-03-24 18:17:04 +01:00

25 lines
870 B
Nim

import json, json_serialization, chronicles
import core, utils
import response_type
import status_go
export response_type
logScope:
topics = "rpc-privacy"
proc changeDatabasePassword*(keyUID: string, password: string, newPassword: string): RpcResponse[JsonNode]
{.raises: [Exception].} =
try:
let hashedPassword = hashPassword(password)
let hashedNewPassword = hashPassword(newPassword)
let response = status_go.changeDatabasePassword(keyUID, hashedPassword, hashedNewPassword)
result.result = Json.decode(response, JsonNode)
except RpcException as e:
error "error", methodName = "changeDatabasePassword", exception=e.msg
raise newException(RpcException, e.msg)
proc getLinkPreviewWhitelist*(): RpcResponse[JsonNode] {.raises: [Exception].} =
let payload = %* []
result = callPrivateRPC("getLinkPreviewWhitelist".prefix, payload)