scratch
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env escript
|
||||
|
||||
%% authentication
|
||||
%% needs:
|
||||
%% - line parsing
|
||||
%% - keyboard input
|
||||
@@ -29,15 +30,21 @@ main_ii(PortNum) ->
|
||||
spawn_link(fun() -> kbd_loop(Self) end),
|
||||
j_loop(#js{tsock = TSock, nsock = NSock}).
|
||||
|
||||
|
||||
server_pubkey() ->
|
||||
<<116, 159, 91, 248, 138, 250, 73, 40, 231, 50, 81, 110, 137,
|
||||
163, 44, 76, 48, 130, 225, 95, 168, 121, 93, 44, 148, 42, 180,
|
||||
103, 11, 40, 168, 96>>.
|
||||
|
||||
noise_options() ->
|
||||
% totally safe crypto
|
||||
KP = enoise_keypair:new(dh25519),
|
||||
[{noise, "Noise_NN_25519_ChaChaPoly_BLAKE2b"},
|
||||
[{noise, "Noise_NK_25519_ChaChaPoly_BLAKE2b"},
|
||||
{rs, server_pubkey()},
|
||||
{e, KP}].
|
||||
|
||||
|
||||
j_loop(JS = #js{rcv = Rcv, tsock = TSock, nsock = NSock}) ->
|
||||
%ok = inet:setopts(TSock, [{active, once}]),
|
||||
receive
|
||||
{noise, NSock, Bytes} ->
|
||||
NewRcv = <<Rcv/binary, Bytes/binary>>,
|
||||
|
||||
Reference in New Issue
Block a user