Add config validation, remove command, status filtering, and unlock method display
config check: validates UUID format, recognized methods, keyfile consistency and existence. Reports all issues with alias context. remove: deletes a device from config by alias. Inverse of add. status: --mounted, --unlocked, --locked flags filter the device table. Flags combine as OR. mount/unlock: display which method succeeded and key slot used, e.g. "(fido2, key slot 1)". cryptsetup Open now runs with -v and parses "Key slot N unlocked" from stderr via io.MultiWriter. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
19
cmd/format.go
Normal file
19
cmd/format.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"git.wntrmute.dev/kyle/arca/internal/unlock"
|
||||
)
|
||||
|
||||
// formatMethod returns a parenthesized string describing how a device
|
||||
// was unlocked, e.g. "(fido2, key slot 1)" or "(passphrase)".
|
||||
func formatMethod(r *unlock.Result) string {
|
||||
if r.Method == "" {
|
||||
return ""
|
||||
}
|
||||
if r.KeySlot != "" {
|
||||
return fmt.Sprintf("(%s, key slot %s)", r.Method, r.KeySlot)
|
||||
}
|
||||
return fmt.Sprintf("(%s)", r.Method)
|
||||
}
|
||||
Reference in New Issue
Block a user