Some checks failed
Security / Security check (push) Failing after 1s
The doc-verifier pass over the new trust/exposure surfaces came back PASS with five improvements, all applied: - the store policy notice gains a 'Learn more' into the security doc (the notice named security.require_signatures but not where it lives) - 'blocked' disables the trust gate's install button — an active button contradicted the 'install would be refused' statement right above it (guard test added) - the unknown-exposure tooltip now says what the operator can do (check where the name resolves) - dead l10n key verifPillUnverified removed (unverified is the page-level notice, never a card pill) - stale header comment in install_verification.dart corrected Signed-off-by: flemming-it <stefan.a.flemming@googlemail.com>
66 lines
2 KiB
Dart
66 lines
2 KiB
Dart
// Presentation of `StoreItem.installVerification` — the hub's
|
|
// per-entry statement of how an install would be verified under
|
|
// the CURRENT policy (computed hub-side with the same resolvers
|
|
// the install gate enforces). One mapping, used by the trust-gate
|
|
// dialog and the store card's blocked pill, so every surface
|
|
// tells the same story. (The module detail sheet routes installs
|
|
// through the dialog and needs no copy of its own.)
|
|
|
|
import '../l10n/app_localizations.dart';
|
|
|
|
enum VerificationTone { good, neutral, warning, danger }
|
|
|
|
class InstallVerificationInfo {
|
|
final String label;
|
|
final String body;
|
|
final VerificationTone tone;
|
|
|
|
const InstallVerificationInfo({
|
|
required this.label,
|
|
required this.body,
|
|
required this.tone,
|
|
});
|
|
}
|
|
|
|
/// Maps the wire value to its localized presentation. Returns null
|
|
/// for an empty/unknown value (pre-0.23 hub) — callers keep their
|
|
/// generic wording then instead of guessing.
|
|
InstallVerificationInfo? describeInstallVerification(
|
|
String wire,
|
|
AppLocalizations l,
|
|
) {
|
|
switch (wire) {
|
|
case 'pinned-key':
|
|
return InstallVerificationInfo(
|
|
label: l.verifPinnedKey,
|
|
body: l.verifPinnedKeyBody,
|
|
tone: VerificationTone.good,
|
|
);
|
|
case 'trusted-publishers':
|
|
return InstallVerificationInfo(
|
|
label: l.verifTrustedPublishers,
|
|
body: l.verifTrustedPublishersBody,
|
|
tone: VerificationTone.good,
|
|
);
|
|
case 'unverified':
|
|
return InstallVerificationInfo(
|
|
label: l.verifUnverified,
|
|
body: l.verifUnverifiedBody,
|
|
tone: VerificationTone.warning,
|
|
);
|
|
case 'blocked':
|
|
return InstallVerificationInfo(
|
|
label: l.verifBlocked,
|
|
body: l.verifBlockedBody,
|
|
tone: VerificationTone.danger,
|
|
);
|
|
case 'federated':
|
|
return InstallVerificationInfo(
|
|
label: l.verifFederated,
|
|
body: l.verifFederatedBody,
|
|
tone: VerificationTone.neutral,
|
|
);
|
|
default:
|
|
return null;
|
|
}
|
|
}
|