walletauth

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2020 License: BSD-3-Clause Imports: 8 Imported by: 4

Documentation

Overview

Package walletauth implements the wallet authentication scheme.

Index

Constants

View Source
const SkewWindow = 3600

SkewWindow is the resolution of the logintime.

View Source
const TokenSize = 144

TokenSize is the size of a token.

Variables

View Source
var (
	// ErrBadToken signals that the token is invalid.
	ErrBadToken = errors.New("walletauth: bad token")
	// ErrBadSignature signals that a token signature does not verify.
	ErrBadSignature = errors.New("walletauth: bad signature")
	// ErrReplay is returned if a replay was detected in authentication.
	ErrReplay = errors.New("walletauth: replay on authentication")
)
View Source
var Rand = rand.Reader

Rand is the random source.

Functions

func IsReplay

func IsReplay(err error) (uint64, error)

IsReplay checks if err is a replay error from walletauth and returns an update error and LastCounter. If err is no replay error, the original error is returned.

Types

type AuthToken

type AuthToken []byte

AuthToken is an authentication token.

func CreateToken

func CreateToken(pubkey *[ed25519.PublicKeySize]byte, privkey *[ed25519.PrivateKeySize]byte, counter uint64) AuthToken

CreateToken generates an authentication token.

func (AuthToken) CheckToken

func (token AuthToken) CheckToken() (pubkey *[ed25519.PublicKeySize]byte, ltime, lcounter uint64, err error)

CheckToken verifies a token signature and returns publickey, logintime and logincounter.

func (AuthToken) Hash

func (token AuthToken) Hash() []byte

Hash returns the hash of the authtoken (for callcache lookup).

Jump to

Keyboard shortcuts

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