totp

package
v0.0.0-...-ae0e7a4 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package totp provides TOTP functionality

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HCP

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

HCP is a HashiCorp Vault implementation of ITOTP

func New

func New(ctx context.Context) (*HCP, error)

New creates a new HCP

func (*HCP) DeleteTOTP

func (h *HCP) DeleteTOTP(ctx context.Context, name string) error

DeleteTOTP deletes a TOTP key

func (*HCP) GenerateTOTP

func (h *HCP) GenerateTOTP(ctx context.Context, name string) (string, string, error)

GenerateTOTP creates a new TOTP key and generates a code

func (*HCP) VerifyTOTP

func (h *HCP) VerifyTOTP(ctx context.Context, name, code string) (bool, error)

VerifyTOTP verifies a TOTP code

type ITOTP

type ITOTP interface {
	GenerateTOTP(ctx context.Context, name string) (string, string, error)
	VerifyTOTP(ctx context.Context, name, code string) (bool, error)
	DeleteTOTP(ctx context.Context, name string) error
}

ITOTP is an interface for TOTP

Jump to

Keyboard shortcuts

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