feat(cli): two-key role routing + init bootstrap

openStore(role) selects the DEK wrap slot; admin commands require
EMCLI_ADMIN_KEY (admin slot only, no agent fallback); init writes both
slots from both keys. Test helpers seed the wrap slots.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-22 22:59:16 +01:00
parent cb0425f18d
commit 9d946b1b03
9 changed files with 158 additions and 27 deletions
+4 -4
View File
@@ -21,7 +21,7 @@ func runAccount(args []string, out, errOut io.Writer) int {
return 2
}
sub, rest := args[0], args[1:]
st, err := openStore()
st, err := openStore(store.RoleAdmin)
if err != nil {
fmt.Fprintf(errOut, "emcli: %v\n", err)
return 1
@@ -204,7 +204,7 @@ func runConfig(args []string, out, errOut io.Writer) int {
return 2
}
sub, key := args[0], args[1]
st, err := openStore()
st, err := openStore(store.RoleAdmin)
if err != nil {
fmt.Fprintf(errOut, "emcli: %v\n", err)
return 1
@@ -262,7 +262,7 @@ func runAudit(args []string, out, errOut io.Writer) int {
if err := fs.Parse(args[1:]); err != nil {
return 2
}
st, err := openStore()
st, err := openStore(store.RoleAdmin)
if err != nil {
fmt.Fprintf(errOut, "emcli: %v\n", err)
return 1
@@ -301,7 +301,7 @@ func runWhitelist(args []string, out, errOut io.Writer) int {
fmt.Fprintln(errOut, "--account is required")
return 2
}
st, err := openStore()
st, err := openStore(store.RoleAdmin)
if err != nil {
fmt.Fprintf(errOut, "emcli: %v\n", err)
return 1