auth_core

package
v0.0.0-...-0064678 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2022 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

This file is in core bc GenUUID generates UUID that are needed for core models

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenUUID

func GenUUID() (string, error)

Types

type User

type User struct {
	ID        string       `bson:"_id"`
	Email     string       `bson:"email"`
	Password  UserPassword `bson:"password"`
	CreatedAt int64        `bson:"created_at"` // unix timestamp
}

User describes a user entity

type UserPassword

type UserPassword struct {
	Hash string `bson:"hash"`
	Salt string `bson:"salt"`
}

UserPassword describes user's password data

func (*UserPassword) Init

func (up *UserPassword) Init(password string) error

Init generates salt and hash with given password and fills corresponding fields.

func (*UserPassword) Validate

func (up *UserPassword) Validate(password string) error

Validate checks if the given password is the one that is stored.

Jump to

Keyboard shortcuts

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