Current File : //usr/local/apps/perl/man/man3/URI::otpauth.3
.\" Automatically generated by Pod::Man 4.11 (Pod::Simple 3.35)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings.  \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
.    ds -- \(*W-
.    ds PI pi
.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
.    ds L" ""
.    ds R" ""
.    ds C` ""
.    ds C' ""
'br\}
.el\{\
.    ds -- \|\(em\|
.    ds PI \(*p
.    ds L" ``
.    ds R" ''
.    ds C`
.    ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\"
.\" If the F register is >0, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD.  Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{\
.    if \nF \{\
.        de IX
.        tm Index:\\$1\t\\n%\t"\\$2"
..
.        if !\nF==2 \{\
.            nr % 0
.            nr F 2
.        \}
.    \}
.\}
.rr rF
.\" ========================================================================
.\"
.IX Title "URI::otpauth 3"
.TH URI::otpauth 3 "2025-05-10" "perl v5.30.0" "User Contributed Perl Documentation"
.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAME"
URI::otpauth \- URI scheme for secret keys for OTP secrets.  Usually found in QR codes
.SH "VERSION"
.IX Header "VERSION"
Version 5.29
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 1
\&  use URI;
\&
\&  # optauth URI from textual uri
\&  my $uri = URI\->new( \*(Aqotpauth://totp/Example:alice@google.com?secret=NFZS25DINFZV643VOAZXELLTGNRXEM3UH4&issuer=Example\*(Aq );
\&
\&  # same URI but created from arguments
\&  my $uri = URI::otpauth\->new( type => \*(Aqtotp\*(Aq, issuer => \*(AqExample\*(Aq, account_name => \*(Aqalice@google.com\*(Aq, secret => \*(Aqis\-this_sup3r\-s3cr3t?\*(Aq );
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
This \s-1URI\s0 scheme is defined in <https://github.com/google/google\-authenticator/wiki/Key\-Uri\-Format/>:
.SH "SUBROUTINES/METHODS"
.IX Header "SUBROUTINES/METHODS"
.ie n .SS """new"""
.el .SS "\f(CWnew\fP"
.IX Subsection "new"
Create a new URI::otpauth. The available arguments are listed below;
.IP "\(bu" 4
account_name \- this can be the account name (probably an email address) used when authenticating with this secret.  It is an optional field.
.IP "\(bu" 4
algorithm \- this is the cryptographic hash function <https://en.wikipedia.org/wiki/Cryptographic_hash_function> that should be used.  Current values are \s-1SHA1\s0 <https://en.wikipedia.org/wiki/SHA-1>, \s-1SHA256\s0 <https://en.wikipedia.org/wiki/SHA-2> or \s-1SHA512\s0 <https://en.wikipedia.org/wiki/SHA-2>.  It is an optional field and will default to \s-1SHA1.\s0
.IP "\(bu" 4
counter \- this is only required when the type is \s-1HOTP.\s0
.IP "\(bu" 4
digits \- this determines the length <https://github.com/google/google-authenticator/wiki/Key-Uri-Format/#digits> of the code presented to the user.  It is an optional field and will default to 6 digits.
.IP "\(bu" 4
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.  It is an optional field.
.IP "\(bu" 4
label \- this is the issuer and the account name <https://github.com/google/google-authenticator/wiki/Key-Uri-Format/#label> joined with a \*(L":\*(R" character.  It is an optional field.
.IP "\(bu" 4
period \- this is the period that the \s-1TOTP\s0 code is valid for <https://github.com/google/google-authenticator/wiki/Key-Uri-Format/#counter>.  It is an optional field and will default to 30 seconds.
.IP "\(bu" 4
secret \- this is the key <https://en.wikipedia.org/wiki/Key_(cryptography)> that the \s-1TOTP\s0 <https://en.wikipedia.org/wiki/Time-based_one-time_password>/\s-1HOTP\s0 <https://en.wikipedia.org/wiki/HMAC-based_one-time_password> algorithm uses to derive the value.  It is an arbitrary byte string and must remain private.  This field is mandatory.
.IP "\(bu" 4
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 will default to 'totp'.
.ie n .SS """algorithm"""
.el .SS "\f(CWalgorithm\fP"
.IX Subsection "algorithm"
Get or set the algorithm of this otpauth \s-1URI.\s0
.ie n .SS """account_name"""
.el .SS "\f(CWaccount_name\fP"
.IX Subsection "account_name"
Get or set the account_name of this otpauth \s-1URI.\s0
.ie n .SS """counter"""
.el .SS "\f(CWcounter\fP"
.IX Subsection "counter"
Get or set the counter of this otpauth \s-1URI.\s0
.ie n .SS """digits"""
.el .SS "\f(CWdigits\fP"
.IX Subsection "digits"
Get or set the digits of this otpauth \s-1URI.\s0
.ie n .SS """issuer"""
.el .SS "\f(CWissuer\fP"
.IX Subsection "issuer"
Get or set the issuer of this otpauth \s-1URI.\s0
.ie n .SS """label"""
.el .SS "\f(CWlabel\fP"
.IX Subsection "label"
Get or set the label of this otpauth \s-1URI.\s0
.ie n .SS """period"""
.el .SS "\f(CWperiod\fP"
.IX Subsection "period"
Get or set the period of this otpauth \s-1URI.\s0
.ie n .SS """secret"""
.el .SS "\f(CWsecret\fP"
.IX Subsection "secret"
Get or set the secret of this otpauth \s-1URI.\s0
.ie n .SS """type"""
.el .SS "\f(CWtype\fP"
.IX Subsection "type"
Get or set the type of this otpauth \s-1URI.\s0
.PP
.Vb 1
\&  my $type = $uri\->type(\*(Aqhotp\*(Aq);
.Ve
.SH "CONFIGURATION AND ENVIRONMENT"
.IX Header "CONFIGURATION AND ENVIRONMENT"
URI::otpauth requires no configuration files or environment variables.
.SH "DEPENDENCIES"
.IX Header "DEPENDENCIES"
\&\s-1URI\s0
.SH "DIAGNOSTICS"
.IX Header "DIAGNOSTICS"
.ie n .IP """secret is a mandatory parameter for URI::otpauth""" 4
.el .IP "\f(CWsecret is a mandatory parameter for URI::otpauth\fR" 4
.IX Item "secret is a mandatory parameter for URI::otpauth"
The secret parameter was not detected for the URI::otpauth\->\fBnew()\fR method.
.SH "INCOMPATIBILITIES"
.IX Header "INCOMPATIBILITIES"
None reported.
.SH "BUGS AND LIMITATIONS"
.IX Header "BUGS AND LIMITATIONS"
To report a bug, or view the current list of bugs, please visit <https://github.com/libwww\-perl/URI/issues>
.SH "AUTHOR"
.IX Header "AUTHOR"
David Dick \f(CW\*(C`<ddick@cpan.org>\*(C'\fR
.SH "LICENSE AND COPYRIGHT"
.IX Header "LICENSE AND COPYRIGHT"
Copyright (c) 2024, David Dick \f(CW\*(C`<ddick@cpan.org>\*(C'\fR.
.PP
This module is free software; you can redistribute it and/or
modify it under the same terms as Perl itself. See perlartistic.