storage

package
v1.0.0-...-9f5453b Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2018 License: AGPL-3.0 Imports: 6 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrKeyNotFound = errors.New("key not found")

Functions

func Duplicates

func Duplicates(err error) []*openpgp.PrimaryKey

func IsNotFound

func IsNotFound(err error) bool

Types

type InsertError

type InsertError struct {
	Duplicates []*openpgp.PrimaryKey
	Errors     []error
}

func (InsertError) Error

func (err InsertError) Error() string

type Inserter

type Inserter interface {

	// Insert inserts new public keys if they are not already stored. If they
	// are, then nothing is changed.
	Insert([]*openpgp.PrimaryKey) (int, error)
}

Inserter defines the storage API for inserting key material.

type KeyAdded

type KeyAdded struct {
	Digest string
}

func (KeyAdded) InsertDigests

func (ka KeyAdded) InsertDigests() []string

func (KeyAdded) RemoveDigests

func (ka KeyAdded) RemoveDigests() []string

func (KeyAdded) String

func (ka KeyAdded) String() string

type KeyChange

type KeyChange interface {
	InsertDigests() []string
	RemoveDigests() []string
}

func UpsertKey

func UpsertKey(storage Storage, pubkey *openpgp.PrimaryKey) (kc KeyChange, err error)

type KeyNotChanged

type KeyNotChanged struct{}

func (KeyNotChanged) InsertDigests

func (knc KeyNotChanged) InsertDigests() []string

func (KeyNotChanged) RemoveDigests

func (knc KeyNotChanged) RemoveDigests() []string

func (KeyNotChanged) String

func (knc KeyNotChanged) String() string

type KeyReplaced

type KeyReplaced struct {
	OldDigest string
	NewDigest string
}

func (KeyReplaced) InsertDigests

func (kr KeyReplaced) InsertDigests() []string

func (KeyReplaced) RemoveDigests

func (kr KeyReplaced) RemoveDigests() []string

func (KeyReplaced) String

func (kr KeyReplaced) String() string

type Keyring

type Keyring struct {
	*openpgp.PrimaryKey

	CTime time.Time
	MTime time.Time
}

type Notifier

type Notifier interface {
	// Subscribe registers a key change callback function.
	Subscribe(func(KeyChange) error)

	// Notify invokes all registered callbacks with a key change notification.
	Notify(change KeyChange) error

	// RenotifyAll() invokes all registered callbacks with KeyAdded notifications
	// for each key in the Storage.
	RenotifyAll() error
}

type Queryer

type Queryer interface {

	// MatchMD5 returns the matching RFingerprint IDs for the given public key MD5 hashes.
	// The MD5 is calculated using the "SKS method".
	MatchMD5([]string) ([]string, error)

	// MatchID returns the matching RFingerprint IDs for the given public key IDs.
	// Key IDs may be short (last 4 bytes), long (last 10 bytes) or full (20 byte)
	// hexadecimal key IDs.
	Resolve([]string) ([]string, error)

	// MatchKeyword returns the matching RFingerprint IDs for the given keyword search.
	// The keyword search is storage dependant and results may vary among
	// different implementations.
	MatchKeyword([]string) ([]string, error)

	// ModifiedSince returns matching RFingerprint IDs for keyrings modified
	// since the given time.
	ModifiedSince(time.Time) ([]string, error)

	// FetchKeys returns the public key material matching the given RFingerprint slice.
	FetchKeys([]string) ([]*openpgp.PrimaryKey, error)

	// FetchKeyrings returns the keyring records matching the given RFingerprint slice.
	FetchKeyrings([]string) ([]*Keyring, error)
}

Queryer defines the storage API for search and retrieval of public key material.

type Storage

type Storage interface {
	io.Closer
	Queryer
	Updater
	Notifier
}

Storage defines the API that is needed to implement a complete storage backend for an HKP service.

type Updater

type Updater interface {
	Inserter

	// Update updates the stored PrimaryKey with the given contents, if the current
	// contents of the key in storage matches the given digest. If it does not
	// match, the update should be retried again later.
	Update(pubkey *openpgp.PrimaryKey, priorMD5 string) error
}

Updater defines the storage API for writing key material.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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