forked from flipperdevices/flipperzero-firmware
-
-
Notifications
You must be signed in to change notification settings - Fork 545
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
70 changed files
with
1,049 additions
and
953 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#pragma once | ||
|
||
#include <flipper_application/api_hashtable/api_hashtable.h> | ||
|
||
/* | ||
* Resolver interface with private application's symbols. | ||
* Implementation is contained in app_api_table.c | ||
*/ | ||
#ifdef __cplusplus | ||
extern "C" const ElfApiInterface* const application_api_interface; | ||
#else | ||
extern const ElfApiInterface* const application_api_interface; | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include <flipper_application/api_hashtable/api_hashtable.h> | ||
#include <flipper_application/api_hashtable/compilesort.hpp> | ||
#include "app_api_interface.h" | ||
#include "app_api_table_i.h" | ||
|
||
static_assert(!has_hash_collisions(app_api_table), "Detected API method hash collision!"); | ||
|
||
constexpr HashtableApiInterface applicaton_hashtable_api_interface{ | ||
{ | ||
.api_version_major = 0, | ||
.api_version_minor = 0, | ||
.resolver_callback = &elf_resolve_from_hashtable, | ||
}, | ||
.table_cbegin = app_api_table.cbegin(), | ||
.table_cend = app_api_table.cend(), | ||
}; | ||
|
||
extern "C" const ElfApiInterface* const application_api_interface = | ||
&applicaton_hashtable_api_interface; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#include <stdbool.h> | ||
#include <cli/cli.h> | ||
#include <lib/print/wrappers.h> | ||
#include <lib/toolbox/args.h> | ||
#include <memset_s.h> | ||
#include "services/crypto/crypto_facade.h" | ||
#include "ui/scene_director.h" | ||
#include "services/config/config.h" | ||
#include "cli/cli_helpers.h" | ||
#include "workers/bt_type_code/bt_type_code.h" | ||
|
||
static constexpr auto app_api_table = sort(create_array_t<sym_entry>( | ||
API_METHOD(memset_s, errno_t, (void*, rsize_t, int, rsize_t)), | ||
API_METHOD(totp_scene_director_activate_scene, void, (PluginState* const, Scene)), | ||
API_METHOD(totp_scene_director_force_redraw, void, (PluginState* const)), | ||
API_METHOD(totp_config_file_update_timezone_offset, bool, (const PluginState*)), | ||
API_METHOD(totp_config_file_reset, void, (PluginState* const)), | ||
API_METHOD( | ||
totp_config_get_token_iterator_context, | ||
TokenInfoIteratorContext*, | ||
(const PluginState*)), | ||
API_METHOD(totp_config_file_backup, char*, (const PluginState*)), | ||
API_METHOD( | ||
totp_config_file_update_encryption, | ||
bool, | ||
(PluginState*, uint8_t, const uint8_t*, uint8_t)), | ||
API_METHOD(totp_config_file_update_automation_method, bool, (const PluginState*)), | ||
API_METHOD(totp_config_file_update_notification_method, bool, (const PluginState*)), | ||
API_METHOD(totp_token_info_iterator_get_total_count, size_t, (const TokenInfoIteratorContext*)), | ||
API_METHOD( | ||
totp_token_info_iterator_get_current_token_index, | ||
size_t, | ||
(const TokenInfoIteratorContext*)), | ||
API_METHOD(totp_token_info_iterator_go_to, bool, (TokenInfoIteratorContext*, size_t)), | ||
API_METHOD( | ||
totp_token_info_iterator_get_current_token, | ||
const TokenInfo*, | ||
(const TokenInfoIteratorContext*)), | ||
API_METHOD( | ||
totp_token_info_iterator_add_new_token, | ||
TotpIteratorUpdateTokenResult, | ||
(TokenInfoIteratorContext*, TOTP_ITERATOR_UPDATE_TOKEN_ACTION, const void*)), | ||
API_METHOD( | ||
totp_token_info_iterator_update_current_token, | ||
TotpIteratorUpdateTokenResult, | ||
(TokenInfoIteratorContext*, TOTP_ITERATOR_UPDATE_TOKEN_ACTION, const void*)), | ||
API_METHOD( | ||
totp_token_info_iterator_move_current_token_info, | ||
bool, | ||
(TokenInfoIteratorContext*, size_t)), | ||
API_METHOD( | ||
totp_token_info_iterator_remove_current_token_info, | ||
bool, | ||
(TokenInfoIteratorContext*)), | ||
API_METHOD(token_info_get_algo_as_cstr, const char*, (const TokenInfo*)), | ||
API_METHOD(token_info_set_algo_from_str, bool, (TokenInfo*, const FuriString*)), | ||
API_METHOD(token_info_set_digits_from_int, bool, (TokenInfo*, uint8_t)), | ||
API_METHOD(token_info_set_duration_from_int, bool, (TokenInfo*, uint8_t)), | ||
API_METHOD(token_info_set_automation_feature_from_str, bool, (TokenInfo*, const FuriString*)), | ||
API_METHOD( | ||
token_info_set_secret, | ||
bool, | ||
(TokenInfo*, const char*, size_t, PlainTokenSecretEncoding, const CryptoSettings*)), | ||
API_METHOD(totp_crypto_check_key_slot, bool, (uint8_t)), | ||
API_METHOD(totp_bt_type_code_worker_free, void, (TotpBtTypeCodeWorkerContext*)))); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
Usage: | ||
totp (help | h | ?) | ||
totp version | ||
totp (list | ls) | ||
totp (lsattr | cat) <index> | ||
totp (add | mk | new) <name> [-a <algo>] [-e <encoding>] [-d <digits>] [-l <duration>] [-u] [-b <feature>]... | ||
totp (update) <index> [-a <algo>] [-e <encoding>] [-n <name>] [-d <digits>] [-l <duration>] [-u] [-s] [-b <feature>]... | ||
totp (delete | rm) <index> [-f] | ||
totp (move | mv) <index> <new_index> | ||
totp pin (set | remove) [-c <slot>] | ||
totp notify [<notification>...] | ||
totp (timezone | tz) [<timezone>] | ||
totp reset | ||
totp automation [-k <layout>] [<automation>...] | ||
|
||
Commands: | ||
help, h, ? Show command usage help | ||
version Get application version | ||
list, ls List all available tokens | ||
lsattr, cat Displays token details | ||
add, mk, new Add new token | ||
update Update existing token | ||
delete, rm Delete existing token | ||
move, mv Move token | ||
pin Set\change\remove PIN | ||
notify Get or set notification method | ||
timezone, tz Get or set current timezone | ||
reset Reset application to default settings | ||
automation Get or set automation settings | ||
|
||
Arguments: | ||
name Token name | ||
index Token index in the list | ||
new_index New token index in the list | ||
notification Notification method to be set. Must be one of: none, sound, vibro | ||
timezone Timezone offset in hours to be set | ||
automation Automation method to be set. Must be one of: none, usb, bt | ||
|
||
Options: | ||
-a <algo> Token hashing algorithm. Must be one of: sha1, sha256, sha512, steam [default: sha1] | ||
-d <digits> Number of digits to generate, one of: 5, 6, 8 [default: 6] | ||
-e <encoding> Token secret encoding, one of base32, base64 [default: base32] | ||
-l <duration> Token lifetime duration in seconds, between: 15 and 255 [default: 30] | ||
-u Show console user input as-is without masking | ||
-b <feature> Token automation features to be enabled. Must be one of: none, enter, tab [default: none] | ||
# none - No features | ||
# enter - Type <Enter> key at the end of token input automation | ||
# tab - Type <Tab> key at the end of token input automation | ||
# slower - Type slower | ||
-n <name> Token name | ||
-s Update token secret | ||
-f Force command to do not ask user for interactive confirmation | ||
-c <slot> New crypto key slot. Must be between 12 and 100 | ||
-k <layout> Automation keyboard layout. Must be one of: QWERTY, AZERTY, QWERTZ | ||
|
Oops, something went wrong.