add aes
This commit is contained in:
parent
f71142b915
commit
ebdb5bd432
@ -117,7 +117,8 @@ handle_request("POST", "/host/activate", _, #{<<"uuid">> := UUID, <<"auth">> :=
|
|||||||
{ok, 200, iot_util:json_error(400, <<"host not found">>)};
|
{ok, 200, iot_util:json_error(400, <<"host not found">>)};
|
||||||
{ok, Pid} when is_pid(Pid) ->
|
{ok, Pid} when is_pid(Pid) ->
|
||||||
lager:debug("[host_handler] activate host_id: ~p, start", [UUID]),
|
lager:debug("[host_handler] activate host_id: ~p, start", [UUID]),
|
||||||
BinReply = jiffy:encode(#{<<"auth">> => true}, [force_utf8]),
|
{ok, Aes} = iot_host:get_aes(Pid),
|
||||||
|
BinReply = jiffy:encode(#{<<"auth">> => true, <<"aes">> => Aes}, [force_utf8]),
|
||||||
|
|
||||||
case iot_host:publish_message(Pid, 8, BinReply) of
|
case iot_host:publish_message(Pid, 8, BinReply) of
|
||||||
{ok, Ref} ->
|
{ok, Ref} ->
|
||||||
|
|||||||
@ -62,7 +62,7 @@ handle(Pid, Packet) when is_pid(Pid) ->
|
|||||||
reload(Pid) when is_pid(Pid) ->
|
reload(Pid) when is_pid(Pid) ->
|
||||||
gen_statem:call(Pid, reload).
|
gen_statem:call(Pid, reload).
|
||||||
|
|
||||||
-spec get_aes(Pid :: pid()) -> Aes :: binary().
|
-spec get_aes(Pid :: pid()) -> {ok, Aes :: binary()}.
|
||||||
get_aes(Pid) when is_pid(Pid) ->
|
get_aes(Pid) when is_pid(Pid) ->
|
||||||
gen_statem:call(Pid, get_aes).
|
gen_statem:call(Pid, get_aes).
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user