We only need the ctap-types for six error codes. It makes more sense to
define these error codes directly inside the crate so that we don’t need
to make usbd-ctaphid releases just to bump ctap-types.
Arguably, this also makes the code more correct: Previously, we used a
type that represents the CTAP2 error codes, but we actually want to use
the CTAPHID error codes. Those happen to be the same, but it could be a
cause for confusion.
In the future, we could also use the ctaphid-types crate instead.
When we receive a CTAPHID_CANCEL command and cancel a user presence
check, we still need to respond to the original command, typically with
a CTAP2_ERR_KEEPALIVE_CANCEL error. And if we already finished
executing the command, there is no harm in sending out its response.
With this patch, we never discard responses that have already been
calculated. Also, we never reset the pipe state and just finish the
normal command flow. We just set the interrupt flag if the
authenticator is currently processing a command.
Our packet buffer is smaller than the response buffer used by
ctaphid-dispatch. Therefore we have to check whether a response fits
into the buffer and return an error if not.