Skip to content

Commit

Permalink
Merge pull request #132 from feather-wallet/OTS
Browse files Browse the repository at this point in the history
Airgapped signing with UR
  • Loading branch information
tobtoht authored Dec 4, 2023
2 parents 33035a2 + 51b0fcc commit 1471234
Show file tree
Hide file tree
Showing 80 changed files with 3,943 additions and 624 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ message(STATUS "libsodium: libraries at ${SODIUM_LIBRARY}")
# QrEncode
find_package(QREncode REQUIRED)

# bc-ur
find_path(BCUR_INCLUDE_DIR "bcur/bc-ur.hpp")
find_library(BCUR_LIBRARY bcur)
message(STATUS "bcur: libraries at ${BCUR_INCLUDE_DIR}")

# Polyseed
find_package(Polyseed REQUIRED)
if(Polyseed_SUBMODULE)
Expand Down
6 changes: 5 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ endif()
if (WITH_SCANNER)
file(GLOB QRCODE_UTILS_FILES
"qrcode/utils/*.h"
"qrcode/utils/*.cpp")
"qrcode/utils/*.cpp"
"wizard/offline_tx_signing/*.h"
"wizard/offline_tx_signing/*.cpp")
endif()

if (WITH_SCANNER)
Expand Down Expand Up @@ -152,6 +154,7 @@ target_include_directories(feather PUBLIC
${LIBZIP_INCLUDE_DIRS}
${ZLIB_INCLUDE_DIRS}
${POLYSEED_INCLUDE_DIR}
${BCUR_INCLUDE_DIR}
)

if(WITH_SCANNER)
Expand Down Expand Up @@ -257,6 +260,7 @@ target_link_libraries(feather
${ICU_LIBRARIES}
${LIBZIP_LIBRARIES}
${ZLIB_LIBRARIES}
${BCUR_LIBRARY}
)

if(CHECK_UPDATES)
Expand Down
27 changes: 26 additions & 1 deletion src/CoinsWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
#include "utils/Icons.h"
#include "utils/Utils.h"

#ifdef WITH_SCANNER
#include "wizard/offline_tx_signing/OfflineTxSigningWizard.h"
#endif

CoinsWidget::CoinsWidget(Wallet *wallet, QWidget *parent)
: QWidget(parent)
, ui(new Ui::CoinsWidget)
Expand Down Expand Up @@ -186,7 +190,14 @@ void CoinsWidget::spendSelected() {

QStringList keyimages;
for (QModelIndex index: list) {
keyimages << m_model->entryFromIndex(m_proxyModel->mapToSource(index))->keyImage();
QString keyImage = m_model->entryFromIndex(m_proxyModel->mapToSource(index))->keyImage();

if (keyImage == "0100000000000000000000000000000000000000000000000000000000000000") {
Utils::showError(this, "Unable to select output to spend", "Selected output has unknown key image");
return;
}

keyimages << keyImage;
}

m_wallet->setSelectedInputs(keyimages);
Expand Down Expand Up @@ -238,6 +249,20 @@ void CoinsWidget::onSweepOutputs() {
int ret = dialog.exec();
if (!ret) return;

if (m_wallet->keyImageSyncNeeded(totalAmount, false)) {
#if defined(WITH_SCANNER)
OfflineTxSigningWizard wizard(this, m_wallet);
auto r = wizard.exec();

if (r == QDialog::Rejected) {
return;
}
#else
Utils::showError(this, "Can't open offline transaction signing wizard", "Feather was built without webcam QR scanner support");
return;
#endif
}

m_wallet->sweepOutputs(keyImages, dialog.address(), dialog.churn(), dialog.outputs());
}

Expand Down
Loading

0 comments on commit 1471234

Please sign in to comment.