This commit is contained in:
2026-05-21 20:05:00 +09:00
parent 77ff0ca084
commit 0a217049b1
3 changed files with 14 additions and 5 deletions
+8 -3
View File
@@ -183,6 +183,11 @@ sign_binary(Request) ->
gd_server:cast(?MODULE, {sign_binary, Request}).
-spec sign_binary(ID, Message) -> Result
when ID :: binary(),
Message :: binary(),
Result :: {ok, Sig :: binary()} | {error, bad_key}.
sign_binary(ID, Message) ->
gd_server:call(?MODULE, {sign_binary, ID, Message}).
@@ -461,6 +466,9 @@ handle_call(chain_id, _, State) ->
handle_call({sign_call, ChainID, PubKey, TX}, _, State) ->
Response = do_sign_call(State, ChainID, PubKey, TX),
{reply, Response, State};
handle_call({sign_binary, ID, Message}, _, State) ->
Response = do_sign_binary(ID, Message, State),
{reply, Response, State};
handle_call({open_wallet, Path, Phrase}, _, State) ->
{Response, NewState} = do_open_wallet(Path, Phrase, State),
{reply, Response, NewState};
@@ -522,9 +530,6 @@ handle_cast({sign_mess, Request}, State) ->
handle_cast({sign_binary, Request}, State) ->
ok = do_sign_binary(Request, State),
{noreply, State};
handle_cast({sign_binary, ID, Message}, State) ->
ok = do_sign_binary(ID, Message, State),
{noreply, State};
handle_cast({sign_tx, Request}, State) ->
ok = do_sign_tx(Request, State),
{noreply, State};
+4
View File
@@ -103,11 +103,14 @@ handshake(State = #s{socket = Socket}, Ref, From) ->
ok = active_once(State),
receive
{tcp, Socket, <<"GajuExpress 1 RECVR:", Challenge/binary>>} ->
tell(info, "Got challenge ~p", [Challenge]),
case is_sus(Challenge) of
false ->
tell(info, "Not sus"),
From ! {Ref, {ok, Challenge}},
authenticate(State);
true ->
tell(info, "Sus"),
From ! {Ref, {error, "Challenge was sus."}},
retire(State, normal)
end;
@@ -150,6 +153,7 @@ decode_challenge(TS, Rand) ->
authenticate(State = #s{socket = Socket}) ->
receive
{Ref, From, {response, Sig}} ->
tell(info, "Got sig: ~p", [Sig]),
ok = send(Socket, Sig),
await_auth(State, Ref, From);
nope ->
+2 -2
View File
@@ -348,7 +348,7 @@ do_check2(State = #s{recvr = PID}) ->
State#s{recvr = none}
end.
challenge(State = #s{recvr = PID, keys = KeyP}, Challenge) ->
challenge(State = #s{recvr = PID, keys = #w{wx = KeyP}}, Challenge) ->
case wxChoice:getStringSelection(KeyP) of
"" ->
ok = gd_n_recvr:stop(PID),
@@ -416,7 +416,7 @@ do_retire(PID, Info, State = #s{rider = PID}) ->
ok = tell(info, "Rider retired with: ~p", [Info]),
State#s{rider = none};
do_retire(PID, Info, State = #s{recvr = PID}) ->
ok = tell(info, "Rider retired with: ~p", [Info]),
ok = tell(info, "Recvr retired with: ~p", [Info]),
State#s{recvr = none};
do_retire(PID, Info, State) ->
ok = tell(info, "~p retired with: ~p", [PID, Info]),