2014-04-29 12:26:51 +00:00
|
|
|
/*
|
2017-11-05 16:46:34 +00:00
|
|
|
* This file is part of the TREZOR project, https://trezor.io/
|
2014-04-29 12:26:51 +00:00
|
|
|
*
|
|
|
|
* Copyright (C) 2014 Pavol Rusnak <stick@satoshilabs.com>
|
|
|
|
*
|
|
|
|
* This library is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library 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 Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __STORAGE_H__
|
|
|
|
#define __STORAGE_H__
|
|
|
|
|
|
|
|
#include "types.pb.h"
|
|
|
|
#include "storage.pb.h"
|
|
|
|
#include "messages.pb.h"
|
|
|
|
#include "bip32.h"
|
|
|
|
|
2017-08-22 17:00:25 +00:00
|
|
|
extern Storage storageUpdate;
|
|
|
|
|
2014-04-29 12:26:51 +00:00
|
|
|
void storage_init(void);
|
2017-08-22 17:00:25 +00:00
|
|
|
void storage_generate_uuid(void);
|
|
|
|
void storage_clear_update(void);
|
|
|
|
void storage_update(void);
|
2015-03-31 14:31:29 +00:00
|
|
|
void session_clear(bool clear_pin);
|
2014-04-29 12:26:51 +00:00
|
|
|
|
|
|
|
void storage_loadDevice(LoadDevice *msg);
|
|
|
|
|
2016-05-19 23:49:20 +00:00
|
|
|
const uint8_t *storage_getSeed(bool usePassphrase);
|
2016-04-19 16:23:12 +00:00
|
|
|
|
2017-12-13 09:53:27 +00:00
|
|
|
bool storage_getU2FRoot(HDNode *node);
|
2016-05-19 23:49:20 +00:00
|
|
|
bool storage_getRootNode(HDNode *node, const char *curve, bool usePassphrase);
|
2014-04-29 12:26:51 +00:00
|
|
|
|
|
|
|
const char *storage_getLabel(void);
|
|
|
|
void storage_setLabel(const char *label);
|
|
|
|
|
|
|
|
const char *storage_getLanguage(void);
|
|
|
|
void storage_setLanguage(const char *lang);
|
|
|
|
|
2014-12-13 18:29:27 +00:00
|
|
|
void storage_setPassphraseProtection(bool passphrase_protection);
|
2017-08-22 07:17:05 +00:00
|
|
|
bool storage_hasPassphraseProtection(void);
|
2014-12-13 18:29:27 +00:00
|
|
|
|
2015-02-04 20:27:07 +00:00
|
|
|
const uint8_t *storage_getHomescreen(void);
|
|
|
|
void storage_setHomescreen(const uint8_t *data, uint32_t size);
|
|
|
|
|
2014-04-29 12:26:51 +00:00
|
|
|
void session_cachePassphrase(const char *passphrase);
|
|
|
|
bool session_isPassphraseCached(void);
|
|
|
|
|
2017-08-22 07:17:05 +00:00
|
|
|
void storage_setMnemonic(const char *mnemonic);
|
2017-06-26 13:44:01 +00:00
|
|
|
bool storage_containsMnemonic(const char *mnemonic);
|
2017-08-22 07:17:05 +00:00
|
|
|
bool storage_hasMnemonic(void);
|
|
|
|
const char *storage_getMnemonic(void);
|
|
|
|
|
|
|
|
bool storage_hasNode(void);
|
|
|
|
const HDNode *storage_getNode(void);
|
2017-06-26 13:44:01 +00:00
|
|
|
|
|
|
|
bool storage_containsPin(const char *pin);
|
2014-04-29 12:26:51 +00:00
|
|
|
bool storage_hasPin(void);
|
2017-08-22 07:17:05 +00:00
|
|
|
const char *storage_getPin(void);
|
2014-04-29 12:26:51 +00:00
|
|
|
void storage_setPin(const char *pin);
|
2015-02-22 14:19:13 +00:00
|
|
|
void session_cachePin(void);
|
2014-04-29 12:26:51 +00:00
|
|
|
bool session_isPinCached(void);
|
2016-05-20 15:00:10 +00:00
|
|
|
void storage_clearPinArea(void);
|
2016-04-27 16:12:03 +00:00
|
|
|
void storage_resetPinFails(uint32_t *pinfailptr);
|
|
|
|
bool storage_increasePinFails(uint32_t *pinfailptr);
|
|
|
|
uint32_t *storage_getPinFailsPtr(void);
|
2014-04-29 12:26:51 +00:00
|
|
|
|
2015-11-02 23:08:18 +00:00
|
|
|
uint32_t storage_nextU2FCounter(void);
|
2016-06-12 21:39:28 +00:00
|
|
|
void storage_setU2FCounter(uint32_t u2fcounter);
|
2015-11-02 23:08:18 +00:00
|
|
|
|
2014-04-29 12:26:51 +00:00
|
|
|
bool storage_isInitialized(void);
|
|
|
|
|
2017-08-22 07:17:05 +00:00
|
|
|
bool storage_isImported(void);
|
|
|
|
void storage_setImported(bool imported);
|
|
|
|
|
2017-06-26 17:45:12 +00:00
|
|
|
bool storage_needsBackup(void);
|
2017-08-22 07:17:05 +00:00
|
|
|
void storage_setNeedsBackup(bool needs_backup);
|
2017-06-26 17:45:12 +00:00
|
|
|
|
2017-07-17 16:36:09 +00:00
|
|
|
void storage_applyFlags(uint32_t flags);
|
|
|
|
uint32_t storage_getFlags(void);
|
|
|
|
|
2017-07-31 00:26:28 +00:00
|
|
|
void storage_wipe(void);
|
|
|
|
|
2014-04-29 12:26:51 +00:00
|
|
|
extern char storage_uuid_str[25];
|
|
|
|
|
|
|
|
#endif
|