Skip to content

Commit

Permalink
Introduce with_*device functionality
Browse files Browse the repository at this point in the history
The upcoming nitrokey 0.4 release changes the way a device handle can be
acquired, requiring a manager instance for doing so in an attempt to
prevent users from opening multiple sessions (which is not something
that libnitrokey supports).
A straight integration of the reworked API surface into our program
would severely complicate the architecture because of the additional
requirement of keeping a manager object around while a device is being
used.
To make the program more amenable to those changes in nitrokey, this
patch reworks the way we interact with a device handle: instead of
passing the device object around we pass in the functionality making use
of it in the form of a function. In more concrete terms, instead of
retrieving a device handle via get_device() we now have a with_device()
function that takes care of opening the device and then passing it to a
user-provided function.
  • Loading branch information
d-e-s-o committed Jul 15, 2019
1 parent 019b1bb commit ec9dddc
Showing 1 changed file with 284 additions and 249 deletions.
Loading

0 comments on commit ec9dddc

Please sign in to comment.