[wip] generating keypair with ec_utils copied from zx's github

This commit is contained in:
2022-12-20 20:58:21 -07:00
parent 8cc46b6ac9
commit cbe487618c
8 changed files with 657 additions and 10 deletions
+14 -10
View File
@@ -17,20 +17,17 @@ start(ArgV) ->
%%
%% WHEN back: get decompose to work
go(["help"]) ->
help();
go(["--help"]) ->
help();
go(["generate", "keypair"]) ->
error(nyi);
go(["decompose", TxStr]) ->
decompose(TxStr);
go(_) ->
error(invalid_subcommand).
go(["help"]) -> help();
go(["--help"]) -> help();
go(["decompose", TxStr]) -> decompose(TxStr);
go(["generate", "keypair"]) -> generate_keypair();
go(X) -> error({invalid_subcommand, X}).
help() ->
io:format("you can't help people who won't help themselves~n", []).
decompose(TxStr) ->
case vd:decompose(TxStr) of
{ok, X} ->
@@ -38,3 +35,10 @@ decompose(TxStr) ->
{error, Error} ->
io:format("ERROR: ~tp~n", [Error])
end.
generate_keypair() ->
#{public := PublicKey,
secret := SecretKey} = ecu_eddsa:sign_keypair(),
io:format("Public Key: ~w~n", [PublicKey]),
io:format("Secret Key: ~w~n", [SecretKey]).