Migrate from GitHub

This commit is contained in:
floriano committed 2026-08-31 12:20:27 +02:00
commit 7333327f87
97 files changed
+8272

No files matched your search

+112
View File
@@ -0,0 +1,112 @@
#pragma once
#include <Arduino.h>
#include <KeyboardHIDCodes.h>
struct keymap {
uint8_t usage_id;
bool shift;
};
const keymap ascii_to_hid[128] = {
{0, false}, // 00 NUL
{0, false}, // 01 SOH
{0, false}, // 02 STX
{0, false}, // 03 ETX
{0, false}, // 04 EOT
{0, false}, // 05 ENQ
{0, false}, // 06 ACK
{0, false}, // 07 BEL
{KEY_BACKSPACE, false},// 08 BS (Backspace)
{KEY_TAB, false}, // 09 TAB (Tab)
{KEY_ENTER, false}, // 10 LF (Line Feed / Enter)
{0, false}, // 11 VT
{0, false}, // 12 FF
{KEY_ENTER, false}, // 13 CR (Carriage Return)
{0, false}, // 14 SO
{0, false}, // 15 SI
{0, false}, // 16 DLE
{0, false}, // 17 DC1
{0, false}, // 18 DC2
{0, false}, // 19 DC3
{0, false}, // 20 DC4
{0, false}, // 21 NAK
{0, false}, // 22 SYN
{0, false}, // 23 ETB
{0, false}, // 24 CAN
{0, false}, // 25 EM
{0, false}, // 26 SUB
{KEY_ESC, false}, // 27 ESC (Escape)
{0, false}, // 28 FS
{0, false}, // 29 GS
{0, false}, // 30 RS
{0, false}, // 31 US
// Printable Characters 32-64
{KEY_SPACE, false}, // 32 Space
{KEY_1, true}, // 33 !
{KEY_APOSTROPHE, true}, // 34 "
{KEY_3, true}, // 35 #
{KEY_4, true}, // 36 $
{KEY_5, true}, // 37 %
{KEY_7, true}, // 38 &
{KEY_APOSTROPHE, false}, // 39 '
{KEY_9, true}, // 40 (
{KEY_0, true}, // 41 )
{KEY_8, true}, // 42 *
{KEY_EQUAL, true}, // 43 +
{KEY_COMMA, false}, // 44 ,
{KEY_MINUS, false}, // 45 -
{KEY_DOT, false}, // 46 .
{KEY_SLASH, false}, // 47 /
{KEY_0, false}, // 48 0
{KEY_1, false}, // 49 1
{KEY_2, false}, // 50 2
{KEY_3, false}, // 51 3
{KEY_4, false}, // 52 4
{KEY_5, false}, // 53 5
{KEY_6, false}, // 54 6
{KEY_7, false}, // 55 7
{KEY_8, false}, // 56 8
{KEY_9, false}, // 57 9
{KEY_SEMICOLON, true}, // 58 :
{KEY_SEMICOLON, false}, // 59 ;
{KEY_COMMA, true}, // 60 <
{KEY_EQUAL, false}, // 61 =
{KEY_DOT, true}, // 62 >
{KEY_SLASH, true}, // 63 ?
{KEY_2, true}, // 64 @
// Uppercase Letters 65-90
{KEY_A, true}, {KEY_B, true}, {KEY_C, true}, {KEY_D, true},
{KEY_E, true}, {KEY_F, true}, {KEY_G, true}, {KEY_H, true},
{KEY_I, true}, {KEY_J, true}, {KEY_K, true}, {KEY_L, true},
{KEY_M, true}, {KEY_N, true}, {KEY_O, true}, {KEY_P, true},
{KEY_Q, true}, {KEY_R, true}, {KEY_S, true}, {KEY_T, true},
{KEY_U, true}, {KEY_V, true}, {KEY_W, true}, {KEY_X, true},
{KEY_Y, true}, {KEY_Z, true},
// Symbols 91-96
{KEY_LEFTBRACE, false}, // 91 [
{KEY_BACKSLASH, false}, // 92 \ //
{KEY_RIGHTBRACE, false}, // 93 ]
{KEY_6, true}, // 94 ^
{KEY_MINUS, true}, // 95 _
{KEY_GRAVE, false}, // 96 `
// Lowercase Letters 97-122
{KEY_A, false}, {KEY_B, false}, {KEY_C, false}, {KEY_D, false},
{KEY_E, false}, {KEY_F, false}, {KEY_G, false}, {KEY_H, false},
{KEY_I, false}, {KEY_J, false}, {KEY_K, false}, {KEY_L, false},
{KEY_M, false}, {KEY_N, false}, {KEY_O, false}, {KEY_P, false},
{KEY_Q, false}, {KEY_R, false}, {KEY_S, false}, {KEY_T, false},
{KEY_U, false}, {KEY_V, false}, {KEY_W, false}, {KEY_X, false},
{KEY_Y, false}, {KEY_Z, false},
// Symbols 123-127
{KEY_LEFTBRACE, true}, // 123 {
{KEY_BACKSLASH, true}, // 124 |
{KEY_RIGHTBRACE, true}, // 125 }
{KEY_GRAVE, true}, // 126 ~
{KEY_DELETE, false} // 127 DEL
};
+2
View File
@@ -0,0 +1,2 @@
void init_new_vault();
void export_vault();
+46
View File
@@ -0,0 +1,46 @@
#pragma once
// Device libraries
#include <M5Cardputer.h>
#include <M5GFX.h>
#include <SD.h>
#include <SPI.h>
#include <USB.h>
#include <WiFi.h>
// Software libraries
#include "TOTP.h"
#include <Arduino.h>
#include <Base32-Decode.h>
#include <NTPClient.h>
#include <Unit_RTC.h>
#include <pvault.h>
#include <cstdlib>
#include <time.h>
// Language
#define lang_en
// #define lang_pl
#include "ui_strings.h"
// SD support definitions
#define SD_CS_PIN 12
#define SD_MOSI_PIN 14
#define SD_MISO_PIN 39
#define SD_CLK_PIN 40
// File paths
#define VAULT_PATH "/pwder.pvault"
#define IMPORT_FILE_PATH "/pwimport"
#define EXPORT_FILE_PATH "/pwexport"
// default configuration values
#define DEFAULT_PASSWORD "default"
#define DEFAULT_SSID "sample"
#define DEFAULT_WIFI_PASSWORD "password"
#define DEFAULT_SYNCHOST "192.168.1.100"
#define DEFAULT_SYNCPORT "7305"
// UI definitions
#define UI_UPDATE_MILISECONDS 3000
#define MODE3_PAGES_NUMBER 8
+186
View File
@@ -0,0 +1,186 @@
#pragma once
#include <M5GFX.h>
namespace pwder_style {
struct color_scheme {
String name;
int background_color;
int foreground_color;
int border_color;
int statusbar_color;
int background_text_color;
int foreground_text_color;
};
struct icon32 {
const uint8_t bitmap[3072];
const bool mask[1024];
};
}
// spoiler alert
const String motd[32] PROGMEM = {
"Papa Whiskey Delta echo romeo",
"Don't give 'em the SSH keys!",
"username: admin, password: admin",
"Can a Cardputer run Forza Horizon?",
"Pow-There!",
"2+2=5, trust me bro",
"Corny sunglasses, not gonna lie",
"100% NO AI",
"What is the definition of insanity?",
"Click here to add text",
"Password must be 8.5 characters long",
"I'm sorry if it crashed",
"sudo touch grass",
"Now works with smart fridges",
"PWDer Holy-C port, anyone?",
"Manager, yet all passwords the same",
"At least one person uses it",
"I dare you to beatbox right now",
"You picked the wrong Cardputer, fool",
"encrypted = encrypt(decrypted);",
"Hello Reddit!",
"This line of text is called MOTD",
"Make sure nobody's looking!",
"Linux users when viewing file: ^._.^",
"sudo rm -rf /",
"PWDer in Germany: Der PWDer",
"Don't lose it!",
"ssh $USER@localhost",
"I got a card, I got a puter...",
"Also try geo-tp's Password Manager",
"This is not Windows 95",
"Probably doesn't beat Touch ID",
};
const int color_schemes_number = 7;
const pwder_style::color_scheme pwcolors[7] PROGMEM = {
{
.name = "Classic",
.background_color = NAVY,
.foreground_color = LIGHTGREY,
.border_color = DARKGREY,
.statusbar_color = PURPLE,
.background_text_color = WHITE,
.foreground_text_color = BLACK
},
{
.name = "Classic Dark",
.background_color = NAVY,
.foreground_color = DARKGREY,
.border_color = LIGHTGREY,
.statusbar_color = PURPLE,
.background_text_color = WHITE,
.foreground_text_color = WHITE
},
{
.name = "Industrial",
.background_color = LIGHTGREY,
.foreground_color = WHITE,
.border_color = DARKGREY,
.statusbar_color = BLACK,
.background_text_color = BLACK,
.foreground_text_color = BLACK
},
{
.name = "Sky",
.background_color = SKYBLUE,
.foreground_color = WHITE,
.border_color = LIGHTGREY,
.statusbar_color = YELLOW,
.background_text_color = BLACK,
.foreground_text_color = BLACK
},
{
.name = "Garden",
.background_color = GREEN,
.foreground_color = WHITE,
.border_color = LIGHTGREY,
.statusbar_color = SKYBLUE,
.background_text_color = BLACK,
.foreground_text_color = BLACK
},
{
.name = "Elegance",
.background_color = PURPLE,
.foreground_color = LIGHTGREY,
.border_color = WHITE,
.statusbar_color = DARKGREY,
.background_text_color = WHITE,
.foreground_text_color = BLACK
},
{
.name = "L33t H4xx0r",
.background_color = BLACK,
.foreground_color = BLACK,
.border_color = DARKGREEN,
.statusbar_color = GREEN,
.background_text_color = GREEN,
.foreground_text_color = GREEN
}
};
#pragma pack(push, 1)
struct bmp_header {
// bmp file
uint16_t bf_type = 0x4D42;
uint32_t bf_size;
uint16_t bf_reserved_1 = 0;
uint16_t bf_reserved_2 = 0;
uint32_t bf_off_bits = 54;
// bmp info
uint32_t bi_size = 40;
int32_t bi_width;
int32_t bi_height;
uint16_t bi_planes = 1;
uint16_t bi_bit_count = 24;
uint32_t bi_compression = 0;
uint32_t bi_size_image = 0;
int32_t bi_x_pels_per_meter = 0;
int32_t bi_y_pels_per_meter = 0;
uint32_t bi_clr_used = 0;
uint32_t bi_clr_important = 0;
};
#pragma pack(pop)
void push_icon(const pwder_style::icon32 &icon, int xoffset, int yoffset, int scale);
void no_sdcard_crash_screen();
void password_import_screen();
void save_screenshot_bmp();
void connection_init_error();
void splash_screen();
void splash_screen_create_progressbar();
void splash_screen_update_progressbar_percentage(int progress);
void draw_ui();
+19
View File
@@ -0,0 +1,19 @@
#pragma once
#include <Arduino.h>
#include "gui.h"
extern const pwder_style::icon32 loudspeaker_unmuted PROGMEM;
extern const pwder_style::icon32 loudspeaker PROGMEM;
extern const pwder_style::icon32 clockicon PROGMEM;
extern const pwder_style::icon32 bluetooth PROGMEM;
extern const pwder_style::icon32 battery PROGMEM;
extern const pwder_style::icon32 options PROGMEM;
extern const pwder_style::icon32 padlock PROGMEM;
extern const pwder_style::icon32 network PROGMEM;
extern const pwder_style::icon32 search PROGMEM;
extern const pwder_style::icon32 error PROGMEM;
extern const pwder_style::icon32 help PROGMEM;
extern const pwder_style::icon32 drum PROGMEM;
extern const pwder_style::icon32 key PROGMEM;
extern const pwder_style::icon32 me PROGMEM;
extern const pwder_style::icon32 ok PROGMEM;
+14
View File
@@ -0,0 +1,14 @@
#pragma once
enum class special_key {
RETURN, TAB
};
void usb_keyboard_init();
void usb_send_key(special_key k);
void usb_send_key(char c);
void ble_keyboard_init();
bool ble_keyboard_ready();
void ble_keyboard_update_battery_level();
void ble_send_key(special_key k);
void ble_send_key(char c);
+1
View File
@@ -0,0 +1 @@
void check_keyboard_events();
+3
View File
@@ -0,0 +1,3 @@
void retry_connection(bool reconnect = true);
// void read_response(WiFiClient* client, String& lines);
// void net_password_import();
+16
View File
@@ -0,0 +1,16 @@
// pwrotocol - PWDer protocol for KeePass communication
// version 0.5
// let's see
#define PWROTOCOL_TIMEOUT_MS 10000
#define PWROTOCOL_IMPORT_MAGIC "PWIMPORT"
#define PWROTOCOL_PING 0x01
#define PWROTOCOL_GET_SALT 0x02
#define PWROTOCOL_GET_ITERATIONS 0x03
#define PWROTOCOL_FILE_IMPORT 0x04
#define PWROTOCOL_REQUEST_CONF 0x05
#define PWROTOCOL_CHUNK_SIZE 64 // bytes
void pwrotocol_listen_and_respond();
+7
View File
@@ -0,0 +1,7 @@
#include <M5Cardputer.h>
#include <pvault.h>
namespace sfx {
void beep();
void melody_c_major_scale();
};
+4
View File
@@ -0,0 +1,4 @@
unsigned long to_unix_utc_timestamp(int year, int month, int day, int hour, int minute, int second);
struct tm to_regular_utc_timestamp(unsigned long epoch);
void generate_totp(String secret);
bool start_rtc();
+138
View File
@@ -0,0 +1,138 @@
#define PWDER_VERSION "v0.6 \"Repainted\""
#define CREDITS_PWDER "PWDer 0.6 \"Repainted\" >"
// English
#ifdef lang_en
#define PASSWORD_MANAGER_TITLEBAR "Passwords"
#define LOGIN_TITLEBAR "Enter password"
#define HANDBOOK_TITLEBAR "Help"
#define OPTIONS_TITLEBAR "Options"
#define SYNC_TITLEBAR "Synchronization"
#define CREDITS_TITLEBAR "About"
#define PWIMPORT_TITLEBAR "New passwords found"
#define SEARCH_TITLEBAR "Search"
const String handbook[22] PROGMEM = {
"ESC: Exit", "< Navigate >",
"Sometimes you need to use", "FN with ESC and arrow keys",
"H: Open this handbook", "OK: Input with default mode",
"1: Enter login", "2: Enter password",
"3: Login-TAB-Password-Enter", "4: Enter OTP if available",
"T: Press TAB on computer", "R: Press ENTER on computer",
"V: Preview credential", "Q: Search",
"B: Connect Bluetooth", "N: Connect Wi-Fi",
"L: Lock device", "M: Mute speaker",
"O: Open options", "C: Open About page",
"FN + Top button:", "Take a screenshot"
};
#define OPTIONS_BRIGHTNESS "Brightness:"
#define OPTIONS_BRIGHTNESS_PERCENTAGE "%"
#define OPTIONS_DEFAULT_USERNAME "Default input mode: username"
#define OPTIONS_DEFAULT_PASSWORD "Default input mode: password"
#define OPTIONS_DEFAULT_FULL "Default input mode: full"
#define OPTIONS_AUTOLOCK_ON "Inactivity lock: On"
#define OPTIONS_AUTOLOCK_OFF "Inactivity lock: Off"
#define OPTIONS_COLOR_SCHEME "Theme:"
#define OPTIONS_DEVICE_PASSWORD "Password:"
#define OPTIONS_RTC_TIME "RTC Time: "
#define OPTIONS_RTC_NTPSYNC "Press OK to sync with NTP"
#define OPTIONS_RTC_NTPSYNC_RTC_UNAVAILABLE "Sync unavailable: No RTC"
#define OPTIONS_SSID "Wi-Fi SSID:"
#define OPTIONS_WIFI_PASSWORD "Wi-Fi Key:"
#define SYNC_WIFI_CONNECTING_PHASE "Connecting to Wi-Fi"
#define SYNC_SERVER_CONNECTING_PHASE "Connecting to server"
#define SYNC_DOWNLOAD_PHASE "Downloading data"
#define SYNC_OK "Sync OK, disconnecting"
#define SYNC_RETURN "Returning in 3 seconds"
#define SYNC_ERR "Sync error:"
#define SYNC_ERR_DESCRIPTION_WIFI "Wi-Fi error"
#define SYNC_ERR_DESCRIPTION_SERVER "Server error"
#define SYNC_ERR_DESCRIPTION_FILE "File error"
#define CREDITS_WEBSITE "< Visit my website!"
#define CREDITS_PWDER_GITHUB "adamecki/PWDer on GitHub"
#define CREDITS_WEBSITE_LINK "floriano.uk"
#define PWIMPORT_REPLACE_PASSWORDS "Replace current passwords?"
#define SEARCH_NO_RESULTS "No results"
#define SDCARD_NOT_FOUND_TITLE "Error"
#define SDCARD_NOT_FOUND_DESCRIPTION "SD card not found!"
#define CONNECTION_LIMIT_TITLE "Can't establish this connection"
#define CONNECTION_LIMIT_DESCRIPTION "Restart PWDer to activate"
#define SAMPLE_ENTRY "Sample Entry"
#define SAMPLE_USERNAME "sample_user"
#define SAMPLE_PASSWORD "sample_password"
#endif
// Polish
#ifdef lang_pl
#define PASSWORD_MANAGER_TITLEBAR "Moje hasla"
#define LOGIN_TITLEBAR "Podaj haslo"
#define HANDBOOK_TITLEBAR "Pomoc"
#define OPTIONS_TITLEBAR "Opcje"
#define SYNC_TITLEBAR "Synchronizacja"
#define CREDITS_TITLEBAR "O programie"
#define PWIMPORT_TITLEBAR "Znaleziono nowe hasla"
#define SEARCH_TITLEBAR "Wyszukaj"
const String handbook[22] PROGMEM = {
"ESC: Wyjdz", "< Nawiguj >",
"Czasami z przyciskami strzalek", "oraz ESC nalezy uzyc FN",
"H: Otworz tego pomocnika", "OK: Wprowadz zgodnie z ust. dom.",
"1: Wprowadz login", "2: Wprowadz haslo",
"3: Login-TAB-Haslo-Enter", "4: Wprowadz OTP jesli dostepne",
"T: Wcisnij TAB na komputerze", "R: Wcisnij ENTER na komputerze",
"V: Podglad wpisu", "Q: Wyszukaj",
"B: Polacz Bluetooth", "N: Polacz Wi-Fi",
"L: Zablokuj urzadzenie", "M: Wycisz dzwiek",
"O: Otworz ustawienia", "C: Otworz \"O programie\"",
"FN + Gorny przycisk:", "Zrzut ekranu"
};
#define OPTIONS_BRIGHTNESS "Jasnosc:"
#define OPTIONS_BRIGHTNESS_PERCENTAGE "%"
#define OPTIONS_DEFAULT_USERNAME "Domyslnie wprowadz: nazwe uzytkownika"
#define OPTIONS_DEFAULT_PASSWORD "Domyslnie wprowadz: haslo"
#define OPTIONS_DEFAULT_FULL "Domyslnie wprowadz: wszystko"
#define OPTIONS_AUTOLOCK_ON "Blokuj gdy nieaktywny: Tak"
#define OPTIONS_AUTOLOCK_OFF "Blokuj gdy nieaktywny: Nie"
#define OPTIONS_COLOR_SCHEME "Motyw:"
#define OPTIONS_DEVICE_PASSWORD "Haslo glowne:"
#define OPTIONS_RTC_TIME "Czas RTC: "
#define OPTIONS_RTC_NTPSYNC "OK - synchronizacja z NTP"
#define OPTIONS_RTC_NTPSYNC_RTC_UNAVAILABLE "Sync. niedostepna: Brak RTC"
#define OPTIONS_SSID "SSID Wi-Fi:"
#define OPTIONS_WIFI_PASSWORD "Haslo Wi-Fi:"
#define SYNC_WIFI_CONNECTING_PHASE "Laczenie z Wi-Fi"
#define SYNC_SERVER_CONNECTING_PHASE "Laczenie z serwerem"
#define SYNC_DOWNLOAD_PHASE "Pobieranie danych"
#define SYNC_OK "Synchr. OK, rozlaczanie"
#define SYNC_RETURN "Powrot za 3 sekundy"
#define SYNC_ERR "Blad synchronizacji:"
#define SYNC_ERR_DESCRIPTION_WIFI "Problem z Wi-Fi"
#define SYNC_ERR_DESCRIPTION_SERVER "Problem z serwerem"
#define SYNC_ERR_DESCRIPTION_FILE "Problem z plikiem"
#define CREDITS_WEBSITE "< Zobacz moja strone! >"
#define CREDITS_PWDER_GITHUB "adamecki/PWDer na GitHub"
#define CREDITS_WEBSITE_LINK "floriano.uk"
#define PWIMPORT_REPLACE_PASSWORDS "Zastapic obecne hasla?"
#define SEARCH_NO_RESULTS "Brak wynikow"
#define SDCARD_NOT_FOUND_TITLE "Blad"
#define SDCARD_NOT_FOUND_DESCRIPTION "Nie znaleziono karty SD!"
#define CONNECTION_LIMIT_TITLE "Nie mozna nawiazac polaczenia"
#define CONNECTION_LIMIT_DESCRIPTION "Zrestartuj PWDer, by aktywowac"
#define SAMPLE_ENTRY "Przykladowy wpis"
#define SAMPLE_USERNAME "przykladowa_nazwa_uzytkownika"
#define SAMPLE_PASSWORD "przykladowe_haslo"
#endif