.\" Automatically generated by Pod::Man 4.09 (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 .. .if !\nF .nr F 0 .if \nF>0 \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} .\} .\" ======================================================================== .\" .IX Title "AnyEvent::Yubico 3pm" .TH AnyEvent::Yubico 3pm "2018-05-21" "perl v5.26.2" "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" AnyEvent::Yubico \- AnyEvent based Perl extension for validating YubiKey OTPs. Though AnyEvent is used internally, the module does not impose any particular coding style on the caller. Provides both blocking and non\-blocking methods of OTP verification. .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use AnyEvent::Yubico; \& \& $yk = AnyEvent::Yubico\->new({ client_id => 4711, api_key => \*(Aq\*(Aq }); \& \& $result = $yk\->verify(\*(Aq\*(Aq); \& if($result) ... .Ve .PP For more details about the response, instead call verify_sync($otp), which returns a hash containing all the parameters that were in the response. .PP .Vb 2 \& $result_details = $yk\->verify_sync(\*(Aq\*(Aq); \& if($result_details\->{status} == \*(AqOK\*(Aq) ... .Ve .PP As an alternative, you can call verify_async, which will return a condition variable immediately. This can be used if your application already uses an asynchronous model. You can also pass a callback as a second parameter to verify as well as verify_async, which will be invoked once validation has completed, with the result. .PP .Vb 5 \& $result_cv = $yk\->verify_async(\*(Aq\*(Aq, sub { \& #Callback invoked when verification is done \& $result_details = shift; \& if($result_details\->{status} eq \*(AqOK\*(Aq) ... \& }); \& \& #Wait for the result (blocking, same as calling verify directly). \& $result_details = $result_cv\->recv; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Validates a YubiKey \s-1OTP\s0 (One Time Password) using the \s-1YKVAL 2.0\s0 protocol as defined here: https://github.com/Yubico/yubikey\-val/wiki/ValidationProtocolV20 .PP To use this module, an \s-1API\s0 key is required, which can be requested here: https://upgrade.yubico.com/getapikey/ .PP When creating the AnyEvent::Yubico instance, the following arguments can be passed: .ie n .IP "client_id = $id_int" 4 .el .IP "client_id = \f(CW$id_int\fR" 4 .IX Item "client_id = $id_int" Required. The client \s-1ID\s0 corresponding to the \s-1API\s0 key. .ie n .IP "api_key => $api_key_string" 4 .el .IP "api_key => \f(CW$api_key_string\fR" 4 .IX Item "api_key => $api_key_string" Optional. The \s-1API\s0 key used to sign requests and verify responses. Without this response signatures won't be verified. .ie n .IP "urls => $array_of_urls" 4 .el .IP "urls => \f(CW$array_of_urls\fR" 4 .IX Item "urls => $array_of_urls" Optional. Defines which validation server URLs to query. The default uses the public YubiCloud validation servers. Must support version 2.0 of the validation protocol. .Sp Example: .Sp .Vb 8 \& $yk = AnyEvent::Yubico\->new({ \& client_id => ..., \& api_key => ..., \& urls => [ \& "http://example.com/wsapi/2.0/verify", \& "http://127.0.0.1/wsapi/2.0/verify" \& ] \& }); .Ve .ie n .IP "sign_requests => $enable" 4 .el .IP "sign_requests => \f(CW$enable\fR" 4 .IX Item "sign_requests => $enable" Optional. When enabled (enabled by default) requests will be signed, as long as api_key is also provided. .ie n .IP "timeout => $seconds" 4 .el .IP "timeout => \f(CW$seconds\fR" 4 .IX Item "timeout => $seconds" Optional. Timeout parameter sent to the server, see the protocol details for more information. .ie n .IP "sl => $level" 4 .el .IP "sl => \f(CW$level\fR" 4 .IX Item "sl => $level" Optional. Security level parameter sent to the server, see the protocol details for more information. .ie n .IP "timestamp => $enable" 4 .el .IP "timestamp => \f(CW$enable\fR" 4 .IX Item "timestamp => $enable" Optional. When enabled, sends the timestamp parameter to the server, causing YubiKey counter and timestamp information to be returned in the response. .ie n .IP "local_timeout => $seconds" 4 .el .IP "local_timeout => \f(CW$seconds\fR" 4 .IX Item "local_timeout => $seconds" Optional. Sets the local timeout for how long the verify method will wait until failing. The default is 30 seconds. .SH "SEE ALSO" .IX Header "SEE ALSO" The Yubico Validation Protocol 2.0 specification: https://github.com/Yubico/yubikey\-val/wiki/ValidationProtocolV20 .PP More information about the YubiKey: http://www.yubico.com .SH "AUTHOR" .IX Header "AUTHOR" Dain Nilsson, .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" Copyright (C) 2013 Yubico \s-1AB\s0 All rights reserved. .PP Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: .PP .Vb 2 \& * Redistributions of source code must retain the above copyright \& notice, this list of conditions and the following disclaimer. \& \& * Redistributions in binary form must reproduce the above \& copyright notice, this list of conditions and the following \& disclaimer in the documentation and/or other materials provided \& with the distribution. .Ve .PP \&\s-1THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \&\*(L"AS IS\*(R" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\s0 (\s-1INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES\s0; \s-1LOSS OF USE, DATA, OR PROFITS\s0; \s-1OR BUSINESS INTERRUPTION\s0) \s-1HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\s0 (\s-1INCLUDING NEGLIGENCE OR OTHERWISE\s0) \s-1ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\s0