idip credentials: store + serve a credential's appearance (mark + colour + uploaded image) — DDR 0217 amendment 2026-09-23 #1756

Closed
opened 2026-09-23 13:46:44 +00:00 by ben · 2 comments
Owner

What

Store a credential's appearance on its definition and serve it — the control-plane half of the DDR 0217 amendment 2026-09-23 (rulings 10–11). Today the dashboard's appearance picker (branch idip-credentials-ui) saves only to the harness fake.

Appearance (unsigned, roster-side, display only — like the name):

{ mark: 'logo' | 'icon' | 'image'; icon?: string /* curated Lucide key */; image?: string /* served URL */; background?: string /* #rrggbb */ }

Build

  • internal/keria/definitions.go — CredentialDefinition gains Appearance (json:"appearance,omitempty"). Existing credential-definitions.json files decode unchanged (no DisallowUnknownFields); an absent appearance reads as the default. builtinMembership() gets the default {mark: logo}.
  • Store + DefinitionAdapter + definitionView() carry it; Create accepts it.
  • internal/controlapi/idip_credentials.go — CreateCredentialRequest takes an optional appearance; a NEW sibling action route POST /api/v1/idip/credentials/{slug}/appearance (mirrors /rename — rename's contract is documented name-only, so do NOT widen it). Works on Membership too (display only). Validate: mark in the closed set; icon in the curated key list (keep ONE source — mirror CURATED_ICONS in dashboard/src/lib/credentialAppearance.ts, or generate one from the other); background ^#[0-9a-f]{6}$.
  • Image upload + hosting: an uploaded mark image (PNG/JPEG/WebP/SVG, ≤ 256 KB — MAX_IMAGE_BYTES) is stored content-addressed and served PUBLICLY (the member's wallet fetches it without a session) at a stable URL, e.g. https://<apex>/credential-images/<sha256>.<ext>, returning its digest alongside the URL. SVG must be served with a safe content type / sanitised (no script). The community logo is referenced the same way (its served /brand/logo URL + digest).
  • packages/openapi-spec/openapi.yaml — CredentialDefinitionView.appearance, CreateCredentialRequest.appearance, the new route + request body; regenerate (pnpm --filter @idss/openapi-spec run generate:client) and pass check:client. Update the "No custom fields" wording (wire.go:144, openapi:6506) to say appearance is display-only, per the amendment.
  • dashboard/src/lib/api/idipCredentialsClient.ts — pass appearance on create; implement setAppearance; an upload call for the image mark.

Acceptance

  • Create with an appearance round-trips through GET list/one; a definition file written before this change still loads (appearance absent → default).
  • POST …/{slug}/appearance changes only the appearance (name/slug/holders untouched), incl. Membership; an invalid mark/icon/colour is 409.
  • An uploaded image is served publicly at a content-addressed URL with its sha256; oversize/wrong-type is refused; an SVG cannot execute script.
  • openapi regenerated, check:client green; controlapi contract tests + keria store tests cover the above.

Refs

DDR 0217 amendment 2026-09-23 (docs/adr/0217-design-idip-credentials-not-komiti.md); branch idip-credentials-ui (dashboard/src/lib/credentialAppearance.ts is the shape the UI speaks).

## What Store a credential's **appearance** on its definition and serve it — the control-plane half of the DDR 0217 amendment 2026-09-23 (rulings 10–11). Today the dashboard's appearance picker (branch `idip-credentials-ui`) saves only to the harness fake. Appearance (unsigned, roster-side, display only — like the name): ```ts { mark: 'logo' | 'icon' | 'image'; icon?: string /* curated Lucide key */; image?: string /* served URL */; background?: string /* #rrggbb */ } ``` ## Build - `internal/keria/definitions.go` — `CredentialDefinition` gains `Appearance` (`json:"appearance,omitempty"`). Existing `credential-definitions.json` files decode unchanged (no `DisallowUnknownFields`); an absent appearance reads as the default. `builtinMembership()` gets the default `{mark: logo}`. - Store + `DefinitionAdapter` + `definitionView()` carry it; `Create` accepts it. - `internal/controlapi/idip_credentials.go` — `CreateCredentialRequest` takes an optional `appearance`; a NEW sibling action route `POST /api/v1/idip/credentials/{slug}/appearance` (mirrors `/rename` — rename's contract is documented name-only, so do NOT widen it). Works on Membership too (display only). Validate: `mark` in the closed set; `icon` in the curated key list (keep ONE source — mirror `CURATED_ICONS` in `dashboard/src/lib/credentialAppearance.ts`, or generate one from the other); `background` `^#[0-9a-f]{6}$`. - **Image upload + hosting:** an uploaded mark image (PNG/JPEG/WebP/SVG, ≤ 256 KB — `MAX_IMAGE_BYTES`) is stored content-addressed and served PUBLICLY (the member's wallet fetches it without a session) at a stable URL, e.g. `https://<apex>/credential-images/<sha256>.<ext>`, returning its **digest** alongside the URL. SVG must be served with a safe content type / sanitised (no script). The community logo is referenced the same way (its served `/brand/logo` URL + digest). - `packages/openapi-spec/openapi.yaml` — `CredentialDefinitionView.appearance`, `CreateCredentialRequest.appearance`, the new route + request body; regenerate (`pnpm --filter @idss/openapi-spec run generate:client`) and pass `check:client`. Update the "No custom fields" wording (wire.go:144, openapi:6506) to say appearance is display-only, per the amendment. - `dashboard/src/lib/api/idipCredentialsClient.ts` — pass `appearance` on create; implement `setAppearance`; an upload call for the image mark. ## Acceptance - [ ] Create with an appearance round-trips through GET list/one; a definition file written before this change still loads (appearance absent → default). - [ ] `POST …/{slug}/appearance` changes only the appearance (name/slug/holders untouched), incl. Membership; an invalid mark/icon/colour is 409. - [ ] An uploaded image is served publicly at a content-addressed URL with its sha256; oversize/wrong-type is refused; an SVG cannot execute script. - [ ] openapi regenerated, `check:client` green; controlapi contract tests + keria store tests cover the above. ## Refs DDR 0217 amendment 2026-09-23 (`docs/adr/0217-design-idip-credentials-not-komiti.md`); branch `idip-credentials-ui` (`dashboard/src/lib/credentialAppearance.ts` is the shape the UI speaks).

swarm-claim host=matou-dev-server-01 run=30954
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=matou-dev-server-01 run=30954 (automated multi-host claim — lowest live claim id works this ticket)

close-report for #1756 — status success

✅ close-report gates passed — every claim verified against main; issue closed.

envelope
{
  "issue": 1756,
  "status": "success",
  "commits": [
    "f512e27fa07277046bb8d870e049b9ffca1a6296"
  ],
  "changed_files": [
    "STATUS.md",
    "control-plane/cmd/control-plane/main.go",
    "dashboard/src/lib/api/generated.ts",
    "dashboard/src/lib/api/idipCredentialsClient.ts",
    "dashboard/src/lib/idipCredentials.ts",
    "dashboard/tests/unit/credentialsSurface.test.ts",
    "dashboard/tests/unit/idipCredentialsClientAppearance.test.ts",
    "dashboard/tests/unit/idipMemberCredentials.test.ts",
    "dashboard/tests/unit/idipRosterPanel.test.ts",
    "dashboard/tests/unit/removeMember.test.ts",
    "internal/controlapi/brandfiles.go",
    "internal/controlapi/credentialimages.go",
    "internal/controlapi/credentialimages_test.go",
    "internal/controlapi/idip_appearance_test.go",
    "internal/controlapi/idip_credentials.go",
    "internal/controlapi/idip_credentials_test.go",
    "internal/keria/adapter.go",
    "internal/keria/appearance_test.go",
    "internal/keria/credentialimages.go",
    "internal/keria/credentialimages_test.go",
    "internal/keria/definitions.go",
    "internal/keriawire/appearance.go",
    "internal/keriawire/wire.go",
    "packages/openapi-spec/openapi.yaml"
  ],
  "tests": [
    {
      "command": "go test ./internal/keria/ ./internal/keriawire/ ./internal/controlapi/",
      "exit_code": 0
    },
    {
      "command": "go vet ./internal/keria/ ./internal/keriawire/ ./internal/controlapi/",
      "exit_code": 0
    },
    {
      "command": "golangci-lint run ./internal/keria/... ./internal/keriawire/... ./internal/controlapi/...",
      "exit_code": 0
    },
    {
      "command": "cd control-plane && go build ./... && go vet ./cmd/control-plane/",
      "exit_code": 0
    },
    {
      "command": "node packages/openapi-spec/scripts/generate-client.mjs --check",
      "exit_code": 0
    },
    {
      "command": "packages/openapi-spec vitest run (spec.test.ts)",
      "exit_code": 0
    },
    {
      "command": "vue-tsc -p dashboard/tsconfig.json --noEmit",
      "exit_code": 0
    },
    {
      "command": "vitest run dashboard idip credential + client appearance tests",
      "exit_code": 0
    }
  ],
  "criteria": {
    "Create with an appearance round-trips through GET list/one; a definition file written before this change still loads (appearance absent -> default)": "internal/keria/appearance_test.go TestDefinitions_CreateWithAppearanceRoundTrips + TestDefinitions_PreAmendmentFileDefaults (pre-amendment JSON with no appearance loads, reads default {mark: logo}); internal/keria/definitions.go defaultAppearance + Create optional appearance; controlapi TestIdipCredentials_CreateWithAppearance",
    "POST .../{slug}/appearance changes only the appearance (name/slug/holders untouched), incl. Membership; an invalid mark/icon/colour is 409": "internal/controlapi/idip_credentials.go new POST /idip/credentials/{slug}/appearance route + keriawire.ValidateAppearance -> 409; internal/keria/definitions.go SetAppearance (look-only, Membership override); tests TestDefinitions_SetAppearanceIsLookOnly + controlapi TestIdipCredentials_ChangeLook (Membership + invalid->409)",
    "An uploaded image is served publicly at a content-addressed URL with its sha256; oversize/wrong-type is refused; an SVG cannot execute script": "internal/keria/credentialimages.go content-addressed store + SVG sanitiser; internal/controlapi/credentialimages.go steward-gated upload (returns {url,digest}) + PUBLIC GET /credential-images/{name} (ungated, hardened CSP+nosniff+ETag); tests TestCredentialImages_ContentAddressedRoundTrip / _RefusesWrongTypeAndOversize / _SVGCannotExecuteScript + controlapi TestCredentialImages_UploadThenPublicFetch",
    "openapi regenerated, check:client green; controlapi contract tests + keria store tests cover the above": "packages/openapi-spec/openapi.yaml (CredentialAppearanceView, .appearance on view+create, SetAppearanceRequest + /appearance route); dashboard/src/lib/api/generated.ts regenerated; node generate-client.mjs --check = 'generated client is in sync'; keria + controlapi test suites green"
  },
  "summary": "The control plane stores and serves a credential's appearance (mark + colour + uploaded image) with public content-addressed image hosting by digest, per the DDR 0217 amendment 2026-09-23.",
  "blockers": []
}
**close-report** for #1756 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 1756, "status": "success", "commits": [ "f512e27fa07277046bb8d870e049b9ffca1a6296" ], "changed_files": [ "STATUS.md", "control-plane/cmd/control-plane/main.go", "dashboard/src/lib/api/generated.ts", "dashboard/src/lib/api/idipCredentialsClient.ts", "dashboard/src/lib/idipCredentials.ts", "dashboard/tests/unit/credentialsSurface.test.ts", "dashboard/tests/unit/idipCredentialsClientAppearance.test.ts", "dashboard/tests/unit/idipMemberCredentials.test.ts", "dashboard/tests/unit/idipRosterPanel.test.ts", "dashboard/tests/unit/removeMember.test.ts", "internal/controlapi/brandfiles.go", "internal/controlapi/credentialimages.go", "internal/controlapi/credentialimages_test.go", "internal/controlapi/idip_appearance_test.go", "internal/controlapi/idip_credentials.go", "internal/controlapi/idip_credentials_test.go", "internal/keria/adapter.go", "internal/keria/appearance_test.go", "internal/keria/credentialimages.go", "internal/keria/credentialimages_test.go", "internal/keria/definitions.go", "internal/keriawire/appearance.go", "internal/keriawire/wire.go", "packages/openapi-spec/openapi.yaml" ], "tests": [ { "command": "go test ./internal/keria/ ./internal/keriawire/ ./internal/controlapi/", "exit_code": 0 }, { "command": "go vet ./internal/keria/ ./internal/keriawire/ ./internal/controlapi/", "exit_code": 0 }, { "command": "golangci-lint run ./internal/keria/... ./internal/keriawire/... ./internal/controlapi/...", "exit_code": 0 }, { "command": "cd control-plane && go build ./... && go vet ./cmd/control-plane/", "exit_code": 0 }, { "command": "node packages/openapi-spec/scripts/generate-client.mjs --check", "exit_code": 0 }, { "command": "packages/openapi-spec vitest run (spec.test.ts)", "exit_code": 0 }, { "command": "vue-tsc -p dashboard/tsconfig.json --noEmit", "exit_code": 0 }, { "command": "vitest run dashboard idip credential + client appearance tests", "exit_code": 0 } ], "criteria": { "Create with an appearance round-trips through GET list/one; a definition file written before this change still loads (appearance absent -> default)": "internal/keria/appearance_test.go TestDefinitions_CreateWithAppearanceRoundTrips + TestDefinitions_PreAmendmentFileDefaults (pre-amendment JSON with no appearance loads, reads default {mark: logo}); internal/keria/definitions.go defaultAppearance + Create optional appearance; controlapi TestIdipCredentials_CreateWithAppearance", "POST .../{slug}/appearance changes only the appearance (name/slug/holders untouched), incl. Membership; an invalid mark/icon/colour is 409": "internal/controlapi/idip_credentials.go new POST /idip/credentials/{slug}/appearance route + keriawire.ValidateAppearance -> 409; internal/keria/definitions.go SetAppearance (look-only, Membership override); tests TestDefinitions_SetAppearanceIsLookOnly + controlapi TestIdipCredentials_ChangeLook (Membership + invalid->409)", "An uploaded image is served publicly at a content-addressed URL with its sha256; oversize/wrong-type is refused; an SVG cannot execute script": "internal/keria/credentialimages.go content-addressed store + SVG sanitiser; internal/controlapi/credentialimages.go steward-gated upload (returns {url,digest}) + PUBLIC GET /credential-images/{name} (ungated, hardened CSP+nosniff+ETag); tests TestCredentialImages_ContentAddressedRoundTrip / _RefusesWrongTypeAndOversize / _SVGCannotExecuteScript + controlapi TestCredentialImages_UploadThenPublicFetch", "openapi regenerated, check:client green; controlapi contract tests + keria store tests cover the above": "packages/openapi-spec/openapi.yaml (CredentialAppearanceView, .appearance on view+create, SetAppearanceRequest + /appearance route); dashboard/src/lib/api/generated.ts regenerated; node generate-client.mjs --check = 'generated client is in sync'; keria + controlapi test suites green" }, "summary": "The control plane stores and serves a credential's appearance (mark + colour + uploaded image) with public content-addressed image hosting by digest, per the DDR 0217 amendment 2026-09-23.", "blockers": [] } ``` </details>
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Matou/idss#1756
No description provided.