]> git.lizzy.rs Git - dragonfireclient.git/blob - src/util/auth.h
Add function to get server info.
[dragonfireclient.git] / src / util / auth.h
1 /*
2 Minetest
3 Copyright (C) 2015, 2016 est31 <MTest31@outlook.com>
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20 #ifndef AUTH_H
21 #define AUTH_H
22
23 /// Gets the base64 encoded legacy password db entry.
24 std::string translate_password(const std::string &name,
25         const std::string &password);
26
27 /// Creates a verification key with given salt and password.
28 std::string generate_srp_verifier(const std::string &name,
29         const std::string &password, const std::string &salt);
30
31 /// Creates a verification key and salt with given password.
32 void generate_srp_verifier_and_salt(const std::string &name,
33         const std::string &password, std::string *verifier,
34         std::string *salt);
35
36 /// Gets an SRP verifier, generating a salt,
37 /// and encodes it as DB-ready string.
38 std::string get_encoded_srp_verifier(const std::string &name,
39         const std::string &password);
40
41 /// Converts the passed SRP verifier into a DB-ready format.
42 std::string encode_srp_verifier(const std::string &verifier,
43         const std::string &salt);
44
45 /// Reads the DB-formatted SRP verifier and gets the verifier
46 /// and salt components.
47 bool decode_srp_verifier_and_salt(const std::string &encoded,
48         std::string *verifier, std::string *salt);
49
50 #endif