keyreg

package
v0.0.0-...-39628cf Latest Latest
Warning

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

Go to latest
Published: May 4, 2024 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindKeyByHash

func FindKeyByHash(keys []*rsautil.PublicKey, h string) *rsautil.PublicKey

FindKeyByHash finds the key which has the same hash of h.

func IsSimpleName

func IsSimpleName(user string) bool

IsSimpleName checks if the user name is a simple one that is safe to fetch a key.

Types

type FileKeyRegistry

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

FileKeyRegistry is a storage of public keys backed by a file system.

func NewFileKeyRegistry

func NewFileKeyRegistry(keys map[string]string) *FileKeyRegistry

NewFileKeyRegistry creates a new key store given a key file map for each users that has a key.

func (*FileKeyRegistry) Keys

func (s *FileKeyRegistry) Keys(user string) ([]*rsautil.PublicKey, error)

Keys returns the public keys for the given user.

type KeyRegistry

type KeyRegistry interface {
	Keys(user string) ([]*rsautil.PublicKey, error)
}

KeyRegistry loads public keys for a user.

func OpenKeyRegistry

func OpenKeyRegistry(urlStr string) (KeyRegistry, error)

OpenKeyRegistry connects to a keystore based on the given URL string.

type MemKeyRegistry

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

MemKeyRegistry is a storage of public keys in memory.

func NewDirKeyRegistry

func NewDirKeyRegistry(dir string) (*MemKeyRegistry, error)

NewDirKeyRegistry creates a new keystore with public keys saved in files under a directory.

func NewMemKeyRegistry

func NewMemKeyRegistry() *MemKeyRegistry

NewMemKeyRegistry creates a new empty key store.

func (*MemKeyRegistry) Keys

func (r *MemKeyRegistry) Keys(user string) ([]*rsautil.PublicKey, error)

Keys returns the public keys for the given user.

func (*MemKeyRegistry) Set

func (r *MemKeyRegistry) Set(user string, keys []*rsautil.PublicKey)

Set sets the key for the given user.

type WebKeyRegistry

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

WebKeyRegistry is a storage of public keys backed by a web site.

func NewWebKeyRegistry

func NewWebKeyRegistry(base *url.URL) *WebKeyRegistry

NewWebKeyRegistry creates a new key store backed by a web site at the given base URL.

func (*WebKeyRegistry) Keys

func (s *WebKeyRegistry) Keys(user string) ([]*rsautil.PublicKey, error)

Keys returns the public keys of the given user.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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