Grinnode-live / 2020-grin-bug-bash-challenge

Finding bugs in Grin-Wallet & Grin-nodes for a bounty prior to Grin fork v5.
3 stars 1 forks source link

[GRIN-Wallet][Owner API] Testing change_password method #39

Closed stakervali closed 3 years ago

stakervali commented 3 years ago

Description Testing the change password method from the Owner API

Prerequisites

GRIN-Node
GRIN-Wallet

Test procedure

Calculate checksum of seed file, save the output. Change wallet password using owner_api::change_password method.

Expected result: Checksum of seed file before and after password change must be different. At the end wallet should be opened via new password.

Include the output of command

grin-wallet -V

and your environment

uname -a
mojitoo commented 3 years ago

Calculate checksum of my current seed

shasum -a 1 wallet.seed 
9addf26f82c0eb08e939b7fdae6cca4beaafc3d0  wallet.seed

Runs the wallet's local web API

grin-wallet owner_api
Password: 
20201220 07:55:46.473 WARN grin_wallet_controller::controller - Starting HTTP Foreign API on Owner server at 127.0.0.1:3420.
20201220 07:55:46.473 WARN grin_wallet_controller::controller - Starting HTTP Owner API server at 127.0.0.1:3420.
20201220 07:55:46.473 WARN grin_wallet_controller::controller - HTTP Owner listener started

HTTP Owner successfully started.

Change password

Before runnning the script, we need to make sure to edit the configuration.

change to your grin owner_api sercret file

api_sercet_file = '/Users/path/.grin/main/.owner_api_secret'

change to you wallet password

wallet_password = 'oldpassword'

call this following function at the end of wallet_v3.py

wallet.open_wallet(None, wallet_password) pp.pprint(wallet.change_password("oldpassword","newpassword","default")) pp.pprint(wallet.close_wallet())

True
True

Open wallet with new password

call this following function at the end of wallet_v3.py

wallet.open_wallet(None, wallet_password)

True

calculate new checksum

shasum -a 1 wallet.seed                      
908545f2ac593551545a3dcb9fa00e206b6b4071  wallet.seed
marekyggdrasil commented 3 years ago

@mojitoo as usual please include outputs of grin-wallet -V and uname -a, otherwise looks good! Thanks!

mojitoo commented 3 years ago

grin-wallet 4.0.0 Darwin MacBook-Pro-de-Workstation.local 19.5.0 Darwin Kernel Version 19.5.0: Tue May 26 20:41:44 PDT 2020; root:xnu-6153.121.2~2/RELEASE_X86_64 x86_64