Skip to content
/ otp Public

Implementations of several algorithms and standards around OTP

License

Notifications You must be signed in to change notification settings

xrjr/otp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

otp - HOTP and TOTP in Go

Informations

tests

General

This library implements HMAC-based One-Time Password (HOTP) and Time-based One-Time Password (TOTP) algorithms.

As this package hasn't reached v1 yet, its API shouldn't be considered stable and can change at any moment. However, it is unlikely to happen.

Supported standards

TOTP example usage

Using defaults :

code := otp.TOTP(secret, time.Now(), TOTPOptions{})

Using options :

code := otp.TOTP(secret, time.Now(), TOTPOptions{
  HOTPOptions: HOTPOptions{
    Digits: 8,
  },
  Period: 60,
  Step: -1,
})

Default options are :

  • 6 digits
  • 30 seconds time period
  • SHA1 hash function

About

Implementations of several algorithms and standards around OTP

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages