URI::otpauth(3)
π URI::otpauth π
okay so bestie, real talk: this is the manual for URI::otpauth, a Perl module from the URI family. It's the URI scheme for secret keys for OTP secrets β and yeah, that's exactly the thing you usually find hiding in QR codes. π
β¨ VERSION β¨
Version 5.29 β that's the one, no cap.
πΈ SYNOPSIS πΈ
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?' );
(and yes, optauth in that first comment is literally how the original spells it β we keep the receipts π
)
π¦ DESCRIPTION π¦
This URI scheme is defined right here: https://github.com/google/google-authenticator/wiki/Key-Uri-Format/
That's the whole vibe check. Moving on, main character style. β¨
π SUBROUTINES/METHODS π
π«Ά "new"
Creates a brand-new URI::otpauth. The arguments you can slide in are listed below:
account_nameβ this can be the account name (probably an email address) used when authenticating with this secret. It's an optional field, so no pressure.algorithmβ the cryptographic hash function (https://en.wikipedia.org/wiki/Cryptographic_hash_function) that should be used. Current values are SHA1 (https://en.wikipedia.org/wiki/SHA-1), SHA256 (https://en.wikipedia.org/wiki/SHA-2), or SHA512 (https://en.wikipedia.org/wiki/SHA-2). Optional field, and it defaults toSHA1.counterβ this is only required when the type isHOTP. That's the whole rule, iykyk.digitsβ this determines the length (https://github.com/google/google-authenticator/wiki/Key-Uri-Format/#digits) of the code presented to the user. Optional field, defaults to6digits.issuerβ this can be the application / system (https://github.com/google/google-authenticator/wiki/Key-Uri-Format/#issuer) that this secret can be used to authenticate to. Optional field.labelβ this is the issuer and the account name (https://github.com/google/google-authenticator/wiki/Key-Uri-Format/#label) joined with a":"character. Optional field.periodβ this is the period that the TOTP code is valid for (https://github.com/google/google-authenticator/wiki/Key-Uri-Format/#counter). Optional field, defaults to30seconds.secretβ this is the key (https://en.wikipedia.org/wiki/Key_(cryptography)) that the TOTP (https://en.wikipedia.org/wiki/Time-based_one-time_password) / HOTP (https://en.wikipedia.org/wiki/HMAC-based_one-time_password) algorithm uses to derive the value. It's an arbitrary byte string and it must remain private. π This field is mandatory β no secret, no deal.typeβ this can be'hotp'(https://en.wikipedia.org/wiki/HMAC-based_one-time_password) or'totp'(https://en.wikipedia.org/wiki/Time-based_one-time_password). This field defaults to'totp'.
ngl bestie, that secret one? Treat it like your deepest darkest secret, because that's literally what it is. Keep it private, fr fr. π
π "algorithm"
Get or set the algorithm of this otpauth URI.
π "account_name"
Get or set the account_name of this otpauth URI.
π "counter"
Get or set the counter of this otpauth URI.
π "digits"
Get or set the digits of this otpauth URI.
π "issuer"
Get or set the issuer of this otpauth URI.
π "label"
Get or set the label of this otpauth URI.
π "period"
Get or set the period of this otpauth URI.
π "secret"
Get or set the secret of this otpauth URI.
π "type"
Get or set the type of this otpauth URI.
my $type = $uri->type('hotp');
(look at that β get and set in one iconic little line π)
π CONFIGURATION AND ENVIRONMENT π
URI::otpauth requires no configuration files or environment variables. Zero setup, we love a low-maintenance icon. β¨
π§ DEPENDENCIES π§
URI
π DIAGNOSTICS π
"secret is a mandatory parameter for URI::otpauth"β thesecretparameter was not detected for theURI::otpauth->new()method. Yeah. It's mandatory. It said what it said. π
π INCOMPATIBILITIES π
None reported. (a peaceful, drama-free era ποΈ)
β BUGS AND LIMITATIONS β
To report a bug, or to view the current list of bugs, please visit https://github.com/libwww-perl/URI/issues β the devs are literally waiting for you there. π«Ά
πΈ AUTHOR πΈ
David Dick <ddick@cpan.org>
π LICENSE AND COPYRIGHT π
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.
and that's the whole page bestie β this was perl v5.42.0, dated 2026-09-02, and it's giving iconic documentation energy. slay, go rotate some secrets responsibly π
β¨
π¦ where this page comes from
- opensuse-leap 16.0: perl-URI 5.310.0-160000.3.1 Β· Artistic-1.0 OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms