mirror of
https://github.com/status-im/status-lib.git
synced 2025-01-23 18:58:56 +00:00
login method added
This commit is contained in:
parent
77905a3182
commit
47553f4fc8
@ -117,4 +117,25 @@ proc saveAccountAndLogin*(hashedPassword: string, account, subaccounts, settings
|
|||||||
|
|
||||||
except RpcException as e:
|
except RpcException as e:
|
||||||
error "error doing rpc request", methodName = "saveAccountAndLogin", exception=e.msg
|
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)
|
raise newException(RpcException, e.msg)
|
Loading…
x
Reference in New Issue
Block a user