-
Notifications
You must be signed in to change notification settings - Fork 4
/
seader_credential.h
70 lines (56 loc) · 1.93 KB
/
seader_credential.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#pragma once
#include <stdint.h>
#include <stdbool.h>
#include <storage/storage.h>
#include <dialogs/dialogs.h>
#include "protocol/picopass_protocol.h"
#include <optimized_ikeys.h>
#include <optimized_cipher.h>
#define SEADER_CRED_NAME_MAX_LEN 22
#define SEADER_APP_EXTENSION ".credential"
#define SEADER_APP_MFC_EXTENSION ".nfc"
#define SEADER_APP_MFC_FOLDER EXT_PATH("nfc")
typedef void (*SeaderLoadingCallback)(void* context, bool state);
typedef enum {
SeaderCredentialTypeNone,
SeaderCredentialTypePicopass,
SeaderCredentialType14A,
// Might need to make 14a into "javacard" and add Desfire
SeaderCredentialTypeMifareClassic,
SeaderCredentialTypeVirtual,
} SeaderCredentialType;
typedef enum {
SeaderCredentialSaveFormatAgnostic,
SeaderCredentialSaveFormatPicopass,
SeaderCredentialSaveFormatRFID,
SeaderCredentialSaveFormatSR,
SeaderCredentialSaveFormatMFC,
} SeaderCredentialSaveFormat;
typedef struct {
Storage* storage;
DialogsApp* dialogs;
uint64_t credential;
size_t bit_length;
uint8_t sio[128];
uint8_t sio_len;
uint8_t diversifier[8];
uint8_t diversifier_len;
bool isDesfire;
SeaderCredentialType type;
SeaderCredentialSaveFormat save_format;
char name[SEADER_CRED_NAME_MAX_LEN + 1];
FuriString* load_path;
SeaderLoadingCallback loading_cb;
void* loading_cb_ctx;
} SeaderCredential;
SeaderCredential* seader_credential_alloc();
void seader_credential_free(SeaderCredential* seader_cred);
void seader_credential_set_loading_callback(
SeaderCredential* cred,
SeaderLoadingCallback callback,
void* context);
void seader_credential_set_name(SeaderCredential* cred, const char* name);
bool seader_credential_save(SeaderCredential* cred, const char* name);
bool seader_file_select(SeaderCredential* cred);
void seader_credential_clear(SeaderCredential* cred);
bool seader_credential_delete(SeaderCredential* cred, bool use_load_path);