本文整理汇总了C++中Lobby::username方法的典型用法代码示例。如果您正苦于以下问题:C++ Lobby::username方法的具体用法?C++ Lobby::username怎么用?C++ Lobby::username使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lobby
的用法示例。
在下文中一共展示了Lobby::username方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Status
Status
loginRecovery(std::shared_ptr<Login> &result,
Lobby &lobby, const std::string &recoveryAnswers,
AuthError &authError)
{
std::string LRA = lobby.username() + recoveryAnswers;
// Get the CarePackage:
CarePackage carePackage;
ABC_CHECK(loginServerGetCarePackage(lobby, carePackage));
// Make recoveryAuthKey (unlocks the server):
DataChunk recoveryAuthKey;
ABC_CHECK(usernameSnrp().hash(recoveryAuthKey, LRA));
// Get the LoginPackage:
LoginPackage loginPackage;
JsonPtr rootKeyBox;
ABC_CHECK(loginServerGetLoginPackage(lobby, U08Buf(), recoveryAuthKey,
loginPackage, rootKeyBox,
authError));
// Make recoveryKey (unlocks dataKey):
DataChunk recoveryKey;
ABC_CHECK(carePackage.snrp3().hash(recoveryKey, LRA));
// Decrypt dataKey (unlocks the account):
DataChunk dataKey;
ABC_CHECK(loginPackage.recoveryBox().decrypt(dataKey, recoveryKey));
// Create the Login object:
std::shared_ptr<Login> out;
ABC_CHECK(Login::create(out, lobby, dataKey,
loginPackage, rootKeyBox, false));
// Set up the on-disk login:
ABC_CHECK(carePackage.save(out->paths.carePackagePath()));
ABC_CHECK(loginPackage.save(out->paths.loginPackagePath()));
result = std::move(out);
return Status();
}
示例2: ABC_ERROR
Status
loginRecoveryQuestions(std::string &result, Lobby &lobby)
{
// Load CarePackage:
CarePackage carePackage;
ABC_CHECK(loginServerGetCarePackage(lobby, carePackage));
// Verify that the questions exist:
if (!carePackage.questionBox())
return ABC_ERROR(ABC_CC_NoRecoveryQuestions, "No recovery questions");
// Create questionKey (unlocks questions):
DataChunk questionKey;
ABC_CHECK(carePackage.snrp4().hash(questionKey, lobby.username()));
// Decrypt:
DataChunk questions;
ABC_CHECK(carePackage.questionBox().decrypt(questions, questionKey));
result = toString(questions);
return Status();
}