Sale Djenic 2be8bb55ee refactor: privacy methods added
- methods `changeDatabasePassword` and `getLinkPreviewWhitelist` added
to `privacy.nim`
- `hashPassword` moved to `utils.nim` since it's used from multiple paces
- `getEthAccounts` added to `eth.nim`
- `verifyAccountPassword` method updated so it returns `RpcResponse` now
2022-02-01 11:12:54 +01:00

25 lines
871 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)