token

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package token implements `TokenGenerator` for couchbase driver.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

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

Service represents the password reset token management service.

func New

func New(db *store.DB, h hash.Hash, exp int) Service

New initializes the token generation service.

func (Service) Create

func (s Service) Create(ctx context.Context, ownerID string) (
	secure.Token, error)

Create creates new reset password token.

func (Service) Delete

func (s Service) Delete(ctx context.Context, id string) error

Delete deletes ResetPasswordToken by ResetPasswordSecret

func (Service) GetByID

func (s Service) GetByID(ctx context.Context, id string) (
	secure.Token, error)

GetByID retrieves ResetPasswordToken by ownerID

func (Service) Hash

func (s Service) Hash(ctx context.Context, b []byte) string

Hash hashes a stream of bytes using sha2 algorihtm.

func (Service) HashMatchesToken

func (s Service) HashMatchesToken(ctx context.Context, hash, token string) bool

HashMatchesToken matches hash with token. Returns true if hash and token match.

Jump to

Keyboard shortcuts

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