fido2: pretty-print fidoCommand in debug output
Related: https://github.com/rfjakob/gocryptfs/issues/571
This commit is contained in:
parent
fe616ddad5
commit
d6c8d892ff
|
@ -22,6 +22,20 @@ const (
|
||||||
assertWithPIN fidoCommand = iota
|
assertWithPIN fidoCommand = iota
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// String pretty-prints for debug output
|
||||||
|
func (fc fidoCommand) String() string {
|
||||||
|
switch fc {
|
||||||
|
case cred:
|
||||||
|
return "cred"
|
||||||
|
case assert:
|
||||||
|
return "assert"
|
||||||
|
case assertWithPIN:
|
||||||
|
return "assertWithPIN"
|
||||||
|
default:
|
||||||
|
return fmt.Sprintf("%d", fc)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const relyingPartyID = "gocryptfs"
|
const relyingPartyID = "gocryptfs"
|
||||||
|
|
||||||
func callFidoCommand(command fidoCommand, device string, stdin []string) ([]string, error) {
|
func callFidoCommand(command fidoCommand, device string, stdin []string) ([]string, error) {
|
||||||
|
@ -34,7 +48,7 @@ func callFidoCommand(command fidoCommand, device string, stdin []string) ([]stri
|
||||||
case assertWithPIN:
|
case assertWithPIN:
|
||||||
cmd = exec.Command("fido2-assert", "-G", "-h", "-v", device)
|
cmd = exec.Command("fido2-assert", "-G", "-h", "-v", device)
|
||||||
}
|
}
|
||||||
tlog.Debug.Printf("callFidoCommand: executing %q with args %q", cmd.Path, cmd.Args)
|
tlog.Debug.Printf("callFidoCommand %s: executing %q with args %q", command, cmd.Path, cmd.Args)
|
||||||
cmd.Stderr = os.Stderr
|
cmd.Stderr = os.Stderr
|
||||||
in, err := cmd.StdinPipe()
|
in, err := cmd.StdinPipe()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue