forked from UkoeHB/monero
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wallet2_basic: robust compat lib for loading/storing legacy wallets […
…SERAPHIS] This library has no dependency on wallet2.h and gives us a way forward to move away from `wallet2` in the (not-so-distant) future, while still supporting conversions of old wallet files. This lib is also useful if you have an application where you want to extract information directly from the wallet file with or without having to setup accounts and devices. This is now possible because I have split the wallet keys loading into two steps: `load_from_memory` and `setup_account_and_devices`. When one is loading a wallet keys file, the user of the API can choose whether or not to contact external devices during this process with use of the flag `allow_external_devices_setup`. Reorganized for `seraphis_lib`.
- Loading branch information
Showing
18 changed files
with
3,006 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// Copyright (c) 2023, The Monero Project | ||
// | ||
// All rights reserved. | ||
// | ||
// Redistribution and use in source and binary forms, with or without modification, are | ||
// permitted provided that the following conditions are met: | ||
// | ||
// 1. Redistributions of source code must retain the above copyright notice, this list of | ||
// conditions and the following disclaimer. | ||
// | ||
// 2. Redistributions in binary form must reproduce the above copyright notice, this list | ||
// of conditions and the following disclaimer in the documentation and/or other | ||
// materials provided with the distribution. | ||
// | ||
// 3. Neither the name of the copyright holder nor the names of its contributors may be | ||
// used to endorse or promote products derived from this software without specific | ||
// prior written permission. | ||
// | ||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY | ||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL | ||
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | ||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF | ||
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
// | ||
|
||
#pragma once | ||
|
||
#include <boost/config.hpp> | ||
#include <boost/archive/portable_binary_iarchive.hpp> | ||
#include <boost/archive/detail/polymorphic_iarchive_route.hpp> | ||
|
||
namespace boost | ||
{ | ||
namespace archive | ||
{ | ||
class polymorphic_portable_binary_iarchive : | ||
public detail::polymorphic_iarchive_route<portable_binary_iarchive> | ||
{ | ||
public: | ||
polymorphic_portable_binary_iarchive(std::istream & is, unsigned int flags = 0) : | ||
detail::polymorphic_iarchive_route<portable_binary_iarchive>(is, flags) | ||
{} | ||
~polymorphic_portable_binary_iarchive() {} | ||
}; | ||
|
||
} // namespace archive | ||
} // namespace boost | ||
|
||
// required by export | ||
BOOST_SERIALIZATION_REGISTER_ARCHIVE( | ||
boost::archive::polymorphic_portable_binary_iarchive | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// Copyright (c) 2023, The Monero Project | ||
// | ||
// All rights reserved. | ||
// | ||
// Redistribution and use in source and binary forms, with or without modification, are | ||
// permitted provided that the following conditions are met: | ||
// | ||
// 1. Redistributions of source code must retain the above copyright notice, this list of | ||
// conditions and the following disclaimer. | ||
// | ||
// 2. Redistributions in binary form must reproduce the above copyright notice, this list | ||
// of conditions and the following disclaimer in the documentation and/or other | ||
// materials provided with the distribution. | ||
// | ||
// 3. Neither the name of the copyright holder nor the names of its contributors may be | ||
// used to endorse or promote products derived from this software without specific | ||
// prior written permission. | ||
// | ||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY | ||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL | ||
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | ||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF | ||
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
// | ||
|
||
#pragma once | ||
|
||
#include <boost/config.hpp> | ||
#include <boost/archive/portable_binary_oarchive.hpp> | ||
#include <boost/archive/detail/polymorphic_oarchive_route.hpp> | ||
|
||
namespace boost | ||
{ | ||
namespace archive | ||
{ | ||
class polymorphic_portable_binary_oarchive : | ||
public detail::polymorphic_oarchive_route<portable_binary_oarchive> | ||
{ | ||
public: | ||
polymorphic_portable_binary_oarchive(std::ostream & os, unsigned int flags = 0) : | ||
detail::polymorphic_oarchive_route<portable_binary_oarchive>(os, flags) | ||
{} | ||
~polymorphic_portable_binary_oarchive() {} | ||
}; | ||
|
||
} // namespace archive | ||
} // namespace boost | ||
|
||
// required by export | ||
BOOST_SERIALIZATION_REGISTER_ARCHIVE( | ||
boost::archive::polymorphic_portable_binary_oarchive | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -104,3 +104,4 @@ if(NOT IOS) | |
endif() | ||
|
||
add_subdirectory(api) | ||
add_subdirectory(wallet2_basic) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# Copyright (c) 2023, The Monero Project | ||
# | ||
# All rights reserved. | ||
# | ||
# Redistribution and use in source and binary forms, with or without modification, are | ||
# permitted provided that the following conditions are met: | ||
# | ||
# 1. Redistributions of source code must retain the above copyright notice, this list of | ||
# conditions and the following disclaimer. | ||
# | ||
# 2. Redistributions in binary form must reproduce the above copyright notice, this list | ||
# of conditions and the following disclaimer in the documentation and/or other | ||
# materials provided with the distribution. | ||
# | ||
# 3. Neither the name of the copyright holder nor the names of its contributors may be | ||
# used to endorse or promote products derived from this software without specific | ||
# prior written permission. | ||
# | ||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY | ||
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL | ||
# THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | ||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF | ||
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) | ||
|
||
set(wallet2_basic_sources | ||
wallet2_boost_serialization.cpp | ||
wallet2_storage.cpp | ||
) | ||
|
||
set(wallet2_basic_headers | ||
wallet2_constants.h | ||
wallet2_storage.h | ||
wallet2_types.h | ||
) | ||
|
||
set(wallet2_basic_private_headers | ||
) | ||
|
||
monero_private_headers(wallet2_basic | ||
${wallet2_basic_private_headers}) | ||
monero_add_library(wallet2_basic | ||
${wallet2_basic_sources} | ||
${wallet2_basic_headers} | ||
${wallet2_basic_private_headers}) | ||
target_link_libraries(wallet2_basic | ||
PUBLIC | ||
common | ||
cryptonote_core | ||
device_trezor | ||
${Boost_LOCALE_LIBRARY} | ||
${ICU_LIBRARIES} | ||
${Boost_SERIALIZATION_LIBRARY} | ||
${Boost_FILESYSTEM_LIBRARY} | ||
${Boost_SYSTEM_LIBRARY} | ||
${OPENSSL_LIBRARIES} | ||
PRIVATE | ||
${EXTRA_LIBRARIES}) | ||
|
||
set_property(TARGET wallet2_basic PROPERTY EXCLUDE_FROM_ALL TRUE) | ||
|
||
if(IOS) | ||
set(lib_folder lib-${ARCH}) | ||
else() | ||
set(lib_folder lib) | ||
endif() | ||
|
||
install(FILES ${wallet2_basic_headers} | ||
DESTINATION include/wallet/wallet2_basic) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright (c) 2023, The Monero Project | ||
// | ||
// All rights reserved. | ||
// | ||
// Redistribution and use in source and binary forms, with or without modification, are | ||
// permitted provided that the following conditions are met: | ||
// | ||
// 1. Redistributions of source code must retain the above copyright notice, this list of | ||
// conditions and the following disclaimer. | ||
// | ||
// 2. Redistributions in binary form must reproduce the above copyright notice, this list | ||
// of conditions and the following disclaimer in the documentation and/or other | ||
// materials provided with the distribution. | ||
// | ||
// 3. Neither the name of the copyright holder nor the names of its contributors may be | ||
// used to endorse or promote products derived from this software without specific | ||
// prior written permission. | ||
// | ||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY | ||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL | ||
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | ||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF | ||
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
||
#include "wallet2_boost_serialization.h" | ||
|
||
BOOST_CLASS_EXPORT_IMPLEMENT(::wallet2_basic::hashchain) | ||
BOOST_CLASS_EXPORT_IMPLEMENT(::wallet2_basic::transfer_details) | ||
BOOST_CLASS_EXPORT_IMPLEMENT(::wallet2_basic::multisig_info) | ||
BOOST_CLASS_EXPORT_IMPLEMENT(::wallet2_basic::unconfirmed_transfer_details) | ||
BOOST_CLASS_EXPORT_IMPLEMENT(::wallet2_basic::confirmed_transfer_details) | ||
BOOST_CLASS_EXPORT_IMPLEMENT(::wallet2_basic::payment_details) | ||
BOOST_CLASS_EXPORT_IMPLEMENT(::wallet2_basic::pool_payment_details) | ||
BOOST_CLASS_EXPORT_IMPLEMENT(::wallet2_basic::address_book_row) | ||
BOOST_CLASS_EXPORT_IMPLEMENT(::wallet2_basic::cache) |
Oops, something went wrong.