Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce with_*device functionality
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