This commit is contained in:
keita
2021-02-18 11:38:41 +09:00
parent e45fc37c12
commit 998dcfb9a7
6 changed files with 14 additions and 14 deletions
+8 -8
View File
@@ -3,13 +3,13 @@
#include <fstream>
#include <string>
namespace CocoaTweet::OAuth{
Key Key::fromJsonFile(const std::string _jsonFile){
std::ifstream ifs(_jsonFile);
std::string str((std::istreambuf_iterator<char>(ifs)), std::istreambuf_iterator<char>());
namespace CocoaTweet::OAuth {
Key Key::fromJsonFile(const std::string _jsonFile) {
std::ifstream ifs(_jsonFile);
std::string str((std::istreambuf_iterator<char>(ifs)), std::istreambuf_iterator<char>());
auto j = nlohmann::json::parse(str);
return Key(j["consumer_key"], j["consumer_secret"], j["access_token"], j["access_token_secret"]);
}
auto j = nlohmann::json::parse(str);
return Key(j["consumer_key"], j["consumer_secret"], j["access_token"],
j["access_token_secret"]);
}
} // namespace CocoaTweet::OAuth
+1 -1
View File
@@ -39,7 +39,7 @@ public:
{"oauth_token", accessTokenSecret_}};
}
static Key fromJsonFile(const std::string _jsonFile);
static Key fromJsonFile(const std::string _jsonFile);
};
} // namespace CocoaTweet::OAuth
+1 -2
View File
@@ -42,8 +42,7 @@ std::map<std::string, std::string> OAuth1::signature(
std::cout << "significate base : " << significateBase << std::endl;
std::cout << "hmac-sha1 : " << k64Sha1 << std::endl;
auto ret = std::map<std::string, std::string>{
{"oauth_signature", k64Sha1}};
auto ret = std::map<std::string, std::string>{{"oauth_signature", k64Sha1}};
return ret;
}