gauthenticator 0.0.2
Act as google authenticator device
To use this package, run the following command in your project's root directory:
Manual usage
Put the following dependency into your project's dependences section:
Google Authenticator
A small D library to generate the google authenticator code.
inspired from https://github.com/tilaklodha/google-authenticator
- Install a D Language compiler https://dlang.org/
- Install Dub package manager
- On OSX run
brew install dub
. - On Ubuntu
snap install --classic dub
- Follow instructions on https://code.dlang.org/ for other OSes.
- On OSX run
The OTP auth code works on the secret token and the current time.
The time on your local machine should be in sync according to NTP.
The secret token usually is given to the user on the first configuration as a base32-encoded string or acquired via QR code.
The library exposes two functions:
- getHOTPToken given a "secret" and a time interval, returns the 6-digit HOTP Token as a string
- getTOTPToken given a "secret", returns the 6-digit TOTP Token as a string using the current time
more details on the algorithm on https://en.wikipedia.org/wiki/HMAC-basedOne-timePassword_algorithm
usage:
- add the library as a dependency in your dub project:
$ dub add gauthenticator
- use the library by calling getTOTPToken() or getHOTPToken() functions
import std.stdio;
import gauthenticator;
void main()
{
writeln(getTOTPToken("foobarbaz"));
}
- 0.0.2 released 4 years ago
- ilmanzo/gauthenticator
- mit
- Copyright © 2020, Andrea Manzini
- Authors:
- Dependencies:
- none
- Versions:
-
0.0.2 2020-Feb-28 0.0.1 2020-Feb-27 ~master 2020-Feb-28 - Download Stats:
-
-
0 downloads today
-
0 downloads this week
-
0 downloads this month
-
0 downloads total
-
- Score:
- 0.9
- Short URL:
- gauthenticator.dub.pm