Provided by: libnet-duo-perl_1.01-1_all bug

NAME

       Net::Duo::Admin::Token - Representation of a Duo token

SYNOPSIS

           my $decoded_json = get_json();
           my $token = Net::Duo::Admin::Token->new($decoded_json);
           say $token->serial;

REQUIREMENTS

       Perl 5.14 or later and the modules HTTP::Request and HTTP::Response (part of
       HTTP::Message), JSON, LWP (also known as libwww-perl), Perl6::Slurp, Sub::Install, and
       URI::Escape (part of URI), all of which are available from CPAN.

DESCRIPTION

       A Net::Duo::Admin::Token object is a Perl representation of a Duo token as returned by the
       Duo Admin API, usually via the tokens() method or nested in a user returned by the users()
       method.  It contains various information about a token.

CLASS METHODS

       create(DUO, DATA)
           Creates a new token in Duo and returns the resulting token as a new
           Net::Duo::Admin::Token object.  DUO is the Net::Duo object that should be used to
           perform the creation.  DATA is a reference to a hash with the following keys:

           aes_key
               The YubiKey AES key.  This parameter is required for YubiKey hardware tokens.

           counter
               Initial value for the HOTP counter.  The default is 0.  This parameter is only
               valid for HOTP-6 and HOTP-8 hardware tokens.

           private_id
               The YubiKey private ID.  This parameter is required for YubiKey hardware tokens.

           secret
               The HOTP secret.  This parameter is required for HOTP-6 and HOTP-8 hardware
               tokens.

           serial
               The serial number of the token.  Required.

           type
               The type of hardware token.  For the list of valid values, see the Duo Admin API
               documentation.  Required.

           Note that several of these keys can only be set on token creation and cannot be
           retrieved afterwards.

       new(DUO, DATA)
           Creates a new Net::Duo::Admin::Token object from a full data set.  DUO is the Net::Duo
           object that should be used for any further actions on this object.  DATA should be the
           data structure returned by the Duo REST API for a single user, after JSON decoding.

       new(DUO, ID)
           Creates a new Net::Duo::Admin::Token by ID.  DUO is the Net::Duo object that is used
           to retrieve the token from Duo and will be used for any subsequent operations.  The ID
           should be the Duo identifier of the token.  This constructor is distinguished from the
           previous constructor by checking whether ID is a reference.

INSTANCE ACTION METHODS

       delete()
           Delete this token from Duo.  After successful completion of this call, the
           Net::Duo::Admin::Token object should be considered read-only, since no further changes
           to the object can be meaningfully sent to Duo.

       json()
           Convert the data stored in the object to JSON and return the results.  The resulting
           JSON should match the JSON that one would get back from the Duo web service when
           retrieving the same object (plus any changes made locally to the object via set_*()
           methods).  This is primarily intended for debugging dumps or for passing Duo objects
           to other systems via further JSON APIs.

INSTANCE DATA METHODS

       serial()
           The serial number of the hardware token, used to uniquely identify the hardware token
           when paired with type().

                   serial   => 'simple',
                   token_id => 'simple',
                   type     => 'simple',
                   users    => 'Net::Duo::Admin::User',

       token_id()
           The unique ID of this token as generated by Duo on token creation.

       type()
           The type of token.  For the list of valid values, see the Duo Admin API documentation.

       users()
           The users associated with this token as a list of Net::Duo::Admin::User objects.

AUTHOR

       Russ Allbery <rra@cpan.org>

COPYRIGHT AND LICENSE

       Copyright 2014 The Board of Trustees of the Leland Stanford Junior University

       Permission is hereby granted, free of charge, to any person obtaining a copy of this
       software and associated documentation files (the "Software"), to deal in the Software
       without restriction, including without limitation the rights to use, copy, modify, merge,
       publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
       to whom the Software is furnished to do so, subject to the following conditions:

       The above copyright notice and this permission notice shall be included in all copies or
       substantial portions of the Software.

       THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
       INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
       PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
       FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
       OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
       DEALINGS IN THE SOFTWARE.

SEE ALSO

       Net::Duo::Admin

       Duo Admin API for tokens <https://www.duosecurity.com/docs/adminapi#tokens>

       This module is part of the Net::Duo distribution.  The current version of Net::Duo is
       available from CPAN, or directly from its web site at
       <http://www.eyrie.org/~eagle/software/net-duo/>.