userdb

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2021 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package userdb defines the Katzenpost server user database abstract interface.

Index

Constants

View Source
const MaxUsernameSize = constants.RecipientIDLength

MaxUsernameSize is the maximum username length in bytes.

Variables

View Source
var (
	// ErrNoSuchUser is the error returned when an operation fails due to
	// a non-existent user.
	ErrNoSuchUser = errors.New("userdb: no such user")

	// ErrNoIdentity is the error returned when the specified user has no
	// identity key set.
	ErrNoIdentity = errors.New("userdb: no identity key set")
)

Functions

This section is empty.

Types

type UserDB

type UserDB interface {
	// Exists returns true iff the user identified by the username exists.
	Exists([]byte) bool

	// IsValid returns true iff the user identified by the username and
	// public key is valid.
	IsValid([]byte, *ecdh.PublicKey) bool

	// Link returns the user's link layer authentication key.
	Link([]byte) (*ecdh.PublicKey, error)

	// Add adds the user identified by the username and public key
	// to the database.  Existing users will have their public keys
	// updated if specified, otherwise an error will be returned.
	Add([]byte, *ecdh.PublicKey, bool) error

	// SetIdentity sets the optional identity key for the user identified
	// by the user name to the provided public key.  Providing a nil key
	// will remove the user's identity key iff it exists.
	SetIdentity([]byte, *ecdh.PublicKey) error

	// Identity returns the optional identity key for the user identified
	// by the user name.
	Identity([]byte) (*ecdh.PublicKey, error)

	// Remove removes the user identified by the username from the database.
	Remove([]byte) error

	// Close closes the UserDB instance.
	Close()
}

UserDB is the interface provided by all user database implementations.

Directories

Path Synopsis
Package boltuserdb implements the Katzenpost server user database with a simple boltdb based backend.
Package boltuserdb implements the Katzenpost server user database with a simple boltdb based backend.
Package externuserdb implements the Katzenpost server user database with http calls to a external authorization source (expected to run in localhost).
Package externuserdb implements the Katzenpost server user database with http calls to a external authorization source (expected to run in localhost).

Jump to

Keyboard shortcuts

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