|
CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
|
#include <PasswordModule.h>
Public Member Functions | |
| bool | init () override |
| Initializes module resources, translations, commands, and slot mapping. | |
| void | stop () override |
| Stops the password module and frees list resources. | |
| const char * | getVersion () const override |
| Returns the module version string. | |
| uint8_t | getMenuItems (core::ModuleMenuItem *items, uint8_t maxItems) override |
| Provides main-menu entry for password module UI. | |
| core::IModule::SlotRequest | getSlotRequest () const override |
| Declares slot requirements for password storage. | |
| void | setSlotRange (const core::IModule::SlotRange &range) override |
| Stores assigned Tropic slot range for this module. | |
| bool | exportBackup (cJSON *out) override |
| Exports all vault entries into the module's backup section. | |
| core::IModule::BackupResult | importBackup (const cJSON *in) override |
| Restores vault entries from the module's backup section. | |
| Public Member Functions inherited from cdc::core::ModuleBase | |
| ModuleBase (const char *name) | |
| Constructs a module base with the given module name. | |
| const char * | getName () const override |
| Returns the module name supplied to the constructor. | |
| ServiceState | getState () const override |
| Returns the current service state. | |
| bool | start () override |
| Default start() implementation performing the standard transition. | |
| Public Member Functions inherited from cdc::core::IModule | |
| virtual ui::IView * | getEntryView () |
| Returns the module's entry view (main view when selected from menu). | |
| virtual uint8_t | getLockScreenContextItems (LockScreenContextItem *items, uint8_t maxItems) |
| Returns the module's lock screen context menu items. | |
| virtual void | onUnlock () |
| Called when device is unlocked. | |
| virtual void | onLock () |
| Called when device is locked. | |
| virtual void | onUsbConnect () |
| Called when USB is connected. | |
| virtual void | onUsbDisconnect () |
| Called when USB is disconnected. | |
| virtual void | onTick (uint32_t nowMs) |
| Called periodically (optional tick for background work). | |
| Public Member Functions inherited from cdc::core::IService | |
| virtual | ~IService ()=default |
Static Public Member Functions | |
| static PasswordModule & | instance () |
| Returns singleton password module instance. | |
Additional Inherited Members | |
| Protected Attributes inherited from cdc::core::ModuleBase | |
| const char * | name_ = nullptr |
| ServiceState | state_ = ServiceState::UNINITIALIZED |
Definition at line 9 of file PasswordModule.h.
|
overridevirtual |
Exports all vault entries into the module's backup section.
Writes schema_ver and an entries array; each element carries the full set of stored fields. Passwords are stored in plaintext because the backup container itself is encrypted. Returns false when there are no entries.
| out | cJSON object that forms the module's section in the backup file. |
Reimplemented from cdc::core::IModule.
Definition at line 938 of file PasswordModule.cpp.
References cdc::core::TropicStorage::forEachSlot(), cdc::core::TropicStorage::instance(), cdc::mod_password::PasswordStore::instance(), cdc::mod_password::kSchemaVer, cdc::mod_password::PasswordEntry::notes, cdc::mod_password::PasswordEntry::password, cdc::mod_password::PasswordEntry::title, cdc::mod_password::PasswordEntry::totpSlot, cdc::mod_password::PasswordEntry::url, and cdc::mod_password::PasswordEntry::username.
|
overridevirtual |
Provides main-menu entry for password module UI.
| items | Output array for menu items. |
| maxItems | Maximum writable entries in items. |
Reimplemented from cdc::core::IModule.
Definition at line 905 of file PasswordModule.cpp.
References cdc::core::ModuleBase::getName(), cdc::mod_password::PasswordStore::instance(), cdc::core::MAIN_MENU, cdc::mod_password::onListMenu(), cdc::mod_password::onListSelect(), cdc::mod_password::rebuildList(), cdc::mod_password::s_listView, cdc::mod_password::s_viewsInitialized, cdc::ui::showToastError(), and cdc::ui::tr().
|
overridevirtual |
Declares slot requirements for password storage.
Reimplemented from cdc::core::IModule.
Definition at line 892 of file PasswordModule.cpp.
References cdc::core::ModuleBase::getName(), cdc::core::IModule::SlotRequest::mapName, and cdc::core::IModule::SlotRequest::minRmemSlots.
|
inlineoverridevirtual |
Returns the module version string.
Implements cdc::core::IModule.
Definition at line 14 of file PasswordModule.h.
|
overridevirtual |
Restores vault entries from the module's backup section.
Best-effort upsert by title; malformed or unstorable entries are skipped and counted, never aborting the restore.
| in | cJSON object holding the previously exported section. |
Reimplemented from cdc::core::IModule.
Definition at line 1047 of file PasswordModule.cpp.
References cdc::ui::importJsonArray(), cdc::mod_password::importPasswordEntry(), cdc::mod_password::PasswordStore::instance(), cdc::mod_password::kSchemaVer, LOG_W, and TAG.
|
overridevirtual |
Initializes module resources, translations, commands, and slot mapping.
Implements cdc::core::IService.
Definition at line 854 of file PasswordModule.cpp.
References cdc::core::ModuleRegistry::clearModuleErrorByName(), cdc::core::ERROR, cdc::core::ModuleBase::getName(), cdc::core::INITIALIZED, cdc::core::ModuleRegistry::instance(), cdc::mod_password::PasswordStore::instance(), LOG_I, cdc::mod_password::registerCommands(), cdc::core::ModuleRegistry::registerModule(), cdc::mod_password::registerStrings(), cdc::core::ModuleRegistry::reportModuleError(), cdc::mod_password::PasswordStore::setSlotRange(), cdc::core::ModuleBase::state_, and TAG.
|
static |
Returns singleton password module instance.
Definition at line 845 of file PasswordModule.cpp.
Referenced by cdc::mod_password::rebuildList().
|
overridevirtual |
Stores assigned Tropic slot range for this module.
| range | Slot assignment provided by registry. |
Reimplemented from cdc::core::IModule.
Definition at line 884 of file PasswordModule.cpp.
|
overridevirtual |
Stops the password module and frees list resources.
Reimplemented from cdc::core::ModuleBase.
Definition at line 875 of file PasswordModule.cpp.
References cdc::mod_password::freeListBuffers().