Skip to content

Commit

Permalink
Merge branch 'release/5.0' of github.com:AntelopeIO/leap into gh_1878
Browse files Browse the repository at this point in the history
  • Loading branch information
greg7mdp committed Nov 13, 2023
2 parents f7c449f + 87e4db2 commit dc55e30
Show file tree
Hide file tree
Showing 9 changed files with 199 additions and 447 deletions.
4 changes: 2 additions & 2 deletions libraries/chain/include/eosio/chain/database_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ namespace fc {

inline
void from_variant( const variant& v, eosio::chain::shared_blob& b ) {
std::string _s = base64_decode(v.as_string());
b = eosio::chain::shared_blob(_s.begin(), _s.end(), b.get_allocator());
std::vector<char> b64 = base64_decode(v.as_string());
b = eosio::chain::shared_blob(b64.begin(), b64.end(), b.get_allocator());
}

template<typename T>
Expand Down
9 changes: 5 additions & 4 deletions libraries/libfc/include/fc/crypto/base64.hpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#pragma once
#include <string>
#include <string_view>
#include <vector>

namespace fc {
std::string base64_encode(unsigned char const* bytes_to_encode, unsigned int in_len);
inline std::string base64_encode(char const* bytes_to_encode, unsigned int in_len) { return base64_encode( (unsigned char const*)bytes_to_encode, in_len); }
std::string base64_encode( const std::string_view& enc );
std::string base64_decode( const std::string_view& encoded_string);
std::string base64_encode( const std::string& enc );
std::vector<char> base64_decode( std::string_view encoded_string);

std::string base64url_encode(unsigned char const* bytes_to_encode, unsigned int in_len);
inline std::string base64url_encode(char const* bytes_to_encode, unsigned int in_len) { return base64url_encode( (unsigned char const*)bytes_to_encode, in_len); }
std::string base64url_encode( const std::string_view& enc );
std::string base64url_decode( const std::string_view& encoded_string);
std::string base64url_encode( const std::string& enc );
std::vector<char> base64url_decode( std::string_view encoded_string);
} // namespace fc
Loading

0 comments on commit dc55e30

Please sign in to comment.