auth

package module
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2020 License: BSD-2-Clause Imports: 2 Imported by: 0

Documentation

Overview

Package auth provides utilities to authenticate users, using modern hashing algorithms.

Index

Constants

View Source
const (
	Argon2 = iota
)

Variables

View Source
var (
	ErrUnknownAlgorithm = errors.New("Unknown authentication algorithm.")
)

Functions

This section is empty.

Types

type Algorithm

type Algorithm int

type Authenticator

type Authenticator interface {
	Compare(hash, plaintext string) error
	Hash(plaintext string) (string, error)
}

Authenticator is the interface that wraps password authentication utilities.

Compare performs a constant time comparison of the given plaintext and hash using the authenticators underlying key derivation function. It returns nil if and only if password is the hash's plaintext equivalent.

Hash hashes the given plaintext using the authenticator's underlying key derivation function.

func NewAuthenticator

func NewAuthenticator(a Algorithm) (Authenticator, error)

Directories

Path Synopsis
Package argon2 implements auth's Authenticator interface using the argon2 key derivation function.
Package argon2 implements auth's Authenticator interface using the argon2 key derivation function.

Jump to

Keyboard shortcuts

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