auth

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package auth defines the authentication layer of the application.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

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

Auth is a service that provides HTTP handlers and middlewares used for authentication.

It uses a time-based nonce. The nonce is encrypted with the private key.

func NewAuth

func NewAuth(
	nonces nonce.Repository,
) *Auth

NewAuth builds the Auth struct.

func (*Auth) Challenge

func (a *Auth) Challenge(ctx context.Context, message string) string

Challenge returns a message with a nonce.

func (*Auth) Verify

func (a *Auth) Verify(ctx context.Context, address string, data []byte, sig []byte) error

Verify checks the signature and nonce.

This is a time-based nonce. In production, it is preferable to use a true nonce (random number) which is stored in a database.

Jump to

Keyboard shortcuts

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