lookup

package
v0.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 18, 2016 License: GPL-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package lookup provides services that can look up identities and public keys for script authors.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Key

func Key(service KeyService, query string, single bool) (openpgp.KeyRing, error)

Key looks up an author query in the provided KeyService, and prompts for a choice of matches (if single is false) or automatically chooses the matched user when there is one and only one match (if single is true). It returns an error if no matches were found, if no match was chosen, or if no PGP public was found.

Types

type KeyService

type KeyService interface {
	Matches(query string) ([]User, error)
	Key(user User) (openpgp.EntityList, error)
}

KeyService defines the interface for third-party identity verification and public key services, like Keybase or Onename.

Matches gets a list of identities that match a query string from the KeyService.

Key gets the PGP public key for one user.

func NewKeyService

func NewKeyService(name string, fromPipe bool) (KeyService, error)

NewKeyService creates the KeyService implementation requested by name. If fromPipe is true, it creates a LocalPGPService type.

type KeybaseService

type KeybaseService struct{}

KeybaseService implements the KeyService interface for https://keybase.io

func (KeybaseService) Key

func (k KeybaseService) Key(user User) (openpgp.EntityList, error)

Key finds the PGP public key for one Keybase user by Keybase username and returns the key ring representation of the key. If the Keybase username is invalid, or the key itself is missing or invalid, Key returns an error.

func (KeybaseService) Matches

func (k KeybaseService) Matches(query string) ([]User, error)

Matches finds all the Keybase users that match query in any of their details (username, Twitter identity, Github identity, public key fingerprint, etc.). At most 10 matches will be found. If no matches are found, Matches returns an error.

type LocalPGPService

type LocalPGPService struct {
	// contains filtered or unexported fields
}

LocalPGPService implements the KeyService interface for a local GnuPG public keyring.

func NewLocalPGPService

func NewLocalPGPService() (*LocalPGPService, error)

NewLocalPGPService creates a new LocalPGPService if it finds a local public keyring; otherwise it bails.

func (*LocalPGPService) Key

func (l *LocalPGPService) Key(user User) (openpgp.EntityList, error)

Key gets the PGP public key from the local public keyring for a user's fingerprint and returns the keyRing representation. If the fingerprint is invalid or more than one public key is found, Key returns an error.

func (*LocalPGPService) Matches

func (l *LocalPGPService) Matches(query string) ([]User, error)

Matches finds all the public keys that have a fingerprint or identity (name and email address) that match query. If no matches are found, Matches returns an error.

func (*LocalPGPService) Ring

Ring loads the local public keyring so LocalPGPService can use it later. If it's already been loaded, Ring returns the existing version.

type User

type User struct {
	Username    string
	Fingerprint string
	FullName    string
	Twitter     string
	GitHub      string
	HackerNews  string
	Reddit      string
	Sites       []string
	Emails      []string
}

User represents an author's identity.

func (User) String

func (u User) String() string

String returns a representation of all the User's identity details.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL