I think these QR codes are just otpauth:// URLs.

In a demo of implementing TOTP yourself, I implemented this and now I see that I even released this onto CPAN as Auth::GoogleAuthenticator. The meat of the code is:

sub registration_qr_code { my ($self, $label, $type) = @_; # if we have an OTP, dislay the QRCode to the user require Imager::QRCode; my $qrcode = Imager::QRCode->new( size => 4, margin => 4, version => 1, level => 'M', casesensitive => 1, ); my $img = $qrcode->plot($self->registration_url($label, $type)); $img->write( data => \my $res, type => 'png' ); $res } sub registration_key { return encode_base32( $_[0]->{secret} ); } sub registration_url { my ($self, $label, $type) = @_; $type ||= 'totp'; $label= uri_escape($label); return "otpauth://$type/$label?secret=" . $self->registration_key }

You can find the code also on Github


In reply to Re: replacement for Auth::GoogleAuth by Corion
in thread replacement for Auth::GoogleAuth by ForgotPasswordAgain

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.