本文整理汇总了C++中ABC_CHECK函数的典型用法代码示例。如果您正苦于以下问题:C++ ABC_CHECK函数的具体用法?C++ ABC_CHECK怎么用?C++ ABC_CHECK使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ABC_CHECK函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: loginServerUpdatePinPackage
Status
loginServerUpdatePinPackage(const Login &login,
DataSlice DID, DataSlice LPIN1, const std::string &pinPackage,
time_t ali)
{
const auto url = ABC_SERVER_ROOT "/account/pinpackage/update";
// format the ali
char szALI[DATETIME_LENGTH];
strftime(szALI, DATETIME_LENGTH, "%Y-%m-%dT%H:%M:%S", gmtime(&ali));
// Encode those:
JsonPtr json(json_pack("{ss, ss, ss, ss, ss, ss}",
ABC_SERVER_JSON_L1_FIELD, base64Encode(login.lobby.authId()).c_str(),
ABC_SERVER_JSON_LP1_FIELD, base64Encode(login.authKey()).c_str(),
ABC_SERVER_JSON_DID_FIELD, base64Encode(DID).c_str(),
ABC_SERVER_JSON_LPIN1_FIELD, base64Encode(LPIN1).c_str(),
JSON_ACCT_PIN_PACKAGE, pinPackage.c_str(),
ABC_SERVER_JSON_ALI_FIELD, szALI));
HttpReply reply;
ABC_CHECK(AirbitzRequest().post(reply, url, json.encode()));
ServerReplyJson replyJson;
ABC_CHECK(replyJson.decode(reply.body));
ABC_CHECK(replyJson.ok());
return Status();
}
开发者ID:MoeAfilal,项目名称:airbitz-core,代码行数:28,代码来源:LoginServer.cpp
示例2: ABC_CHECK
Status
ServerRequestJson::setup(const Login &login)
{
ABC_CHECK(setup(login.store));
ABC_CHECK(passwordAuthSet(base64Encode(login.passwordAuth())));
return Status();
}
开发者ID:Airbitz,项目名称:airbitz-core,代码行数:7,代码来源:LoginServer.cpp
示例3: ABC_CHECK
Status
ServerRequestJson::setup(const Login &login)
{
ABC_CHECK(setup(login.lobby));
ABC_CHECK(authKeySet(base64Encode(login.authKey())));
return Status();
}
开发者ID:MoeAfilal,项目名称:airbitz-core,代码行数:7,代码来源:LoginServer.cpp
示例4: ABC_CHECK
Status
JsonBox::decrypt(DataChunk &result, DataSlice key)
{
DataChunk nonce;
ABC_CHECK(nonceOk());
ABC_CHECK(base16Decode(nonce, this->nonce()));
DataChunk cyphertext;
ABC_CHECK(cyphertextOk());
ABC_CHECK(base64Decode(cyphertext, this->cyphertext()));
switch (type())
{
case AES256_CBC_AIRBITZ:
{
ABC_CHECK_OLD(ABC_CryptoDecryptAES256Package(result,
cyphertext, key, nonce,
&error));
return Status();
}
default:
return ABC_ERROR(ABC_CC_DecryptError, "Unknown encryption type");
}
}
开发者ID:Airbitz,项目名称:airbitz-core,代码行数:25,代码来源:JsonBox.cpp
示例5: loginServerGetPinPackage
Status
loginServerGetPinPackage(DataSlice DID, DataSlice LPIN1, std::string &result,
AuthError &authError)
{
const auto url = ABC_SERVER_ROOT "/v1/account/pinpackage/get";
ServerRequestJson json;
ABC_CHECK(json.set(ABC_SERVER_JSON_DID_FIELD, base64Encode(DID)));
ABC_CHECK(json.set(ABC_SERVER_JSON_LPIN1_FIELD, base64Encode(LPIN1)));
HttpReply reply;
ABC_CHECK(AirbitzRequest().post(reply, url, json.encode()));
ServerReplyJson replyJson;
ABC_CHECK(replyJson.decode(reply, &authError));
struct ResultJson:
public JsonObject
{
ABC_JSON_CONSTRUCTORS(ResultJson, JsonObject)
ABC_JSON_STRING(package, "pin_package", nullptr)
} resultJson(replyJson.results());
ABC_CHECK(resultJson.packageOk());
result = resultJson.package();
return Status();
}
开发者ID:Airbitz,项目名称:airbitz-core,代码行数:25,代码来源:LoginServer.cpp
示例6: loginServerChangePassword
Status
loginServerChangePassword(const Login &login,
DataSlice newLP1, DataSlice newLRA1,
const CarePackage &carePackage, const LoginPackage &loginPackage)
{
const auto url = ABC_SERVER_ROOT "/account/password/update";
JsonPtr json(json_pack("{ss, ss, ss, ss, ss}",
ABC_SERVER_JSON_L1_FIELD, base64Encode(login.lobby.authId()).c_str(),
ABC_SERVER_JSON_LP1_FIELD, base64Encode(login.authKey()).c_str(),
ABC_SERVER_JSON_NEW_LP1_FIELD, base64Encode(newLP1).c_str(),
ABC_SERVER_JSON_CARE_PACKAGE_FIELD, carePackage.encode().c_str(),
ABC_SERVER_JSON_LOGIN_PACKAGE_FIELD, loginPackage.encode().c_str()));
if (newLRA1.size())
{
json_object_set_new(json.get(), ABC_SERVER_JSON_NEW_LRA1_FIELD,
json_string(base64Encode(newLRA1).c_str()));
}
HttpReply reply;
ABC_CHECK(AirbitzRequest().post(reply, url, json.encode()));
ServerReplyJson replyJson;
ABC_CHECK(replyJson.decode(reply.body));
ABC_CHECK(replyJson.ok());
return Status();
}
开发者ID:MoeAfilal,项目名称:airbitz-core,代码行数:26,代码来源:LoginServer.cpp
示例7: loginServerOtpStatus
Status
loginServerOtpStatus(const Login &login, bool &on, long &timeout)
{
const auto url = ABC_SERVER_ROOT "/v1/otp/status";
ServerRequestJson json;
ABC_CHECK(json.setup(login));
HttpReply reply;
ABC_CHECK(AirbitzRequest().post(reply, url, json.encode()));
ServerReplyJson replyJson;
ABC_CHECK(replyJson.decode(reply));
struct ResultJson:
public JsonObject
{
ABC_JSON_CONSTRUCTORS(ResultJson, JsonObject)
ABC_JSON_BOOLEAN(on, "on", false)
ABC_JSON_INTEGER(timeout, "otp_timeout", 0)
} resultJson(replyJson.results());
on = resultJson.on();
if (on)
{
ABC_CHECK(resultJson.timeoutOk());
timeout = resultJson.timeout();
}
return Status();
}
开发者ID:Airbitz,项目名称:airbitz-core,代码行数:28,代码来源:LoginServer.cpp
示例8: accountCategoriesRemove
Status
accountCategoriesRemove(const Account &account, const std::string &category)
{
AccountCategories categories;
ABC_CHECK(accountCategoriesLoad(categories, account));
categories.erase(category);
ABC_CHECK(accountCategoriesSave(account, categories));
return Status();
}
开发者ID:codeaudit,项目名称:airbitz-core,代码行数:9,代码来源:AccountCategories.cpp
示例9: ABC_CHECK
Status
Account::load()
{
// If the sync dir doesn't exist, create it:
ABC_CHECK(syncEnsureRepo(dir(), login.lobby.dir() + "tmp/", login.syncKey()));
ABC_CHECK(wallets.load());
return Status();
}
开发者ID:BitcoinKinetics,项目名称:airbitz-core,代码行数:9,代码来源:Account.cpp
示例10: ABC_CHECK
Status
Login::loadOffline()
{
ABC_CHECK(store.paths(paths, true));
LoginPackage loginPackage;
ABC_CHECK(loginPackage.load(paths.loginPackagePath()));
ABC_CHECK(loginPackage.passwordAuthBox().decrypt(passwordAuth_, dataKey_));
// Look for an existing rootKeyBox:
JsonBox rootKeyBox;
if (fileExists(paths.rootKeyPath()))
{
ABC_CHECK(rootKeyBox.load(paths.rootKeyPath()));
}
else
{
// Try asking the server:
AuthJson authJson;
LoginReplyJson loginJson;
ABC_CHECK(authJson.loginSet(*this));
ABC_CHECK(loginServerLogin(loginJson, authJson));
ABC_CHECK(loginJson.save(*this));
rootKeyBox = loginJson.rootKeyBox();
}
// Otherwise, there just isn't one.
// Extract the rootKey:
if (rootKeyBox.ok())
ABC_CHECK(rootKeyBox.decrypt(rootKey_, dataKey_));
else
ABC_CHECK(rootKeyUpgrade());
return Status();
}
开发者ID:Airbitz,项目名称:airbitz-core,代码行数:35,代码来源:Login.cpp
示例11: loginServerPasswordSet
Status
loginServerPasswordSet(AuthJson authJson,
DataSlice passwordAuth,
JsonPtr passwordKeySnrp,
JsonPtr passwordBox,
JsonPtr passwordAuthBox)
{
const auto url = ABC_SERVER_ROOT "/v2/login/password";
JsonSnrp passwordAuthSnrp;
ABC_CHECK(passwordAuthSnrp.snrpSet(usernameSnrp()));
JsonObject dataJson;
ABC_CHECK(dataJson.set("passwordAuth", base64Encode(passwordAuth)));
ABC_CHECK(dataJson.set("passwordAuthSnrp", passwordAuthSnrp));
ABC_CHECK(dataJson.set("passwordKeySnrp", passwordKeySnrp));
ABC_CHECK(dataJson.set("passwordBox", passwordBox));
ABC_CHECK(dataJson.set("passwordAuthBox", passwordAuthBox));
ABC_CHECK(authJson.set("data", dataJson));
HttpReply reply;
ABC_CHECK(AirbitzRequest().request(reply, url, "PUT", authJson.encode()));
ServerReplyJson replyJson;
ABC_CHECK(replyJson.decode(reply));
return Status();
}
开发者ID:Airbitz,项目名称:airbitz-core,代码行数:27,代码来源:LoginServer.cpp
示例12: watcherSave
Status
watcherSave(Wallet &self)
{
Watcher *watcher = nullptr;
ABC_CHECK(watcherFind(watcher, self));
auto data = watcher->serialize();;
ABC_CHECK(fileSave(data, watcherPath(self)));
return Status();
}
开发者ID:TSchnaars,项目名称:airbitz-core,代码行数:11,代码来源:WatcherBridge.cpp
示例13: ABC_CHECK
Status
Wallet::createNew(std::shared_ptr<Wallet> &result, Account &account,
const std::string &name, int currency)
{
std::string id;
ABC_CHECK(randomUuid(id));
std::shared_ptr<Wallet> out(new Wallet(account, id));
ABC_CHECK(out->createNew(name, currency));
result = std::move(out);
return Status();
}
开发者ID:MoeAfilal,项目名称:airbitz-core,代码行数:12,代码来源:Wallet.cpp
示例14: lock
Status
Wallet::nameSet(const std::string &name)
{
std::lock_guard<std::mutex> lock(mutex_);
name_ = name;
NameJson json;
ABC_CHECK(json.nameSet(name));
ABC_CHECK(json.save(syncDir() + WALLET_NAME_FILENAME, dataKey()));
return Status();
}
开发者ID:MoeAfilal,项目名称:airbitz-core,代码行数:12,代码来源:Wallet.cpp
示例15: loginServerRecovery2Delete
Status
loginServerRecovery2Delete(AuthJson authJson)
{
const auto url = ABC_SERVER_ROOT "/v2/login/recovery2";
HttpReply reply;
ABC_CHECK(AirbitzRequest().request(reply, url, "DELETE", authJson.encode()));
ServerReplyJson replyJson;
ABC_CHECK(replyJson.decode(reply));
return Status();
}
开发者ID:Airbitz,项目名称:airbitz-core,代码行数:12,代码来源:LoginServer.cpp
示例16: loginServerOtpPending
Status
loginServerOtpPending(std::list<DataChunk> users, std::list<bool> &isPending)
{
const auto url = ABC_SERVER_ROOT "/v1/otp/pending/check";
std::string param;
std::map<std::string, bool> userMap;
std::list<std::string> usersEncoded;
for (const auto &u : users)
{
std::string username = base64Encode(u);
param += (username + ",");
userMap[username] = false;
usersEncoded.push_back(username);
}
JsonObject json;
ABC_CHECK(json.set("l1s", param));
HttpReply reply;
ABC_CHECK(AirbitzRequest().post(reply, url, json.encode()));
ServerReplyJson replyJson;
ABC_CHECK(replyJson.decode(reply));
JsonArray arrayJson = replyJson.results();
size_t size = arrayJson.size();
for (size_t i = 0; i < size; i++)
{
json_t *pJSON_Row = arrayJson[i].get();
if (!pJSON_Row || !json_is_object(pJSON_Row))
return ABC_ERROR(ABC_CC_JSONError, "Error parsing JSON array element object");
json_t *pJSON_Value = json_object_get(pJSON_Row, "login");
if (!pJSON_Value || !json_is_string(pJSON_Value))
return ABC_ERROR(ABC_CC_JSONError, "Error otp/pending/login JSON");
std::string username(json_string_value(pJSON_Value));
pJSON_Value = json_object_get(pJSON_Row, ABC_SERVER_JSON_OTP_PENDING);
if (!pJSON_Value || !json_is_boolean(pJSON_Value))
return ABC_ERROR(ABC_CC_JSONError, "Error otp/pending/pending JSON");
if (json_is_true(pJSON_Value))
{
userMap[username] = json_is_true(pJSON_Value);
}
}
isPending.clear();
for (auto &username: usersEncoded)
{
isPending.push_back(userMap[username]);
}
return Status();
}
开发者ID:Airbitz,项目名称:airbitz-core,代码行数:52,代码来源:LoginServer.cpp
示例17: watcherLoad
static Status
watcherLoad(Wallet &self)
{
Watcher *watcher = nullptr;
ABC_CHECK(watcherFind(watcher, self));
DataChunk data;
ABC_CHECK(fileLoad(data, watcherPath(self)));
if (!watcher->load(data))
return ABC_ERROR(ABC_CC_Error, "Unable to load serialized watcher");
return Status();
}
开发者ID:TSchnaars,项目名称:airbitz-core,代码行数:13,代码来源:WatcherBridge.cpp
示例18: loginServerGetQuestions
Status
loginServerGetQuestions(JsonPtr &result)
{
const auto url = ABC_SERVER_ROOT "/v1/questions";
HttpReply reply;
ABC_CHECK(AirbitzRequest().post(reply, url));
ServerReplyJson replyJson;
ABC_CHECK(replyJson.decode(reply));
result = replyJson.results();
return Status();
}
开发者ID:Airbitz,项目名称:airbitz-core,代码行数:13,代码来源:LoginServer.cpp
示例19: loginServerLobbyGet
Status
loginServerLobbyGet(JsonPtr &result, const std::string &id)
{
const auto url = ABC_SERVER_ROOT "/v2/lobby/" + id;
HttpReply reply;
ABC_CHECK(AirbitzRequest().get(reply, url));
ServerReplyJson replyJson;
ABC_CHECK(replyJson.decode(reply));
result = replyJson.results();
return Status();
}
开发者ID:Airbitz,项目名称:airbitz-core,代码行数:13,代码来源:LoginServer.cpp
示例20: ABC_CHECK_OLD
Status
JsonBox::encrypt(DataSlice data, DataSlice key)
{
DataChunk nonce;
AutoU08Buf cyphertext;
ABC_CHECK_OLD(ABC_CryptoEncryptAES256Package(data, key,
&cyphertext, nonce, &error));
ABC_CHECK(typeSet(AES256_CBC_AIRBITZ));
ABC_CHECK(nonceSet(base16Encode(nonce)));
ABC_CHECK(cyphertextSet(base64Encode(cyphertext)));
return Status();
}
开发者ID:Airbitz,项目名称:airbitz-core,代码行数:14,代码来源:JsonBox.cpp
注:本文中的ABC_CHECK函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论