ascii-chat 0.8.38
Real-time terminal-based video chat with ASCII art conversion
Loading...
Searching...
No Matches
lib/platform/wasm/stubs/crypto.c
Go to the documentation of this file.
1
6#include <ascii-chat/common.h>
7#include <ascii-chat/crypto/crypto.h>
8#include <ascii-chat/crypto/keys.h>
9#include <ascii-chat/network/packet.h>
10#include <ascii-chat/network/acip/transport.h>
11#include <stdint.h>
12#include <stdbool.h>
13#include <string.h>
14
15// Ed25519 signature stubs (not needed for basic handshake)
16asciichat_error_t ed25519_verify_signature(const uint8_t public_key[32], const uint8_t *message, size_t message_len,
17 const uint8_t signature[64], const char *gpg_key_id) {
18 // Server identity verification not supported in WASM (no known_hosts file)
19 return ASCIICHAT_OK;
20}
21
22asciichat_error_t ed25519_sign_message(const private_key_t *key, const uint8_t *message, size_t message_len,
23 uint8_t signature[64]) {
24 // Client authentication not supported in WASM (no client keys)
25 return SET_ERRNO(ERROR_NOT_SUPPORTED, "Ed25519 signing not supported in WASM");
26}
27
28// Public key parsing stubs
29asciichat_error_t parse_public_keys(const char *input, public_key_t *keys_out, size_t *num_keys, size_t max_keys) {
30 // Key file parsing not supported in WASM
31 return SET_ERRNO(ERROR_NOT_SUPPORTED, "Public key file parsing not supported in WASM");
32}
33
34// Known hosts stubs (no filesystem in WASM)
35asciichat_error_t check_known_host(const char *server_ip, uint16_t port, const uint8_t server_key[32]) {
36 // Known hosts checking not supported in WASM
37 return ASCIICHAT_OK;
38}
39
40asciichat_error_t check_known_host_no_identity(const char *server_ip, uint16_t port) {
41 // Known hosts checking not supported in WASM
42 return ASCIICHAT_OK;
43}
44
45bool display_mitm_warning(const char *server_ip, uint16_t port, const uint8_t expected_key[32],
46 const uint8_t received_key[32]) {
47 // MITM warnings not displayed in WASM (browser console log instead)
48 return false;
49}
50
51bool prompt_unknown_host(const char *server_ip, uint16_t port, const uint8_t server_key[32]) {
52 // No interactive prompts in WASM - auto-accept
53 return true;
54}
55
56bool prompt_unknown_host_no_identity(const char *server_ip, uint16_t port) {
57 // No interactive prompts in WASM - auto-accept
58 return true;
59}
60
61asciichat_error_t add_known_host(const char *server_ip, uint16_t port, const uint8_t server_key[32]) {
62 // Known hosts file updates not supported in WASM
63 return ASCIICHAT_OK;
64}
65
66const char *get_known_hosts_path(void) {
67 // No filesystem in WASM
68 return NULL;
69}
70
71// Password prompt stub
72asciichat_error_t prompt_password(const char *prompt_text, char *password_out, size_t password_max_len) {
73 // Password prompts not supported in WASM
74 return SET_ERRNO(ERROR_NOT_SUPPORTED, "Password prompts not supported in WASM");
75}
bool prompt_unknown_host(const char *server_ip, uint16_t port, const uint8_t server_key[32])
const char * get_known_hosts_path(void)
asciichat_error_t ed25519_verify_signature(const uint8_t public_key[32], const uint8_t *message, size_t message_len, const uint8_t signature[64], const char *gpg_key_id)
bool prompt_unknown_host_no_identity(const char *server_ip, uint16_t port)
asciichat_error_t parse_public_keys(const char *input, public_key_t *keys_out, size_t *num_keys, size_t max_keys)
asciichat_error_t prompt_password(const char *prompt_text, char *password_out, size_t password_max_len)
asciichat_error_t check_known_host_no_identity(const char *server_ip, uint16_t port)
asciichat_error_t ed25519_sign_message(const private_key_t *key, const uint8_t *message, size_t message_len, uint8_t signature[64])
asciichat_error_t add_known_host(const char *server_ip, uint16_t port, const uint8_t server_key[32])
bool display_mitm_warning(const char *server_ip, uint16_t port, const uint8_t expected_key[32], const uint8_t received_key[32])
asciichat_error_t check_known_host(const char *server_ip, uint16_t port, const uint8_t server_key[32])