Skip to content

Commit

Permalink
add cli command: account sign-data
Browse files Browse the repository at this point in the history
Allow the signature of arbitrary data

references: #261
  • Loading branch information
noandrea committed Jan 30, 2020
1 parent 154cde7 commit 2a9c21c
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions aeternity/__main__.py
Expand Up @@ -414,6 +414,26 @@ def account_sign(keystore_name, password, network_id, unsigned_transaction, json
except Exception as e:
_print_error(e, exit_code=1)


@account.command('sign-data', help="Sign arbitrary data")
@click.argument('keystore_name', required=True)
@click.argument('data', required=True)
@global_options
@account_options
def account_sign_data(keystore_name, password, data, json_):
try:
set_global_options(json_)
account, _ = _account(keystore_name, password=password)
# force offline mode for the node_client
signature = encode(SIGNATURE, account.sign(data.encode('utf-8')))
# _print_object(txu, title='unsigned transaction')
_print_object({
"account": account.get_address(),
"signature": signature
}, title="data signature")
except Exception as e:
_print_error(e, exit_code=1)

# _________ ____ ____
# | _ _ ||_ _||_ _|
# |_/ | | \_| \ \ / /
Expand Down

0 comments on commit 2a9c21c

Please sign in to comment.