Nitrokey / pynitrokey

Python client for Nitrokey devices
Apache License 2.0
94 stars 28 forks source link

Add trussed abstraction and nkpk subcommand #500

Closed robin-nitrokey closed 5 months ago

robin-nitrokey commented 5 months ago

This PR adds a new abstraction layer by extracting most of the functionality from the nk3 module to a trussed module and introduces the nkpk subcommand that uses this abstraction.

Currently available commands for nkpk:

daringer commented 5 months ago

did some testing on this to find a regression, but nothing so far... nice! tested with: nk3am + nk3an means mostly the nk3 and fido2 sub-commands - not yet tested with the nkpk

lgtm!

sosthene-nitrokey commented 5 months ago

I get an error when doing nitropy ilst:

Critical error:
An unhandled exception occurred
    Exception encountered: AttributeError("'NoneType' object has no attribute 'device_name'")

It looks like the list method in cli/trussed/__init.py gets a None context.

robin-nitrokey commented 5 months ago

Ah, good catch. That’s due to this ugly hack:

https://github.com/Nitrokey/pynitrokey/blob/970377341f6964cf3776cbb417a9ef20ba791db6/pynitrokey/cli/__init__.py#L106-L110

Maybe there is a typesafe replacement for this code.

robin-nitrokey commented 5 months ago

Should be fixed now.