diff --git a/status/statusgo_backend_new/accounts.nim b/status/statusgo_backend_new/accounts.nim index 1348929..befe13e 100644 --- a/status/statusgo_backend_new/accounts.nim +++ b/status/statusgo_backend_new/accounts.nim @@ -117,4 +117,25 @@ proc saveAccountAndLogin*(hashedPassword: string, account, subaccounts, settings except RpcException as e: error "error doing rpc request", methodName = "saveAccountAndLogin", exception=e.msg + raise newException(RpcException, e.msg) + +proc login*(name, keyUid, hashedPassword, identicon, thumbnail, large: string): + RpcResponse[JsonNode] + {.raises: [Exception].} = + try: + var payload = %* { + "name": name, + "key-uid": keyUid, + "identityImage": newJNull(), + "identicon": identicon + } + + if(thumbnail.len>0 and large.len > 0): + payload["identityImage"] = %* {"thumbnail": thumbnail, "large": large} + + let response = status_go.login($payload, hashedPassword) + result.result = Json.decode(response, JsonNode) + + except RpcException as e: + error "error doing rpc request", methodName = "login", exception=e.msg raise newException(RpcException, e.msg) \ No newline at end of file