Skip to content

Commit

Permalink
incorporate review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
linh2931 committed Sep 5, 2023
1 parent c0ce258 commit 814df97
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
8 changes: 4 additions & 4 deletions programs/leap-util/actions/bls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,20 @@ void bls_actions::setup(CLI::App& app) {
};

// main command
auto* sub = app.add_subcommand("bls", "bls utility");
auto* sub = app.add_subcommand("bls", "BLS utility");
sub->require_subcommand();

// Create subcommand
auto create = sub->add_subcommand("create", "Create various items");
auto create = sub->add_subcommand("create", "Create BLS items");
create->require_subcommand();

// sub-subcommand - key
auto* create_key = create->add_subcommand("key", "Create a new keypair and print the public and private keys")->callback([err_guard]() { err_guard(&bls_actions::create_key); });
auto* create_key = create->add_subcommand("key", "Create a new BLS keypair and print the public and private keys")->callback([err_guard]() { err_guard(&bls_actions::create_key); });
create_key->add_option("-f,--file", opt->key_file, "Name of file to write private/public key output to. (Must be set, unless \"--to-console\" is passed");
create_key->add_flag( "--to-console", opt->print_console, "Print private/public keys to console.");

// sub-subcommand - pop (proof of possession)
auto* create_pop = create->add_subcommand("pop", "Create proof of possession for the corresponding public key of a given private key")->callback([err_guard]() { err_guard(&bls_actions::create_pop); });
auto* create_pop = create->add_subcommand("pop", "Create proof of possession of the corresponding private key for a given public key")->callback([err_guard]() { err_guard(&bls_actions::create_pop); });
create_pop->add_option("-f,--file", opt->key_file, "Name of file storing the private key. (one and only one of \"-f,--file\" and \"--private-key\" must be set)");
create_pop->add_option("--private-key", opt->private_key_str, "The private key. (one and only one of \"-f,--file\" and \"--private-key\" must be set)");
}
Expand Down
1 change: 0 additions & 1 deletion programs/leap-util/actions/bls.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ struct bls_options {

class bls_actions : public sub_command<bls_options> {
public:
bls_actions() : sub_command() {}
void setup(CLI::App& app);

protected:
Expand Down
8 changes: 4 additions & 4 deletions tests/leap_util_bls_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ def test_create_pop_from_command_line():

# save results
private_key = results["Private key"]
publick_key = results["Public key"]
public_key = results["Public key"]
pop = results["Proof of Possession"]

# use the private key to create POP
rslts = Utils.processLeapUtilCmd("bls create pop --private-key {}".format(private_key), "create pop from command line", silentErrors=False)
results = get_results(rslts)

# check pop and public key are the same as those generated before
assert results["Public key"] == publick_key
assert results["Public key"] == public_key
assert results["Proof of Possession"] == pop

def test_create_pop_from_file():
Expand All @@ -57,7 +57,7 @@ def test_create_pop_from_file():

# save results
private_key = results["Private key"]
publick_key = results["Public key"]
public_key = results["Public key"]
pop = results["Proof of Possession"]

# save private key to a file
Expand All @@ -71,7 +71,7 @@ def test_create_pop_from_file():
results = get_results(rslts)

# check pop and public key are the same as those generated before
assert results["Public key"] == publick_key
assert results["Public key"] == public_key
assert results["Proof of Possession"] == pop

def test_create_key_error_handling():
Expand Down

0 comments on commit 814df97

Please sign in to comment.