# -*-shell-script-*-
# This should be sourced by bash (though we welcome changes to make it POSIX sh compliant)

# Monkeysphere authentication list-certifiers subcommand
#
# The monkeysphere scripts are written by:
# Jameson Rollins <jrollins@fifthhorseman.net>
# Jamie McClelland <jm@mayfirst.org>
# Daniel Kahn Gillmor <dkg@fifthhorseman.net>
#
# They are Copyright 2008-2009, and are all released under the GPL,
# version 3 or later.

# list the host certifiers

list_certifiers() {

local keys
local key

# find trusted keys in sphere keychain
log debug "finding trusted keys..."

# NOTE: looking for only 'f' keys here (used to be '(u|f)'), since the
# only key that should be 'u' is the core key, which is not
# technically a certifier in the sense we're worried about.  Is this
# not correct?  Should we be sorting out the certifier keys in a
# different way?
keys=$(gpg_sphere "--list-keys --with-colons --fingerprint" | \
    grep ^pub: | cut -d: -f2,5 | egrep '^f:' | cut -d: -f2)

# output keys
for key in $keys ; do
    gpg_sphere "--list-key --fingerprint 0x${key}!"
done

}