|
CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
|
#include <PasswordStore.h>
Classes | |
| struct | EntryIndex |
Public Member Functions | |
| bool | readEntry (uint16_t slot, PasswordEntry *out) const |
| Reads one password entry from secure-element storage. | |
| bool | addEntry (const PasswordEntry &entry) |
| Adds a new password entry into first free slot. | |
| bool | updateEntry (uint16_t slot, const PasswordEntry &entry) |
| Updates existing password entry. | |
| bool | deleteEntry (uint16_t slot) |
| Deletes entry at logical slot index. | |
| bool | listEntriesSorted (EntryIndex *entries, uint16_t maxEntries, uint16_t *countOut) const |
| Lists entries sorted alphabetically by title. | |
| bool | findFreeLogicalSlot (uint16_t *logicalSlotOut) const |
| Finds first free logical slot in this module's range. | |
| bool | findByTitle (const char *title, uint16_t *logicalSlotOut) const |
| Finds the logical slot of an entry with a matching title. | |
| void | setSlotRange (const cdc::core::IModule::SlotRange &range) |
| Configures logical-to-physical slot mapping for password entries. | |
| uint16_t | capacity () const |
| bool | toPhysicalSlot (uint16_t logicalIndex, uint16_t *slotOut) const |
| bool | toLogicalSlot (uint16_t slot, uint16_t *logicalIndexOut) const |
| bool | hasSlotRange () const |
| uint8_t | moduleId () const |
| uint16_t | rmemStart () const |
| uint16_t | rmemEnd () const |
Static Public Member Functions | |
| static PasswordStore & | instance () |
| Returns singleton password store instance. | |
Static Public Attributes | |
| static constexpr uint8_t | TITLE_LEN = PASSWORD_TITLE_LEN |
| static constexpr uint8_t | USERNAME_LEN = PASSWORD_USERNAME_LEN |
| static constexpr uint8_t | PASSWORD_LEN = PASSWORD_PASSWORD_LEN |
| static constexpr uint8_t | URL_LEN = PASSWORD_URL_LEN |
| static constexpr uint8_t | TOTP_SLOT_NONE = 0xFF |
| static constexpr size_t | PAYLOAD_MAX = PASSWORD_PAYLOAD_MAX |
| static constexpr size_t | FIXED_PAYLOAD = PASSWORD_FIXED_PAYLOAD |
| static constexpr size_t | NOTES_LEN = PASSWORD_NOTES_LEN |
Definition at line 32 of file PasswordStore.h.
| bool cdc::mod_password::PasswordStore::addEntry | ( | const PasswordEntry & | entry | ) |
Adds a new password entry into first free slot.
| entry | Entry data. |
Definition at line 110 of file PasswordStore.cpp.
References cdc::mod_password::copyText(), cdc::hal::getSecureElementInstance(), cdc::core::TropicStorage::instance(), LOG_E, LOG_W, cdc::mod_password::PasswordEntry::notes, cdc::mod_password::PasswordPayload::notes, cdc::hal::OK, cdc::mod_password::PasswordEntry::password, cdc::mod_password::PasswordPayload::password, cdc::hal::ISecureElement::RMEM_NAME_LEN, TAG, cdc::mod_password::PasswordEntry::title, cdc::mod_password::PasswordPayload::title, cdc::mod_password::PasswordEntry::totpSlot, cdc::mod_password::PasswordPayload::totpSlot, cdc::mod_password::PasswordEntry::url, cdc::mod_password::PasswordPayload::url, cdc::mod_password::PasswordEntry::username, cdc::mod_password::PasswordPayload::username, and cdc::core::TropicStorage::writeSlot().
Referenced by cdc::mod_password::wizardFinish().
|
inline |
Definition at line 61 of file PasswordStore.h.
Referenced by cdc::mod_password::ensureListBuffers().
| bool cdc::mod_password::PasswordStore::deleteEntry | ( | uint16_t | slot | ) |
Deletes entry at logical slot index.
| slot | Logical slot index. |
Definition at line 210 of file PasswordStore.cpp.
References cdc::core::TropicStorage::eraseSlot(), cdc::hal::getSecureElementInstance(), cdc::core::TropicStorage::instance(), cdc::hal::OK, and toPhysicalSlot().
Referenced by cdc::mod_password::cmd_password_del(), and cdc::mod_password::onMenuDeleteConfirm().
| bool cdc::mod_password::PasswordStore::findByTitle | ( | const char * | title, |
| uint16_t * | logicalSlotOut ) const |
Finds the logical slot of an entry with a matching title.
Title is the entry's natural identity (it is the secure-element header name). Comparison is case-insensitive to match the list ordering.
| title | Title to look up. |
| logicalSlotOut | Output logical slot index of the first match. |
Definition at line 298 of file PasswordStore.cpp.
References cdc::core::TropicStorage::forEachSlot(), cdc::core::TropicStorage::instance(), instance(), and toLogicalSlot().
| bool cdc::mod_password::PasswordStore::findFreeLogicalSlot | ( | uint16_t * | logicalSlotOut | ) | const |
Finds first free logical slot in this module's range.
| logicalSlotOut | Output logical slot index. |
Definition at line 333 of file PasswordStore.cpp.
References toLogicalSlot().
|
inline |
Definition at line 68 of file PasswordStore.h.
|
static |
Returns singleton password store instance.
Definition at line 47 of file PasswordStore.cpp.
Referenced by cdc::mod_password::cmd_password_add(), cdc::mod_password::cmd_password_del(), cdc::mod_password::cmd_password_edit(), cdc::mod_password::cmd_password_get(), cdc::mod_password::cmd_password_list(), cdc::mod_password::ensureListBuffers(), cdc::mod_password::PasswordModule::exportBackup(), findByTitle(), cdc::mod_password::PasswordModule::getMenuItems(), cdc::mod_password::PasswordModule::importBackup(), cdc::mod_password::importPasswordEntry(), cdc::mod_password::PasswordModule::init(), cdc::mod_password::isValidSlot(), listEntriesSorted(), cdc::mod_password::onMenuDeleteConfirm(), cdc::mod_password::rebuildList(), cdc::mod_password::showDetails(), cdc::mod_password::wizardEdit(), and cdc::mod_password::wizardFinish().
| bool cdc::mod_password::PasswordStore::listEntriesSorted | ( | EntryIndex * | entries, |
| uint16_t | maxEntries, | ||
| uint16_t * | countOut ) const |
Lists entries sorted alphabetically by title.
| entries | Output entry index array. |
| maxEntries | Maximum writable entries. |
| countOut | Output number of entries. |
Definition at line 253 of file PasswordStore.cpp.
References cdc::mod_password::copyText(), cdc::core::TropicStorage::forEachSlot(), cdc::core::TropicStorage::instance(), instance(), cdc::mod_password::PasswordStore::EntryIndex::title, and toLogicalSlot().
Referenced by cdc::mod_password::rebuildList().
|
inline |
Definition at line 69 of file PasswordStore.h.
| bool cdc::mod_password::PasswordStore::readEntry | ( | uint16_t | slot, |
| PasswordEntry * | out ) const |
Reads one password entry from secure-element storage.
| slot | Logical slot index. |
| out | Output entry. |
Definition at line 66 of file PasswordStore.cpp.
References cdc::mod_password::copyText(), cdc::hal::getSecureElementInstance(), cdc::mod_password::PasswordEntry::notes, cdc::mod_password::PasswordPayload::notes, cdc::hal::OK, cdc::mod_password::PasswordEntry::password, cdc::mod_password::PasswordPayload::password, cdc::mod_password::PasswordEntry::title, cdc::mod_password::PasswordPayload::title, toPhysicalSlot(), cdc::mod_password::PasswordEntry::totpSlot, cdc::mod_password::PasswordPayload::totpSlot, cdc::mod_password::PasswordEntry::url, cdc::mod_password::PasswordPayload::url, cdc::mod_password::PasswordEntry::username, and cdc::mod_password::PasswordPayload::username.
|
inline |
Definition at line 71 of file PasswordStore.h.
|
inline |
Definition at line 70 of file PasswordStore.h.
| void cdc::mod_password::PasswordStore::setSlotRange | ( | const cdc::core::IModule::SlotRange & | range | ) |
Configures logical-to-physical slot mapping for password entries.
| range | Slot range descriptor (RMEM fields are consumed). |
Definition at line 56 of file PasswordStore.cpp.
References setSlotRange().
Referenced by cdc::mod_password::PasswordModule::init(), and setSlotRange().
|
inline |
Definition at line 65 of file PasswordStore.h.
Referenced by findByTitle(), findFreeLogicalSlot(), and listEntriesSorted().
|
inline |
Definition at line 62 of file PasswordStore.h.
Referenced by deleteEntry(), readEntry(), and updateEntry().
| bool cdc::mod_password::PasswordStore::updateEntry | ( | uint16_t | slot, |
| const PasswordEntry & | entry ) |
Updates existing password entry.
| slot | Logical slot index. |
| entry | New entry data. |
Definition at line 163 of file PasswordStore.cpp.
References cdc::mod_password::copyText(), cdc::hal::getSecureElementInstance(), cdc::core::TropicStorage::instance(), LOG_E, cdc::mod_password::PasswordEntry::notes, cdc::mod_password::PasswordPayload::notes, cdc::hal::OK, cdc::mod_password::PasswordEntry::password, cdc::mod_password::PasswordPayload::password, cdc::hal::ISecureElement::RMEM_NAME_LEN, TAG, cdc::mod_password::PasswordEntry::title, cdc::mod_password::PasswordPayload::title, toPhysicalSlot(), cdc::mod_password::PasswordEntry::totpSlot, cdc::mod_password::PasswordPayload::totpSlot, cdc::mod_password::PasswordEntry::url, cdc::mod_password::PasswordPayload::url, cdc::mod_password::PasswordEntry::username, cdc::mod_password::PasswordPayload::username, and cdc::core::TropicStorage::writeSlot().
Referenced by cdc::mod_password::cmd_password_edit(), and cdc::mod_password::wizardFinish().
|
staticconstexpr |
Definition at line 41 of file PasswordStore.h.
|
staticconstexpr |
Definition at line 42 of file PasswordStore.h.
Referenced by cdc::mod_password::cmd_password_edit().
|
staticconstexpr |
Definition at line 36 of file PasswordStore.h.
Referenced by cdc::mod_password::cmd_password_add(), cdc::mod_password::cmd_password_edit(), and cdc::mod_password::onWizardUsername().
|
staticconstexpr |
Definition at line 40 of file PasswordStore.h.
|
staticconstexpr |
Definition at line 34 of file PasswordStore.h.
Referenced by cdc::mod_password::cmd_password_add(), cdc::mod_password::cmd_password_edit(), cdc::mod_password::wizardEdit(), and cdc::mod_password::wizardStart().
|
staticconstexpr |
Definition at line 38 of file PasswordStore.h.
Referenced by cdc::mod_password::cmd_password_add(), cdc::mod_password::cmd_password_get(), cdc::mod_password::importPasswordEntry(), cdc::mod_password::onWizardTotp(), cdc::mod_password::onWizardUrl(), cdc::mod_password::showDetails(), and cdc::mod_password::wizardStart().
|
staticconstexpr |
Definition at line 37 of file PasswordStore.h.
Referenced by cdc::mod_password::cmd_password_add(), cdc::mod_password::cmd_password_edit(), and cdc::mod_password::onWizardPassword().
|
staticconstexpr |
Definition at line 35 of file PasswordStore.h.
Referenced by cdc::mod_password::cmd_password_add(), cdc::mod_password::cmd_password_edit(), and cdc::mod_password::onWizardTitle().