models

package
v0.0.0-...-64c63ee Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2021 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthenticationToken

type AuthenticationToken struct {
	Username     string `json:"username"`
	SessionToken string `json:"sessionToken"`
}

Representation of an authentication token

type Contact

type Contact struct {
	ID         uuid.UUID `json:"id,omitempty"`
	Owner      string    `json:"owner,omitempty"`
	CipherText string    `json:"cipherText,omitempty"`
	Iv         string    `json:"iv,omitempty"`
}

Contact payload representation

type ContactRepository

type ContactRepository interface {
	NewContact(Contact) (string, error)
	FetchAllContacts(id string) ([]*Contact, error)
	DeleteContact(id string, contactId string) error
}

Interface for contact actions

type EncryptedRootKey

type EncryptedRootKey struct {
	CipherText string `json:"cipherText"`
	Iv         string `json:"iv"`
}

type LoginRequest

type LoginRequest struct {
	Username string `json:"username"`
	PIN      string `json:"pin"`
}

Representation of a Login request

type RegistrationToken

type RegistrationToken struct {
	Id    string `json:"id"`
	Nonce string `json:"nonce"`
}

Representation of an ephemeral registration token

type Token

type Token struct {
	Id        string `json:"id"`
	Username  string `json:"username,omitempty"`
	Signature string `json:"signature"`
}

type User

type User struct {
	Id               uuid.UUID        `json:"id,omitempty"`
	Username         string           `json:"username" validate:"required"`
	Name             string           `json:"name,omitempty"`
	PIN              string           `json:"pin,omitempty"`
	RootPasswordSalt string           `json:"rootPasswordSalt"`
	RootPublicKey    string           `json:"rootPublicKey"`
	EncryptedRootKey EncryptedRootKey `json:"encryptedRootKey"`
	Token            Token            `json:"token,omitempty"`
}

Representation of a user for the authentication microservice

type UserRepository

type UserRepository interface {
	UsernameExists(username string) (bool, error)                   // Check if a username provided exists
	CreateRegistrationToken() (*RegistrationToken, error)           // Create an ephemeral registration token
	FindRegistrationToken(string) (*RegistrationToken, error)       // Find an ephemeral registration token from its ID
	InsertAccount(User) (string, error)                             // Insert a user to the database
	CreateAuthenticationToken(string) (*AuthenticationToken, error) // Create access token and refresh tokens
	CreateLoginToken(string) (*RegistrationToken, error)            // Create an ephemeral login token
	FindEncryptedAccount(string) (*User, error)                     // Find the encrypted account details for a user
	SearchIdByUsername(username string) (string, error)             // Search for account ID by username
	FindAccountPublicKey(id string) (string, error)                 // Find the public of an account by its ID
	VerifyAccountPIN(string, string) (bool, error)                  // Check a users submitted PIN to make sure it matches the one on record
	CountUsers() (int, error)                                       // Count amount of users on platform
}

Interface for user actions

Jump to

Keyboard shortcuts

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