Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display signatures on Public Keys when present #419

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 32 additions & 1 deletion src/callbacks/keyring.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,38 @@ namespace zypp
t << ( TableRow() << "" << _("Subkey:") << sub.asString() );
t << ( TableRow() << "" << _("Rpm Name:") << key.rpmName() );

return str << t;
str << t << '\n';

int numSignatures = (int)key.signatures().size();
if (numSignatures > 0) {

if (numSignatures == 1) // TODO: use a more appropriate format for the single signature case
str << _("There is a signature on the key.") << "\n\n";
else
str << str::form(_("There are %d signatures on the key."), numSignatures) << "\n\n";

t = Table();
t.lineStyle(none);
t << ( TableRow(ColorContext::PROMPT) << "" << _("Familiarity") << _("Signature") );

// TODO: Can we put a clean row separator here, instead of relying on color to distinguish the
// header from the data?

for ( const PublicKeySignatureData & sig : key.signatures()) {
std::string familiarity;
if (sig.inTrustedRing())
familiarity = _("Trusted");
else if (sig.inKnownRing())
familiarity = _("Known");
else
familiarity = _("Unknown");

t << ( TableRow() << "" << familiarity << sig );
}
return str << t;
}

return str;
}

inline std::ostream & dumpKeyInfo( std::ostream & str, const PublicKey & key, const KeyContext & context = KeyContext() )
Expand Down