Client: derive the public key from the secret key when adding to wallet
That way we do not need to require the public key be added before hand making the workflow nicer.
This commit is contained in:
parent
cca69e409d
commit
8ba1130ee3
@ -127,9 +127,11 @@ let commands () =
|
|||||||
(fun name sk cctxt ->
|
(fun name sk cctxt ->
|
||||||
Public_key.find_opt cctxt name >>=? function
|
Public_key.find_opt cctxt name >>=? function
|
||||||
| None ->
|
| None ->
|
||||||
failwith
|
let pk = Sodium.Sign.secret_key_to_public_key sk in
|
||||||
"no public key named '%s', add it before adding the secret key"
|
Public_key_hash.add cctxt
|
||||||
name
|
name (Ed25519.Public_key.hash pk) >>=? fun () ->
|
||||||
|
Public_key.add cctxt name pk >>=? fun () ->
|
||||||
|
Secret_key.add cctxt name sk
|
||||||
| Some pk ->
|
| Some pk ->
|
||||||
fail_unless
|
fail_unless
|
||||||
(check_keys_consistency pk sk || cctxt.config.force)
|
(check_keys_consistency pk sk || cctxt.config.force)
|
||||||
|
Loading…
Reference in New Issue
Block a user