diff options
author | Daniel Mueller <deso@posteo.net> | 2018-12-24 17:49:38 -0800 |
---|---|---|
committer | Daniel Mueller <deso@posteo.net> | 2018-12-24 17:49:38 -0800 |
commit | 27ed7f31128cf17dee1ab8e7cfa49f45ca123aec (patch) | |
tree | a8525a70a1b7536130d9a07c85b9150f3b09ae87 /nitrokey/src/lib.rs | |
parent | e1147d2f2eb98ef5a39a37fd63d98dae9a301ee2 (diff) | |
download | nitrocli-27ed7f31128cf17dee1ab8e7cfa49f45ca123aec.tar.gz nitrocli-27ed7f31128cf17dee1ab8e7cfa49f45ca123aec.tar.bz2 |
Refactor the pinentry call into new helper functions
Currently, `open` directly calls the `pinentry` module and loops until
the user entered a correct passphrase or the retry limit is reached.
This patch moves the pinentry call and the loop into the
`try_with_passphrase_and_data` function. This function queries a
passphrase of a given type and executes a function with that passphrase.
This function has a data argument and may return data that is passed to
the next call of the function (if it failed).
This data-passing mechanism is required for the `nitrokey`
authentication functions: These functions take ownership of the device
and either return an authenticated device after successful
authentication, or an error including the unauthenticated device if the
authentication failed. This patch enables the usage of these functions
in future patches.
Diffstat (limited to 'nitrokey/src/lib.rs')
0 files changed, 0 insertions, 0 deletions