mirror of
https://github.com/jwinterm/grin-wallet.git
synced 2026-12-01 19:33:56 +01:00
Ensure API create_wallet returns failure when provided with invalid mnemonic seeds (#319)
* Ensure returns failure with invalid mnemonic seeds, add tests * test fixes resulting from change
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"jsonrpc": "2.0",
|
||||
"method": "create_wallet",
|
||||
"params": {
|
||||
"name": null,
|
||||
"mnemonic": "this is not valid",
|
||||
"mnemonic_length": 32,
|
||||
"password": "passwoid"
|
||||
},
|
||||
"id": 1
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"jsonrpc": "2.0",
|
||||
"method": "create_wallet",
|
||||
"params": {
|
||||
"name": null,
|
||||
"mnemonic": "fat twenty mean degree forget shell check candy immense awful flame next during february bulb bike sun wink theory day kiwi embrace peace lunch",
|
||||
"mnemonic_length": 32,
|
||||
"password": "passwoid"
|
||||
},
|
||||
"id": 1
|
||||
}
|
||||
@@ -517,6 +517,20 @@ fn owner_v3_lifecycle() -> Result<(), grin_wallet_controller::Error> {
|
||||
println!("RES 25: {:?}", res);
|
||||
assert!(res.is_err());
|
||||
|
||||
// 26) Try to create a wallet with an invalid mnemonic
|
||||
let req = include_str!("data/v3_reqs/create_wallet_invalid_mn.req.json");
|
||||
let res =
|
||||
send_request_enc::<String>(1, 1, "http://127.0.0.1:43420/v3/owner", &req, &shared_key)?;
|
||||
println!("RES 26: {:?}", res);
|
||||
assert!(res.is_err());
|
||||
|
||||
// 27) Try to create a wallet with an valid mnemonic
|
||||
let req = include_str!("data/v3_reqs/create_wallet_valid_mn.req.json");
|
||||
let res =
|
||||
send_request_enc::<String>(1, 1, "http://127.0.0.1:43420/v3/owner", &req, &shared_key)?;
|
||||
println!("RES 27: {:?}", res);
|
||||
assert!(res.is_ok());
|
||||
|
||||
clean_output_dir(test_dir);
|
||||
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user