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:
@@ -23,12 +23,13 @@ func TestRunVersionIsJSONForAgentButTextHere(t *testing.T) {
|
||||
// proving the key check happens before any DB work.
|
||||
var out, errOut bytes.Buffer
|
||||
t.Setenv("EMCLI_KEY", "")
|
||||
t.Setenv("EMCLI_ADMIN_KEY", "")
|
||||
code := Run([]string{"account", "list"}, &out, &errOut)
|
||||
if code == 0 {
|
||||
t.Fatal("missing EMCLI_KEY must fail")
|
||||
}
|
||||
if !strings.Contains(out.String()+errOut.String(), "EMCLI_KEY") {
|
||||
t.Fatalf("should mention EMCLI_KEY, got out=%q err=%q", out.String(), errOut.String())
|
||||
if !strings.Contains(out.String()+errOut.String(), "EMCLI_ADMIN_KEY") {
|
||||
t.Fatalf("should mention EMCLI_ADMIN_KEY, got out=%q err=%q", out.String(), errOut.String())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,3 +55,8 @@ func b64Key() string {
|
||||
// 32 zero bytes, base64.
|
||||
return "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="
|
||||
}
|
||||
|
||||
func b64AgentKey() string {
|
||||
// 32 bytes of 0x01, base64 — distinct from b64Key so slot mix-ups surface.
|
||||
return "AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQE="
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user