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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |