AGTotp Class Reference
Inherits from | AGOtp : NSObject |
Declared in | AGTotp.h AGTotp.m |
Overview
The Totp class generates a one-time password (OTP) using the Time-based One-time Password Algorithm described in: http://tools.ietf.org/html/draft-mraihi-totp-timebased
Basically, we define TOTP as TOTP = HOTP(K, T) where T is an integer and represents the number of time steps between the initial counter time T0 and the current Unix time (i.e. the number of seconds elapsed since midnight UTC of January 1, 1970).
More specifically T = (Current Unix time – T0) / X where:
X represents the time step in seconds (default value X = 30 seconds) and is a system parameter;
T0 is the Unix time to start counting time steps (default value is 0, Unix epoch) and is also a system parameter.
Tasks
Other Methods
-
– initWithSecret:
Returns an AGTotp object initialized with a secret specified by the given string.
-
– now
Generate an TOTP token using the current time.
-
– now:
Generate an TOTP token using the specified AGClock.
Other Methods
-
– generateOTP
Entry point to generate an OTP token.
Instance Methods
generateOTP
Entry point to generate an OTP token.
- (NSString *)generateOTP
Return Value
An NSString that contains the token with leading zero-padding as required.
Discussion
Entry point to generate an OTP token.
NOTE: Subclasses should override this method.
Declared In
AGOtp.h
initWithSecret:
Returns an AGTotp object initialized with a secret specified by the given string.
- (id)initWithSecret:(NSData *)secret
Parameters
- secret
The secret to use.
Return Value
An AGTotp object initialized by the specified secret.
Discussion
Returns an AGTotp object initialized with a secret specified by the given string.
Declared In
AGTotp.h
now
Generate an TOTP token using the current time.
- (NSString *)now
Return Value
An NSString that contains the token with leading zero-padding as required.
Discussion
Generate an TOTP token using the current time.
Declared In
AGTotp.h
now:
Generate an TOTP token using the specified AGClock.
- (NSString *)now:(AGClock *)clock
Parameters
- clock
The AGClock object to use.
Return Value
An NSString that contains the token with leading zero-padding as required.
Discussion
Generate an TOTP token using the specified AGClock.
Declared In
AGTotp.h