keyshareserver

package
v0.12.6 Latest Latest
Warning

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

Go to latest
Published: May 31, 2023 License: Apache-2.0 Imports: 28 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
	StorageFallbackKeyFiles []string `json:"storage_fallback_key_files" mapstructure:"storage_fallback_key_files"`
	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  keysharecore.UserSecrets
	// contains filtered or unexported fields
}

User represents a user of this server.

Jump to

Keyboard shortcuts

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