Skip to content

Commit

Permalink
feat(Core/Authserver): TOTP rewrite
Browse files Browse the repository at this point in the history
WarheadCore/Warhead@421164
  • Loading branch information
Winfidonarleyan committed May 5, 2021
1 parent 48a0c72 commit 419566b
Show file tree
Hide file tree
Showing 61 changed files with 6,049 additions and 211 deletions.
297 changes: 297 additions & 0 deletions data/sql/updates/pending_db_auth/rev_1620079951672711500.sql

Large diffs are not rendered by default.

32 changes: 32 additions & 0 deletions data/sql/updates/pending_db_world/rev_1620079973240388200.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1620079973240388200');

--
DELETE FROM `command` WHERE `name` LIKE 'account 2fa%';
DELETE FROM `command` WHERE `name`='account set 2fa';
INSERT INTO `command` (`name`, `security`, `help`) VALUES
('account 2fa', 0, 'Syntax: .account 2fa <setup/remove>'),
('account 2fa setup', 0, 'Syntax: .account 2fa setup
Sets up two-factor authentication for this account.'),
('account 2fa remove', 0, 'Syntax: .account 2fa remove <token>
Disables two-factor authentication for this account, if enabled.'),
('account set 2fa', 0, 'Syntax: .account set 2fa <account> <secret/off>
Provide a base32 encoded secret to setup two-factor authentication for the account.
Specify \'off\' to disable two-factor authentication for the account.');

DELETE FROM `acore_string` WHERE `entry` BETWEEN 87 AND 95;
DELETE FROM `acore_string` WHERE `entry` BETWEEN 188 AND 190;
INSERT INTO `acore_string` (`entry`,`content_default`) VALUES
(87, "UNKNOWN_ERROR"),
(88, "Two-factor authentication commands are not properly setup."),
(89, "Two-factor authentication is already enabled for this account."),
(90, "Invalid two-factor authentication token specified."),
(91, "In order to complete setup, you'll need to set up the device you'll be using as your second factor.
Your 2FA key: %s
Once you have set up your device, confirm by running .account 2fa setup <token> with the generated token."),
(92, "Two-factor authentication has been successfully set up."),
(93, "Two-factor authentication is not enabled for this account."),
(94, "To remove two-factor authentication, please specify a fresh two-factor token from your authentication device."),
(95, "Two-factor authentication has been successfully disabled."),
(188, "The provided two-factor authentication secret is too long."),
(189, "The provided two-factor authentication secret is not valid."),
(190, "Successfully enabled two-factor authentication for '%s' with the specified secret.");
1 change: 1 addition & 0 deletions deps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ if(SERVERS OR TOOLS)
add_subdirectory(SFMT)
add_subdirectory(utf8cpp)
add_subdirectory(openssl)
add_subdirectory(argon2)
endif()

if(SERVERS)
Expand Down
4 changes: 4 additions & 0 deletions deps/PackageList.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ ACE (ADAPTIVE Communication Environment)
http://www.cs.wustl.edu/~schmidt/ACE.html
Version: 6.1.4

argon2
https://github.com/P-H-C/phc-winner-argon2
Version: 62358ba

bzip2 (a freely available, patent free, high-quality data compressor)
http://www.bzip.org/
Version: 1.0.6
Expand Down
41 changes: 41 additions & 0 deletions deps/argon2/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# This file is part of the WarheadCore Project. See AUTHORS file for Copyright information
#
# This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

file(GLOB_RECURSE sources *.c)

if(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
list(REMOVE_ITEM sources
${CMAKE_CURRENT_SOURCE_DIR}/argon2/opt.c)
else()
list(REMOVE_ITEM sources
${CMAKE_CURRENT_SOURCE_DIR}/argon2/ref.c)
endif()

add_library(argon2 STATIC
${sources})

target_compile_definitions(argon2
PRIVATE
-DARGON2_NO_THREADS)

set_target_properties(argon2 PROPERTIES LINKER_LANGUAGE CXX)

target_include_directories(argon2
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR})

target_link_libraries(argon2
PRIVATE
acore-dependency-interface)

set_target_properties(argon2
PROPERTIES
FOLDER
"deps")
314 changes: 314 additions & 0 deletions deps/argon2/LICENSE

Large diffs are not rendered by default.

Loading

0 comments on commit 419566b

Please sign in to comment.