HOTP Class
Properties Methods Events Config Settings Errors
The HOTP class allows creation of HMAC-Based One-Time passwords.
Syntax
ipworksauth.hotp()
Remarks
The HOTP class implements the HOTP algorithm defined in RFC 4226 (HMAC-Based One-Time Password). These types of passwords are commonly used as a second factor of authentication in multi-factor authentication scenarios.
To begin specify the shared secret in the Secret property.
Next, you may set Counter. If this property is not set, the class will use a default value.
To create the password call CreatePassword. The Password property will be populated with the new password.
To validate a password set the Password property and call ValidatePassword. The method will return True or False to indicate success or failure.
Property List
The following is the full list of the properties of the class with short descriptions. Click on the links for further details.
Counter | The counter used for HMAC-Based One Time Password creation or validation. |
Password | The HMAC-Based One Time Password. |
Secret | The Base32 encoded shared secret used when creating and validating a password. |
Method List
The following is the full list of the methods of the class with short descriptions. Click on the links for further details.
Config | Sets or retrieves a configuration setting. |
CreatePassword | Creates a HMAC-Based One Time Password. |
Reset | Reset the variables to default value. |
ValidatePassword | Validates a HMAC-Based One Time Password. |
Event List
The following is the full list of the events fired by the class with short descriptions. Click on the links for further details.
Error | Information about errors during data delivery. |
Config Settings
The following is a list of config settings for the class with short descriptions. Click on the links for further details.
HashAlgorithm | The hash algorithm used to sign the password. |
PasswordLength | The length of the generated password. |
SecretLength | The length of secret to generate. |
BuildInfo | Information about the product's build. |
CodePage | The system code page used for Unicode to Multibyte translations. |
LicenseInfo | Information about the current license. |
MaskSensitive | Whether sensitive data is masked in log messages. |
UseInternalSecurityAPI | Tells the class whether or not to use the system security libraries or an internal implementation. |
HOTP.Counter Property
The counter used for HMAC-Based One Time Password creation or validation.
Syntax
getCounter(): number; setCounter(counter: number): void;
Default Value
0
Remarks
This property holds the counter value used for HMAC-Based One Time Password creation or validation. This value must be specified before calling CreatePassword or ValidatePassword. The value should be incremented each time a password is created.
The default value is 0.
HOTP.Password Property
The HMAC-Based One Time Password.
Syntax
getPassword(): string; setPassword(password: string): void;
Default Value
""
Remarks
This property holds the HMAC-Based One Time Password. This property is populated after calling CreatePassword. This property must be set before calling ValidatePassword.
HOTP.Secret Property
The Base32 encoded shared secret used when creating and validating a password.
Syntax
getSecret(): string; setSecret(secret: string): void;
Default Value
""
Remarks
This property specifies the Base32 encoded shared secret used when creating and validating a password. This should be set before calling CreatePassword or ValidatePassword.
If this is not set before calling CreatePassword a random secret will be automatically generated. This functionality provides an easy way to create new secret values. The length of the secret is defined by SecretLength.
HOTP.config Method
Sets or retrieves a configuration setting.
Syntax
async hotp.config(configurationString : string): Promise<string>
Remarks
Config is a generic method available in every class. It is used to set and retrieve configuration settings for the class.
These settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the class, access to these internal properties is provided through the Config method.
To set a configuration setting named PROPERTY, you must call Config("PROPERTY=VALUE"), where VALUE is the value of the setting expressed as a string. For boolean values, use the strings "True", "False", "0", "1", "Yes", or "No" (case does not matter).
To read (query) the value of a configuration setting, you must call Config("PROPERTY"). The value will be returned as a string.
HOTP.createPassword Method
Creates a HMAC-Based One Time Password.
Syntax
async hotp.createPassword(): Promise<void>
Remarks
This method creates a HMAC-Based One Time Password.
The following properties are applicable when calling CreatePassword.
Calling CreatePassword populates the Password property with the created password.
If Secret is not specified before calling this method a random secret will be automatically generated.
HOTP.reset Method
Reset the variables to default value.
Syntax
async hotp.reset(): Promise<void>
Remarks
This method will reset the variables to default value.
HOTP.validatePassword Method
Validates a HMAC-Based One Time Password.
Syntax
async hotp.validatePassword(): Promise<boolean>
Remarks
This method validates a HMAC-Based One Time Password.
The following properties are applicable when calling ValidatePassword.
The method will return True if the password is validated, False otherwise.
HOTP.Error Event
Information about errors during data delivery.
Syntax
hotp.on('Error', listener: (e: {readonly errorCode: number, readonly description: string}) => void )
Remarks
The Error event is fired in case of exceptional conditions during message processing. Normally the class .
ErrorCode contains an error code and Description contains a textual description of the error. For a list of valid error codes and their descriptions, please refer to the Error Codes section.
Config Settings (class ipworksauth.hotp)
The class accepts one or more of the following configuration settings. Configuration settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the class, access to these internal properties is provided through the Config method.HOTP Config Settings | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
HashAlgorithm:
The hash algorithm used to sign the password.This setting specifies the hash algorithm used to sign the password. Possible values are:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
PasswordLength:
The length of the generated password.This setting specifies the length of the generated password. Possible values are:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
SecretLength: The length of secret to generate.When Secret is empty and CreatePassword is called a random secret value will be generated. This setting determines the length of the randomly generated secret. The default value is 32. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Base Config Settings | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
BuildInfo: Information about the product's build.When queried, this setting will return a string containing information about the product's build. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
CodePage:
The system code page used for Unicode to Multibyte translations.The default code page is Unicode UTF-8 (65001).
The following is a list of valid code page identifiers:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
LicenseInfo:
Information about the current license.When queried, this setting will return a string containing information about the license this instance of a class is using. It will return the following information:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
MaskSensitive:
Whether sensitive data is masked in log messages.In certain circumstances it may be beneficial to mask sensitive data, like passwords, in log messages. Set this to true to mask sensitive data. The default is false.
This setting only works on these classes: AS3Receiver, AS3Sender, Atom, Client(3DS), FTP, FTPServer, IMAP, OFTPClient, SSHClient, SCP, Server(3DS), Sexec, SFTP, SFTPServer, SSHServer, TCPClient, TCPServer. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
UseInternalSecurityAPI:
Tells the class whether or not to use the system security libraries or an internal implementation.
When set to false, the class will use the system security libraries by default to perform cryptographic functions where applicable.
Setting this setting to true tells the class to use the internal implementation instead of using the system security libraries. This setting is set to false by default on all platforms. |
Trappable Errors (class ipworksauth.hotp)
HOTP Errors
114 Can't create password. | |
115 Can't validate password. |