All files / src/app/compliance/_components TrustedIssuers.tsx

100% Statements 5/5
100% Branches 2/2
100% Functions 3/3
100% Lines 5/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 684x                       231x 231x                       693x                                                 1848x                                  
"use client";
 
import trusted from "@/content/trusted-issuers.json";
import { useT } from "@/lib/i18n/translate";
 
/**
 * The issuers the control plane trusts, each for the credential types it may
 * issue (#710, ADR-064). The list is ui/src/content/trusted-issuers.json, the
 * same file the identity checks compare the control plane's settings with
 * (TRUST-6.1), so what this shows is what the connector enforces.
 */
export function TrustedIssuers() {
  const t = useT("access");
  return (
    <div className="mt-8" data-testid="trusted-issuers">
      <h3 className="text-sm font-semibold mb-1 text-(--text-primary)">
        {t("Trusted issuers")}
      </h3>
      <p className="text-(--text-secondary) text-xs mb-3">
        {t(
          "A credential counts only if its issuer is trusted for its type; one that is not makes the connector refuse the whole request.",
        )}
      </p>
      <ul className="space-y-3">
        {trusted.issuers.map((issuer) => (
          <li
            key={issuer.alias}
            className="rounded-lg border border-(--border) bg-(--surface-2)/50 p-4"
          >
            <div className="font-medium text-sm">{issuer.name}</div>
            <code className="block text-xs text-(--text-secondary) break-all mt-0.5">
              {issuer.did}
            </code>
            {"azureDid" in issuer && (
              <div className="text-xs text-(--text-secondary) mt-0.5">
                {t("On Azure:")}{" "}
                <code className="break-all">{issuer.azureDid}</code>
              </div>
            )}
            <p className="text-xs text-(--text-secondary) mt-1">
              {issuer.role}
            </p>
            <div
              className="flex flex-wrap gap-1.5 mt-2"
              aria-label={t("May issue")}
            >
              {/* The layer colour on the border, the text in the theme's: teal
                  text on its own tint was 3.87:1 in the light theme (WCAG
                  1.4.3). */}
              {issuer.types.map((type) => (
                <span
                  key={type}
                  className="text-xs px-2 py-0.5 rounded-sm border border-layer2/50 text-(--text-primary)"
                >
                  {type}
                </span>
              ))}
            </div>
            <div className="text-xs text-(--text-secondary) mt-2">
              {t("Trusted on:")} {issuer.environments.join(", ")}
            </div>
          </li>
        ))}
      </ul>
    </div>
  );
}