1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-04-24 05:17:46 +00:00
astra/external/libbaseencode/src/baseencode.h
Joshua Goins 5ee036dd09 Add option to generate OTP codes automatically
* This uses the great libcotp library, I stripped it down to fit inside
the repository.
* This is a security-convenience trade-off, and it's made very clear
with the tooltips on the settings page.
* It's still secured by your system keychain, and it's up to the users
whether that's good enough for them. Eventually down the line
I would like to support more esoteric keychains such as Bitwarden or
KeePass.
* Right now it's only integrated into the auto-login desktop feature,
but there will eventually be like an "auto-fill OTP" button in the main
window.

There's still a lot to clean up with these new features but they work
a little at least :-)
2022-08-31 21:19:25 -04:00

28 lines
No EOL
995 B
C

#pragma once
typedef enum _baseencode_errno {
SUCCESS = 0,
INVALID_INPUT = 1,
EMPTY_STRING = 2,
INPUT_TOO_BIG = 3,
INVALID_B32_DATA = 4,
INVALID_B64_DATA = 5,
MEMORY_ALLOCATION = 6,
} baseencode_error_t;
char *base32_encode (const unsigned char *user_data,
size_t data_len,
baseencode_error_t *err);
unsigned char *base32_decode (const char *user_data,
size_t data_len,
baseencode_error_t *err);
char *base64_encode (const unsigned char *input_string,
size_t input_length,
baseencode_error_t *err);
unsigned char *base64_decode (const char *input_string,
size_t input_length,
baseencode_error_t *err);