diff --git a/src/core/config/OperationConfig.js b/src/core/config/OperationConfig.js index 56b6cca1..38dad80b 100755 --- a/src/core/config/OperationConfig.js +++ b/src/core/config/OperationConfig.js @@ -3840,7 +3840,7 @@ const OperationConfig = { "Generate HOTP": { module: "Default", description: "The HMAC-based One-Time Password algorithm (HOTP) is an algorithm that computes a one-time password from a shared secret key and an incrementing counter. It has been adopted as Internet Engineering Task Force standard RFC 4226, is the cornerstone of Initiative For Open Authentication (OATH), and is used in a number of two-factor authentication systems.

Enter the secret as the input or leave it blank for a random secret to be generated.", - inputType: "string", + inputType: "byteArray", outputType: "string", args: [ { diff --git a/src/core/operations/OTP.js b/src/core/operations/OTP.js index ff67d1c8..f7862310 100755 --- a/src/core/operations/OTP.js +++ b/src/core/operations/OTP.js @@ -1,6 +1,7 @@ import otp from "otp"; import Base64 from "./Base64.js"; + /** * One-Time Password operations. * diff --git a/test/index.js b/test/index.js index 9c7e3ca8..050acf0f 100644 --- a/test/index.js +++ b/test/index.js @@ -27,6 +27,7 @@ import "./tests/operations/MorseCode.js"; import "./tests/operations/MS.js"; import "./tests/operations/PHP.js"; import "./tests/operations/NetBIOS.js"; +import "./tests/operations/OTP.js"; import "./tests/operations/StrUtils.js"; import "./tests/operations/SeqUtils.js"; diff --git a/test/tests/operations/OTP.js b/test/tests/operations/OTP.js new file mode 100644 index 00000000..b321e7cf --- /dev/null +++ b/test/tests/operations/OTP.js @@ -0,0 +1,23 @@ +/** + * OTP HOTP tests. + * + * @author bwhitn [brian.m.whitney@outlook.com] + * + * @copyright Crown Copyright 2017 + * @license Apache-2.0 + */ +import TestRegister from "../../TestRegister.js"; + +TestRegister.addTests([ + { + name: "Generate HOTP", + input: "12345678901234567890", + expectedOutput: "URI: otpauth://hotp/OTPAuthentication?secret=GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ\n\nPassword: 755224", + recipeConfig: [ + { + op: "Generate HOTP", + args: ["", 32, 6, 0], + }, + ], + }, +]);