URI::otpauth(3) User Contributed Perl Documentation URI::otpauth(3)

URI::otpauth - URI scheme for secret keys for OTP secrets. Usually found in QR codes

Version 5.29

use URI;
# optauth URI from textual uri
my $uri = URI->new( 'otpauth://totp/Example:alice@google.com?secret=NFZS25DINFZV643VOAZXELLTGNRXEM3UH4&issuer=Example' );
# same URI but created from arguments
my $uri = URI::otpauth->new( type => 'totp', issuer => 'Example', account_name => 'alice@google.com', secret => 'is-this_sup3r-s3cr3t?' );

This URI scheme is defined in https://github.com/google/google-authenticator/wiki/Key-Uri-Format/:

Create a new URI::otpauth. The available arguments are listed below;

Get or set the algorithm of this otpauth URI.

Get or set the account_name of this otpauth URI.

Get or set the counter of this otpauth URI.

Get or set the digits of this otpauth URI.

Get or set the issuer of this otpauth URI.

Get or set the label of this otpauth URI.

Get or set the period of this otpauth URI.

Get or set the secret of this otpauth URI.

Get or set the type of this otpauth URI.

my $type = $uri->type('hotp');

URI::otpauth requires no configuration files or environment variables.

URI

"secret is a mandatory parameter for URI::otpauth"
The secret parameter was not detected for the URI::otpauth->new() method.

None reported.

To report a bug, or view the current list of bugs, please visit https://github.com/libwww-perl/URI/issues

David Dick "<ddick@cpan.org>"

Copyright (c) 2024, David Dick "<ddick@cpan.org>".

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.

2024-12-15 perl v5.40.0