X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Futil%2Fauth.h;h=ba827f3225aaf5a10edf47de0a2870bf778d8a55;hb=e8fd1ce62331146fae0e98ce4a94d3720f308abf;hp=36d8c20a49721e2f88e68c3a43a1d3fbf0d0281a;hpb=82e35edff52d88dcd64a9bfc9d2c4c93f1341b78;p=oweals%2Fminetest.git diff --git a/src/util/auth.h b/src/util/auth.h index 36d8c20a4..ba827f322 100644 --- a/src/util/auth.h +++ b/src/util/auth.h @@ -1,6 +1,6 @@ /* Minetest -Copyright (C) 2015 est31 +Copyright (C) 2015, 2016 est31 This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -17,21 +17,31 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef AUTH_H -#define AUTH_H +#pragma once -std::string translatePassword(const std::string &name, +/// Gets the base64 encoded legacy password db entry. +std::string translate_password(const std::string &name, const std::string &password); -void getSRPVerifier(const std::string &name, - const std::string &password, char **salt, size_t *salt_len, - char **bytes_v, size_t *len_v); -std::string getSRPVerifier(const std::string &name, - const std::string &password); -std::string getSRPVerifier(const std::string &name, + +/// Creates a verification key with given salt and password. +std::string generate_srp_verifier(const std::string &name, const std::string &password, const std::string &salt); -std::string encodeSRPVerifier(const std::string &verifier, + +/// Creates a verification key and salt with given password. +void generate_srp_verifier_and_salt(const std::string &name, + const std::string &password, std::string *verifier, + std::string *salt); + +/// Gets an SRP verifier, generating a salt, +/// and encodes it as DB-ready string. +std::string get_encoded_srp_verifier(const std::string &name, + const std::string &password); + +/// Converts the passed SRP verifier into a DB-ready format. +std::string encode_srp_verifier(const std::string &verifier, const std::string &salt); -bool decodeSRPVerifier(const std::string &enc_pwd, - std::string *salt, std::string *bytes_v); -#endif \ No newline at end of file +/// Reads the DB-formatted SRP verifier and gets the verifier +/// and salt components. +bool decode_srp_verifier_and_salt(const std::string &encoded, + std::string *verifier, std::string *salt);