keyshareserver

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2024 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Configuration

type Configuration struct {
	// IRMA server configuration
	*server.Configuration `mapstructure:",squash"`

	// Database configuration (ignored when database is provided)
	DBType            DBType `json:"db_type" mapstructure:"db_type"`
	DBConnStr         string `json:"db_str" mapstructure:"db_str"`
	DBConnMaxIdle     int    `json:"db_max_idle" mapstructure:"db_max_idle"`
	DBConnMaxOpen     int    `json:"db_max_open" mapstructure:"db_max_open"`
	DBConnMaxIdleTime int    `json:"db_max_idle_time" mapstructure:"db_max_idle_time"`
	DBConnMaxOpenTime int    `json:"db_max_open_time" mapstructure:"db_max_open_time"`
	// Provide a prepared database (useful for testing)
	DB DB `json:"-"`

	// Configuration of secure Core
	// Private key used to sign JWTs with
	JwtKeyID          uint32 `json:"jwt_key_id" mapstructure:"jwt_key_id"`
	JwtIssuer         string `json:"jwt_issuer" mapstructure:"jwt_issuer"`
	JwtPinExpiry      int    `json:"jwt_pin_expiry" mapstructure:"jwt_pin_expiry"`
	JwtPrivateKey     string `json:"jwt_privkey" mapstructure:"jwt_privkey"`
	JwtPrivateKeyFile string `json:"jwt_privkey_file" mapstructure:"jwt_privkey_file"`
	// Decryption keys used for user secrets
	StorageFallbackKeysDir string `json:"storage_fallback_keys_dir" mapstructure:"storage_fallback_keys_dir"`
	StoragePrimaryKeyFile  string `json:"storage_primary_key_file" mapstructure:"storage_primary_key_file"`

	// Keyshare attribute to issue during registration
	KeyshareAttribute irma.AttributeTypeIdentifier `json:"keyshare_attribute" mapstructure:"keyshare_attribute"`

	// Configuration for email sending during registration (email address use will be disabled if not present)
	keyshare.EmailConfiguration `mapstructure:",squash"`

	RegistrationEmailFiles    map[string]string `json:"registration_email_files" mapstructure:"registration_email_files"`
	RegistrationEmailSubjects map[string]string `json:"registration_email_subjects" mapstructure:"registration_email_subjects"`

	VerificationURL map[string]string `json:"verification_url" mapstructure:"verification_url"`
	// Amount of time user's email validation token is valid (in hours)
	EmailTokenValidity int `json:"email_token_validity" mapstructure:"email_token_validity"`
	// contains filtered or unexported fields
}

Configuration contains configuration for the irmaserver library and irmad.

type DB

type DB interface {
	AddUser(ctx context.Context, user *User) error
	// contains filtered or unexported methods
}

DB is an interface used by server to manage data storage. There are multiple implementations of this, currently:

  • memorydb (memorydb.go) storing all data in memory (forgets everything after reboot)
  • postgresdb (postgresdb.go) storing all data in a postgres database

func NewMemoryDB

func NewMemoryDB() DB

type DBType

type DBType string
const (
	DBTypeMemory   DBType = "memory"
	DBTypePostgres DBType = "postgres"
)

type Server

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

func New

func New(conf *Configuration) (*Server, error)

func (*Server) Handler

func (s *Server) Handler() http.Handler

func (*Server) Stop

func (s *Server) Stop()

type User

type User struct {
	Username string
	Language string
	Secrets  UserSecrets
	// contains filtered or unexported fields
}

User represents a user of this server.

type UserSecrets added in v0.13.0

type UserSecrets keysharecore.UserSecrets

UserSecrets is a keysharecore.UserSecrets with DB (un)marshaling methods.

func (*UserSecrets) Scan added in v0.13.0

func (us *UserSecrets) Scan(src interface{}) (err error)

Scan implements sql/driver Scanner interface.

func (UserSecrets) Value added in v0.13.0

func (us UserSecrets) Value() (driver.Value, error)

Value implements sql/driver Scanner interface.

Jump to

Keyboard shortcuts

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