Documentation ¶
Overview ¶
wkd implements OpenPGP Web Key Directory, defined in https://tools.ietf.org/html/draft-koch-openpgp-webkey-service-06
Index ¶
Examples ¶
Constants ¶
View Source
const Base = "/.well-known/openpgpkey"
Base is the well-known base path for WKD.
View Source
const Version = 6
Version is the WKD protocol version.
Variables ¶
View Source
var ErrNotFound = errors.New("wkd: not found")
ErrNotFound is returned when the directory doesn't contain a public key for the provided address.
Functions ¶
func Discover ¶
Discover retrieves keys associated to an email address.
Example ¶
pubkeys, err := wkd.Discover("me@davlgd.fr") if err != nil { log.Fatal(err) } log.Println(pubkeys)
Output:
func HashAddress ¶
HashAddress returns the WKD hash for the local part of a given email address.
Types ¶
type Handler ¶
type Handler struct { // Discover retrieves keys for an address. If there's no key available for // this address, ErrNotFound should be returned. Discover func(hash string) ([]*openpgp.Entity, error) }
Handler is a HTTP WKD handler.
Example ¶
h := wkd.Handler{ Discover: func(hash string) ([]*openpgp.Entity, error) { stallmanHash, _ := wkd.HashAddress("rms@gnu.org") if hash != stallmanHash { return nil, wkd.ErrNotFound } return openpgp.ReadArmoredKeyRing(strings.NewReader(stallmanPubkey)) }, } http.ListenAndServe(":8080", &h)
Output:
Click to show internal directories.
Click to hide internal directories.