totp 514 B

1234567891011121314151617181920
  1. #!/usr/bin/env perl
  2. use strict;
  3. use warnings;
  4. use FindBin::libs;
  5. use Trog::Auth;
  6. use Trog::Config;
  7. my $user = shift @ARGV;
  8. my $domain = Trog::Config->get()->param('general.hostname');
  9. die "Must provide a user" unless $user;
  10. die "Must Set domain in configuration file" unless $domain;
  11. my ( $uri, $qr, $failure, $message, $totp ) = Trog::Auth::totp($user,$domain);
  12. print "TOTP URI: $uri\n";
  13. print "Secret: ".$totp->base32secret()."\n";
  14. print "Current Auth code: ".$totp->expected_totp_code( time ) . "\n";