diff --git a/cmd/attesto/connector_init.go b/cmd/attesto/connector_init.go index 8f66af9..5e29df1 100644 --- a/cmd/attesto/connector_init.go +++ b/cmd/attesto/connector_init.go @@ -2,7 +2,7 @@ package main // [D.5] `attesto connector init ` — scaffold a marketplace-ready // connector: a v2 manifest that passes connectorkit validation locally, a -// signed-webhook handler stub built on the P1.4 verification helper, and a +// signed-webhook starter built on the P1.4 verification helper, and a // README pointing at the submission flow. The local validation run is the // same code the marketplace runs, so a green scaffold is a green // pre-submission check. @@ -115,7 +115,7 @@ func connectorManifestTemplate(slug, name, category string) connectorkit.Manifes } } -const webhookHandlerStub = `"""Signed-webhook handler stub for the %s connector. +const webhookHandlerTemplate = `"""Signed-webhook handler starter for the %s connector. Verification uses the Attesto SDK's P1.4 helper — the same scheme the platform signs with: HMAC-SHA256 over "{timestamp}.{body}" with a 300s @@ -138,7 +138,7 @@ def handle(headers: dict[str, str], body: bytes) -> dict: return {"ok": True} ` -const connectorReadmeStub = `# %s +const connectorReadmeTemplate = `# %s Scaffolded by ` + "`attesto connector init`" + `. @@ -230,11 +230,11 @@ func (a *app) connectorInit(args []string) error { if err := os.WriteFile(filepath.Join(outDir, "attesto.connector.json"), append(raw, '\n'), 0o644); err != nil { return err } - handler := fmt.Sprintf(webhookHandlerStub, connectorName) + handler := fmt.Sprintf(webhookHandlerTemplate, connectorName) if err := os.WriteFile(filepath.Join(outDir, "webhook_handler.py"), []byte(handler), 0o644); err != nil { return err } - readme := fmt.Sprintf(connectorReadmeStub, connectorName, outDir) + readme := fmt.Sprintf(connectorReadmeTemplate, connectorName, outDir) if err := os.WriteFile(filepath.Join(outDir, "README.md"), []byte(readme), 0o644); err != nil { return err } diff --git a/cmd/attesto/connector_init_test.go b/cmd/attesto/connector_init_test.go index 4612ccf..5053201 100644 --- a/cmd/attesto/connector_init_test.go +++ b/cmd/attesto/connector_init_test.go @@ -1,7 +1,7 @@ package main // [D.5] connector init scaffolds a manifest whose ONLY validation finding is -// the pending canary, and the generated webhook stub calls the real P1.4 +// the pending canary, and the generated webhook starter calls the real P1.4 // helper with its actual signature. import ( @@ -35,12 +35,12 @@ func TestConnectorInitScaffoldsValidManifest(t *testing.T) { t.Fatalf("unexpected finding: %+v", finding) } } - stub, err := os.ReadFile(filepath.Join(dir, "webhook_handler.py")) + handler, err := os.ReadFile(filepath.Join(dir, "webhook_handler.py")) if err != nil { t.Fatal(err) } - if !strings.Contains(string(stub), "from attesto.webhooks import verify_webhook") { - t.Fatal("stub does not use the P1.4 helper") + if !strings.Contains(string(handler), "from attesto.webhooks import verify_webhook") { + t.Fatal("generated handler does not use the P1.4 helper") } // re-running must refuse to overwrite if err := a.connectorInit([]string{"my-crm-evidence", "--dir", dir}); err == nil {