Client: fix error when signing with encrypted keys
This commit is contained in:
parent
ce2d196bb5
commit
401eeceefb
@ -142,6 +142,7 @@ let find_signer_for_key cctxt ~scheme =
|
|||||||
| signer, false ->
|
| signer, false ->
|
||||||
let module Signer = (val signer : SIGNER) in
|
let module Signer = (val signer : SIGNER) in
|
||||||
Signer.init cctxt >>=? fun () ->
|
Signer.init cctxt >>=? fun () ->
|
||||||
|
Hashtbl.replace signers_table scheme (signer, true) ;
|
||||||
return signer
|
return signer
|
||||||
| signer, true -> return signer
|
| signer, true -> return signer
|
||||||
|
|
||||||
|
@ -74,19 +74,20 @@ module Encrypted_signer : SIGNER = struct
|
|||||||
if Secret_key_locator.scheme skloc <> scheme then
|
if Secret_key_locator.scheme skloc <> scheme then
|
||||||
Lwt.return a
|
Lwt.return a
|
||||||
else
|
else
|
||||||
match Base58.safe_decode (Secret_key_locator.location skloc) with
|
let location = Secret_key_locator.location skloc in
|
||||||
|
match Base58.safe_decode location with
|
||||||
| None -> Lwt.fail Exit
|
| None -> Lwt.fail Exit
|
||||||
| Some loc ->
|
| Some payload ->
|
||||||
let salt, skenc = salt_skenc_of_skloc loc in
|
let salt, skenc = salt_skenc_of_skloc payload in
|
||||||
match decrypt_sk skenc salt a with
|
match decrypt_sk skenc salt a with
|
||||||
| Some sk ->
|
| Some sk ->
|
||||||
Hashtbl.replace decrypted_sks loc
|
Hashtbl.replace decrypted_sks location
|
||||||
(Ed25519.Secret_key.of_bytes_exn sk) ;
|
(Ed25519.Secret_key.of_bytes_exn sk) ;
|
||||||
Lwt.return a
|
Lwt.return a
|
||||||
| None ->
|
| None ->
|
||||||
passwd_ask_loop
|
passwd_ask_loop
|
||||||
cctxt ~name ~salt ~skenc >>= fun (passwd, decrypted_sk) ->
|
cctxt ~name ~salt ~skenc >>= fun (passwd, decrypted_sk) ->
|
||||||
Hashtbl.replace decrypted_sks loc decrypted_sk ;
|
Hashtbl.replace decrypted_sks location decrypted_sk ;
|
||||||
Lwt.return (passwd :: a)
|
Lwt.return (passwd :: a)
|
||||||
end [] sks
|
end [] sks
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user