Debian Codegraph @

README

raw
1 NAME
2 Pass::OTP - Perl implementation of HOTP / TOTP algorithms
3
4 SYNOPSIS
5 use Pass::OTP qw(otp);
6 use Pass::OTP::URI qw(parse);
7
8 my $uri = "otpauth://totp/ACME:[email protected]?secret=HXDMVJECJJWSRB3HWIZR4IFUGFTMXBOZ&issuer=ACME&digits=6";
9 my $otp_code = otp(parse($uri));
10
11 DESCRIPTION
12 The "Pass::OTP" module provides implementation of HOTP and TOTP
13 algorithms according to the RFC 4226 and RFC 6238.
14
15 FUNCTIONS
16 hotp(%options)
17 Computes HMAC-based One-time Password (RFC 4226).
18
19 HOTP(K,C) = Truncate(HMAC-SHA-1(K,C))
20
21 Step 1: Generate an HMAC-SHA-1 value
22
23 Let HS = HMAC-SHA-1(K,C)
24
25 Step 2: Generate a 4-byte string (Dynamic Truncation)
26
27 Let Sbits = DT(HS)
28
29 Step 3: Compute an HOTP value
30
31 Let Snum = StToNum(Sbits) # Convert S to a number in 0..2^{31}-1
32 Return D = Snum mod 10^Digit # D us a number in the range 0..10^{Digit}-1
33
34 totp(%options)
35 Computes Time-based One-time Password (RFC 6238).
36
37 TOTP = HOTP(K,T)
38 T = (Current Unix time - T0) / X
39
40 otp(%options)
41 Convenience wrapper which calls totp/hotp according to options.
42
43 SEE ALSO
44 Digest::HMAC
45
46 oathtool(1)
47
48 RFC 4226 RFC 6238
49
50 <https://github.com/google/google-authenticator/wiki/Key-Uri-Format>
51
52 COPYRIGHT AND LICENSE
53 Copyright (C) 2024 Jan Baier
54
55 This program is free software; you can redistribute it and/or modify it
56 under the terms of either: the GNU General Public License as published
57 by the Free Software Foundation; or the Artistic License.
58
59 See <http://dev.perl.org/licenses/> for more information.
60