1oath_totp_generate(3)               liboath              oath_totp_generate(3)
2
3
4

NAME

6       oath_totp_generate - API function
7

SYNOPSIS

9       #include <oath.h>
10
11       int  oath_totp_generate(const  char  *  secret,  size_t  secret_length,
12       time_t now, unsigned time_step_size, time_t start_offset, unsigned dig‐
13       its, char * output_otp);
14

ARGUMENTS

16       const char * secret
17                   the shared secret string
18
19       size_t secret_length
20                   length of secret
21
22       time_t now  Unix time value to compute TOTP for
23
24       unsigned time_step_size
25                   time step system parameter (typically 30)
26
27       time_t start_offset
28                   Unix  time  of when to start counting time steps (typically
29                   0)
30
31       unsigned digits
32                   number of requested digits in the OTP, excluding checksum
33
34       char * output_otp
35                   output buffer, must have room for the output OTP plus zero
36

DESCRIPTION

38       Generate a one-time-password using the time-variant TOTP algorithm  de‐
39       scribed in RFC 6238.  The input parameters are taken as time values.
40
41       The  system parameter time_step_size describes how long the time window
42       for each OTP is.  The recommended value is 30 seconds, and you can  use
43       the  value 0 or the symbol OATH_TOTP_DEFAULT_TIME_STEP_SIZE to indicate
44       this.
45
46       The system parameter start_offset denote the Unix time when time  steps
47       are started to be counted.  The recommended value is 0, to fall back on
48       the Unix epoch) and you can use the symbol OATH_TOTP_DEFAULT_START_TIME
49       to indicate this.
50
51       The  output_otp  buffer  must have room for at least digits characters,
52       plus one for the terminating NUL.
53
54       Currently only values 6, 7 and 8 for digits are  supported.   This  re‐
55       striction may be lifted in future versions.
56

RETURNS

58       On  success, OATH_OK (zero) is returned, otherwise an error code is re‐
59       turned.
60

SINCE

62       1.4.0
63

REPORTING BUGS

65       Report bugs  to  <oath-toolkit-help@nongnu.org>.   liboath  home  page:
66       https://www.nongnu.org/oath-toolkit/  General  help using GNU software:
67       http://www.gnu.org/gethelp/
68
70       Copyright © 2009-2020 Simon Josefsson.
71       Copying and distribution of this file, with  or  without  modification,
72       are  permitted in any medium without royalty provided the copyright no‐
73       tice and this notice are preserved.
74
75
76
77liboath                              2.6.9               oath_totp_generate(3)
Impressum