65 lines
1.7 KiB
C++
65 lines
1.7 KiB
C++
/*
|
|
* This file is part of the Flowee project
|
|
* Copyright (C) 2025 Tom Zander <tom@flowee.org>
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
#ifndef SEEDSBACKUP_H
|
|
#define SEEDSBACKUP_H
|
|
|
|
#include "Wallet.h"
|
|
#include <vector>
|
|
#include <QList>
|
|
|
|
class SeedsBackup
|
|
{
|
|
public:
|
|
explicit SeedsBackup(const std::shared_ptr<Wallet> &wallet);
|
|
|
|
static SeedsBackup *fromData(const Streaming::ConstBuffer &data);
|
|
|
|
struct Path {
|
|
QString path;
|
|
QString name;
|
|
int startingHeight = 0;
|
|
};
|
|
|
|
/**
|
|
* Generates the actual seed words again from the data.
|
|
* Notice that this requires the used dictionary to be
|
|
* installed. This method throws if it is not found.
|
|
*/
|
|
QString generateSeedPhrase() const;
|
|
|
|
/**
|
|
* Serialize the seeds to the standard format of CHIP-2023-wallet offline backup
|
|
*/
|
|
Streaming::ConstBuffer toBuffer() const;
|
|
|
|
|
|
const QList<Path>& paths() const;
|
|
|
|
QString name() const;
|
|
|
|
protected:
|
|
SeedsBackup();
|
|
|
|
QString m_name;
|
|
QList<Path> m_paths;
|
|
std::vector<uint8_t> m_seed;
|
|
int m_language = 0;
|
|
};
|
|
|
|
#endif
|