diff --git a/debug.log b/debug.log new file mode 100644 index 00000000..243d98ba --- /dev/null +++ b/debug.log @@ -0,0 +1,31 @@ + +=== NOSTR WebSocket Debug Log Started === +[08:14:39.697] SEND nostr.mom:443: ["REQ", "sync_0_1755346479", { + "kinds": [1], + "limit": 1 + }] +[08:14:39.851] RECV nostr.mom:443: ["EVENT","sync_0_1755346479",{"content":"🔔 Zelenskyj chce trvalý mír, ne pauzu mezi invazemi. Trump mluví o obdobě článku 5: \n\nUkrajinský prezident Volodymyr Zelenskyj v sobotu po telefonátu s evropskými lídry uvedl, že Ukrajina potřebuje skutečný, trvalý mír, a ne další přestávku mezi ruskými invazemi. Americký prezident Donald Trump mezitím jednal s evropskými lídry o možných bezpečnostních zárukách pro Ukrajinu podobných aliančnímu článku 5, ale bez členství Ukrajiny v NATO. \nhttps://www.idnes.cz/zpravy/zahranicni/tremp-putin-zelenskyj-bezpescnsotni-zaruky-clanek-5-usa-nato.A250816_131344_zahranicni_berr \n#CzechNews #News #Press #Media","created_at":1755346439,"id":"056ac24b086f6e581c9a1b14c51ddd2b5333e378a5ab8443e558d96756c3713e","kind":1,"pubkey":"c6716205cf41794c1abe4619be582e8627f3b76df284a414ba09e4cdecd92f88","sig":"d02cdab1e126d6b4f4ad245d9613e3adceb3d6a814b13cb47facf5da76e0eeb5edc4416d9b5337368e78244224fb8b4158c7630917f0c813df52e2b89ad08d30","tags":[["t","CzechNews"],["t","czechnews"],["t","News"],["t","news"],["t","Press"],["t","press"],["t","Media"],["t","media"]]}] +[08:14:39.851] SEND nostr.mom:443: ["CLOSE", "sync_0_1755346479"] + +=== NOSTR WebSocket Debug Log Started === +[08:50:17.534] SEND 127.0.0.1:7777: ["REQ", "sync_0_1755348617", { + "kinds": [1], + "limit": 1 + }] +[08:50:17.776] SEND relay.laantungir.net:443: ["REQ", "sync_1_1755348617", { + "kinds": [1], + "limit": 1 + }] +[08:50:18.395] SEND nostr.mom:443: ["REQ", "sync_2_1755348617", { + "kinds": [1], + "limit": 1 + }] +[08:50:18.395] RECV 127.0.0.1:7777: ["EVENT","sync_0_1755348617",{"content":"🟠 New Bitcoin Block Mined!\n\nBlock Height: 910,298\nBlock Hash: 00000000000000000001534d38584bbcf7194ec38bee33a8f92066dddf30b72f\nTimestamp: 2025-08-16T12:34:23.000Z\nTransactions: 3,982\nBlock Size: 1.50 MB\nBlock Weight: 3,993,684 WU\nDifficulty: 1.29e+14\n\n#Bitcoin #Blockchain #Block910298","created_at":1755347696,"id":"570eb456eb3059d8cd2f22b4d1895ee5b236e571b907bdfa68ee7a2d7ef45546","kind":1,"pubkey":"e568a76a4f8836be296d405eb41034260d55e2361e4b2ef88350a4003bbd5f9b","sig":"486131c784cdf0011b146b6d1bef837152c1bf737295bd7aef168a46032acadd1413aad8e7c1c2fabf98e13c41ebfcbea28a62cc21f9ea41da41de47fd5683db","tags":[["t","bitcoin"],["t","blockchain"],["t","block"],["alt","New Bitcoin block mined - Block 910298"],["published_at","1755347663"],["client","info_bot","ws://127.0.0.1:7777"],["r","https://blockstream.info/block/00000000000000000001534d38584bbcf7194ec38bee33a8f92066dddf30b72f"],["new_block","true"],["block_height","910298"],["block_hash","00000000000000000001534d38584bbcf7194ec38bee33a8f92066dddf30b72f"],["block_time","1755347663"],["tx_count","3982"],["block_size","1570317"],["block_weight","3993684"],["difficulty","129435235580344.8"],["previous_block","000000000000000000016d8c0969be02a726850b9587489d76b1688278b44380"],["mempool_tx_count","104"],["mempool_size","25006"],["memory_usage_pct","0.1"]]}] +[08:50:18.396] RECV relay.laantungir.net:443: ["EVENT","sync_1_1755348617",{"content":"ぽいですね。今家に空いてるusbがなくて、、、","created_at":1755348440,"id":"a20cfc4a8201dd09d648d637dd05f4fef2127e822ae313e56b4c2b2117c1a427","kind":1,"pubkey":"df8f0a640c3ffd09e293999acfa399d0574c8501fcdabceca5072ee2057d87a5","sig":"4d1cab03b7ef4e07c0c05ac08aced49594e6a0ac5ba7b409a08affa9fa37ea89e3998883f131a53fa6b780dd5aa4f4f5dd4de720860bdd258bdb4078c8a84aa0","tags":[["e","016e37f816930685bdb4b5331f0a6e4245831a29d7f943509181948c28d5a3e7","","root"],["e","f8b5e204dbd7155b098555080efb4a0dae6ad162e9a113192c810f8757817e2d","","reply"],["p","23395bce1a18fe5ff5bde153fcd47ecd1cd66e686684dfd2cfcbd9fafd305cb3"],["p","df8f0a640c3ffd09e293999acfa399d0574c8501fcdabceca5072ee2057d87a5"]]}] +[08:50:18.456] RECV 127.0.0.1:7777: ["EOSE","sync_0_1755348617"] +[08:50:18.456] SEND 127.0.0.1:7777: ["CLOSE", "sync_0_1755348617"] +[08:50:18.456] RECV relay.laantungir.net:443: ["EOSE","sync_1_1755348617"] +[08:50:18.457] SEND relay.laantungir.net:443: ["CLOSE", "sync_1_1755348617"] +[08:50:18.550] RECV nostr.mom:443: ["EVENT","sync_2_1755348617",{"content":"😂\nStay humble and stack zaps ⚡️ ","created_at":1755348616,"id":"974af84ac7c4041ccf44741adaeffb911aad9d5ed13543496a1ce2b519dc6fdf","kind":1,"pubkey":"3824552ea18ce24fae867d292514c40e0d4d1c39e18e752e852a51e4a0b2d7c8","sig":"04acf08ee2b2218604bc0e663f52ad6f0a52109674457e232c940e3bb91df971cc7baf33248ced999b1e294dd8de68c2e0ca5f586ed7bddecc0a88ddc58da781","tags":[["e","253a2c3eda166a82e8f42f0018c96845df080e71cf7c30ad7107e5936b6892dd","","root"],["p","7c765d407d3a9d5ea117cb8b8699628560787fc084a0c76afaa449bfbd121d84"]]}] +[08:50:18.560] RECV nostr.mom:443: ["EOSE","sync_2_1755348617"] +[08:50:18.560] SEND nostr.mom:443: ["CLOSE", "sync_2_1755348617"] diff --git a/tests/bip32_test b/tests/bip32_test new file mode 100755 index 00000000..d4856938 Binary files /dev/null and b/tests/bip32_test differ diff --git a/tests/chacha20_test b/tests/chacha20_test new file mode 100755 index 00000000..e53ed11e Binary files /dev/null and b/tests/chacha20_test differ diff --git a/tests/old/chacha20_test.c b/tests/chacha20_test.c similarity index 99% rename from tests/old/chacha20_test.c rename to tests/chacha20_test.c index 54561557..11e250de 100644 --- a/tests/old/chacha20_test.c +++ b/tests/chacha20_test.c @@ -9,7 +9,7 @@ #include #include #include -#include "../nostr_core/nostr_chacha20.h" +#include "../nostr_core/crypto/nostr_chacha20.h" // Helper function to convert hex string to bytes static int hex_to_bytes(const char* hex, uint8_t* bytes, size_t len) { diff --git a/tests/crypto_test b/tests/crypto_test new file mode 100755 index 00000000..46e0b068 Binary files /dev/null and b/tests/crypto_test differ diff --git a/tests/old/init_only_test.c b/tests/old/init_only_test.c deleted file mode 100644 index 87743a49..00000000 --- a/tests/old/init_only_test.c +++ /dev/null @@ -1,22 +0,0 @@ -#include -#include "../nostr_core/nostr_core.h" - -int main(void) { - printf("=== Testing library initialization only ===\n"); - - printf("About to call nostr_init()...\n"); - int result = nostr_init(); - - if (result != NOSTR_SUCCESS) { - printf("ERROR: Failed to initialize NOSTR library: %s\n", nostr_strerror(result)); - return 1; - } - - printf("✅ Library initialized successfully!\n"); - - printf("About to call nostr_cleanup()...\n"); - nostr_cleanup(); - - printf("✅ Library cleanup completed!\n"); - return 0; -} diff --git a/tests/old/single_test.c b/tests/old/single_test.c deleted file mode 100644 index b769ce05..00000000 --- a/tests/old/single_test.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Single Test Vector to Debug Segfault - */ - -#include -#include -#include -#include "../nostr_core/nostr_core.h" - -void hex_to_bytes(const char* hex_str, unsigned char* bytes) { - size_t len = strlen(hex_str); - for (size_t i = 0; i < len; i += 2) { - sscanf(hex_str + i, "%2hhx", &bytes[i / 2]); - } -} - -int main(void) { - printf("=== Single Test Vector Debug ===\n"); - - // Initialize the library - printf("Initializing library...\n"); - if (nostr_init() != NOSTR_SUCCESS) { - printf("ERROR: Failed to initialize NOSTR library\n"); - return 1; - } - printf("✅ Library initialized\n"); - - // Test Vector 1 data - const char* sk1_hex = "91ba716fa9e7ea2fcbad360cf4f8e0d312f73984da63d90f524ad61a6a1e7dbe"; - const char* sk2_hex = "96f6fa197aa07477ab88f6981118466ae3a982faab8ad5db9d5426870c73d220"; - const char* pk1_hex = "b38ce15d3d9874ee710dfabb7ff9801b1e0e20aace6e9a1a05fa7482a04387d1"; - const char* pk2_hex = "dcb33a629560280a0ee3b6b99b68c044fe8914ad8a984001ebf6099a9b474dc3"; - const char* plaintext = "nanana"; - - printf("Converting hex keys...\n"); - unsigned char sk1[32], sk2[32], pk1[32], pk2[32]; - hex_to_bytes(sk1_hex, sk1); - hex_to_bytes(sk2_hex, sk2); - hex_to_bytes(pk1_hex, pk1); - hex_to_bytes(pk2_hex, pk2); - printf("✅ Keys converted\n"); - - printf("Testing encryption...\n"); - char encrypted[NOSTR_NIP04_MAX_ENCRYPTED_SIZE]; - int result = nostr_nip04_encrypt(sk1, pk2, plaintext, encrypted, sizeof(encrypted)); - - if (result != NOSTR_SUCCESS) { - printf("❌ ENCRYPTION FAILED: %s\n", nostr_strerror(result)); - nostr_cleanup(); - return 1; - } - printf("✅ Encryption successful: %s\n", encrypted); - - printf("Testing decryption...\n"); - char decrypted[NOSTR_NIP04_MAX_PLAINTEXT_SIZE]; - result = nostr_nip04_decrypt(sk2, pk1, encrypted, decrypted, sizeof(decrypted)); - - if (result != NOSTR_SUCCESS) { - printf("❌ DECRYPTION FAILED: %s\n", nostr_strerror(result)); - nostr_cleanup(); - return 1; - } - printf("✅ Decryption successful: \"%s\"\n", decrypted); - - if (strcmp(plaintext, decrypted) == 0) { - printf("✅ TEST PASSED - Round-trip successful!\n"); - } else { - printf("❌ TEST FAILED - Messages don't match\n"); - nostr_cleanup(); - return 1; - } - - printf("Cleaning up...\n"); - nostr_cleanup(); - printf("✅ Test completed successfully!\n"); - - return 0; -} diff --git a/tests/old/static_linking_only_test.c b/tests/old/static_linking_only_test.c deleted file mode 100644 index f89e23e7..00000000 --- a/tests/old/static_linking_only_test.c +++ /dev/null @@ -1,418 +0,0 @@ -/* - * NOSTR Core Library - Static Linking Only Test (Binary Analysis Version) - * - * NOTE: For faster and more reliable static linking verification, see - * makefile_static_test.c which analyzes the build configuration directly. - * This test complements it by analyzing actual compiled binaries. - * - * This test verifies that the library maintains its self-contained, - * static-only design with no external cryptographic dependencies. - * - * Test Categories: - * 1. Library dependency analysis using ldd/otool - * 2. Symbol resolution verification using nm/objdump - * 3. Build process validation - * 4. Runtime independence verification - * 5. Library size and content verification - */ - -#define _GNU_SOURCE // For popen/pclose on Linux -#include "../nostr_core/nostr_core.h" -#include -#include -#include -#include -#include -#include -#include "../cjson/cJSON.h" - -// ANSI color codes for output -#define GREEN "\033[32m" -#define RED "\033[31m" -#define YELLOW "\033[33m" -#define BLUE "\033[34m" -#define RESET "\033[0m" - -// Test result tracking -static int tests_run = 0; -static int tests_passed = 0; - -// Helper function to run shell commands and capture output -static int run_command(const char* command, char* output, size_t output_size) { - FILE* fp = popen(command, "r"); - if (!fp) { - return -1; - } - - size_t total = 0; - while (total < output_size - 1 && fgets(output + total, output_size - total, fp)) { - total = strlen(output); - } - - int status = pclose(fp); - return WEXITSTATUS(status); -} - -// Helper function to check if file exists -static int file_exists(const char* path) { - struct stat st; - return stat(path, &st) == 0; -} - -// Test macro -#define RUN_TEST(test_name, test_func) do { \ - printf(BLUE "[TEST] " RESET "%s...\n", test_name); \ - tests_run++; \ - if (test_func()) { \ - printf(GREEN "[PASS] " RESET "%s\n\n", test_name); \ - tests_passed++; \ - } else { \ - printf(RED "[FAIL] " RESET "%s\n\n", test_name); \ - } \ -} while(0) - -// Test 1: Library Dependency Analysis -static int test_library_dependency_analysis(void) { - char command[512]; - char output[4096]; - int result; - - // Check if we have the main library - if (!file_exists("../libnostr_core.a")) { - printf(RED "ERROR: " RESET "libnostr_core.a not found. Run 'make' first.\n"); - return 0; - } - - // Create a simple test binary to analyze - printf("Creating test binary for dependency analysis...\n"); - - const char* test_code = - "#include \"nostr_core/nostr_core.h\"\n" - "#include \n" - "int main() {\n" - " if (nostr_init() == NOSTR_SUCCESS) {\n" - " unsigned char privkey[32], pubkey[32];\n" - " if (nostr_generate_keypair(privkey, pubkey) == NOSTR_SUCCESS) {\n" - " printf(\"Crypto test passed\\n\");\n" - " }\n" - " nostr_cleanup();\n" - " }\n" - " return 0;\n" - "}\n"; - - FILE* fp = fopen("/tmp/static_test.c", "w"); - if (!fp) { - printf(RED "ERROR: " RESET "Cannot create temporary test file\n"); - return 0; - } - fputs(test_code, fp); - fclose(fp); - - // Compile the test binary - snprintf(command, sizeof(command), - "gcc -I.. -Wall -Wextra -std=c99 /tmp/static_test.c -o /tmp/static_test ../libnostr_core.a -lm -static 2>/dev/null"); - - result = system(command); - if (result != 0) { - printf(RED "ERROR: " RESET "Failed to compile test binary\n"); - return 0; - } - - // Analyze dependencies with ldd (Linux) or otool (macOS) - printf("Analyzing binary dependencies...\n"); - -#ifdef __linux__ - snprintf(command, sizeof(command), "ldd /tmp/static_test 2>&1"); -#elif __APPLE__ - snprintf(command, sizeof(command), "otool -L /tmp/static_test 2>&1"); -#else - printf(YELLOW "WARNING: " RESET "Unknown platform, skipping dependency analysis\n"); - cleanup_and_return: - unlink("/tmp/static_test.c"); - unlink("/tmp/static_test"); - return 1; -#endif - - result = run_command(command, output, sizeof(output)); - - // Check for problematic dynamic dependencies (updated for OpenSSL migration) - const char* forbidden_libs[] = { - "libsecp256k1", // Should be statically linked - "libwally", // Not used - "libsodium" // Not used - }; - - int found_forbidden = 0; - for (int i = 0; i < 3; i++) { - if (strstr(output, forbidden_libs[i])) { - printf(RED "ERROR: " RESET "Found forbidden dynamic dependency: %s\n", forbidden_libs[i]); - found_forbidden = 1; - } - } - - if (!found_forbidden) { - printf(GREEN "GOOD: " RESET "No forbidden cryptographic dependencies found\n"); - } - - // For static binaries, ldd should say "not a dynamic executable" or show minimal deps -#ifdef __linux__ - if (strstr(output, "not a dynamic executable") || strstr(output, "statically linked")) { - printf(GREEN "EXCELLENT: " RESET "Binary is statically linked\n"); - } else { - printf(YELLOW "INFO: " RESET "Binary appears to have some dynamic dependencies:\n"); - printf("%s\n", output); - } -#endif - - // Cleanup - unlink("/tmp/static_test.c"); - unlink("/tmp/static_test"); - - return !found_forbidden; -} - -// Test 2: Symbol Resolution Verification -static int test_symbol_resolution_verification(void) { - printf("Verifying secp256k1 symbols are present in static library...\n"); - - // Use system() command instead of popen to avoid buffer issues - int result = system("nm ../libnostr_core.a | grep -q secp256k1 2>/dev/null"); - - if (result != 0) { - printf(RED "ERROR: " RESET "No secp256k1 symbols found in library\n"); - return 0; - } - - // Test individual symbols with specific commands - const char* required_symbols[] = { - "nostr_secp256k1_context_create", - "nostr_secp256k1_ec_pubkey_create", - "nostr_secp256k1_schnorrsig_sign32", - "nostr_secp256k1_schnorrsig_verify", - "nostr_secp256k1_ecdh" - }; - - int symbols_found = 0; - char command[256]; - - for (int i = 0; i < 5; i++) { - snprintf(command, sizeof(command), "nm ../libnostr_core.a | grep -q '%s' 2>/dev/null", required_symbols[i]); - if (system(command) == 0) { - symbols_found++; - printf(GREEN "FOUND: " RESET "%s\n", required_symbols[i]); - } else { - printf(YELLOW "MISSING: " RESET "%s\n", required_symbols[i]); - } - } - - if (symbols_found >= 3) { - printf(GREEN "GOOD: " RESET "Found %d/5 critical secp256k1 symbols\n", symbols_found); - return 1; - } else { - printf(RED "ERROR: " RESET "Only found %d/5 critical secp256k1 symbols\n", symbols_found); - return 0; - } -} - -// Test 3: Build Process Validation -static int test_build_process_validation(void) { - char command[512]; - int result; - - printf("Testing minimal build requirements...\n"); - - // Test that we can build with only libnostr_core.a and -lm - const char* minimal_test = - "#include \"nostr_core/nostr_core.h\"\n" - "int main() { return nostr_init() == NOSTR_SUCCESS ? 0 : 1; }\n"; - - FILE* fp = fopen("/tmp/minimal_test.c", "w"); - if (!fp) return 0; - fputs(minimal_test, fp); - fclose(fp); - - // Try to build with minimal dependencies - snprintf(command, sizeof(command), - "gcc -I.. -Wall -Wextra -std=c99 /tmp/minimal_test.c -o /tmp/minimal_test ../libnostr_core.a -lm 2>/dev/null"); - - result = system(command); - - unlink("/tmp/minimal_test.c"); - - if (result == 0) { - printf(GREEN "EXCELLENT: " RESET "Can build with only libnostr_core.a and -lm\n"); - - // Test that it actually runs - result = system("/tmp/minimal_test"); - unlink("/tmp/minimal_test"); - - if (result == 0) { - printf(GREEN "EXCELLENT: " RESET "Minimal binary runs successfully\n"); - return 1; - } else { - printf(RED "ERROR: " RESET "Minimal binary failed to run\n"); - return 0; - } - } else { - printf(RED "ERROR: " RESET "Cannot build with minimal dependencies\n"); - unlink("/tmp/minimal_test"); - return 0; - } -} - -// Test 4: Runtime Independence Test -static int test_runtime_independence(void) { - printf("Testing runtime independence (crypto functionality)...\n"); - - // Initialize the library - if (nostr_init() != NOSTR_SUCCESS) { - printf(RED "ERROR: " RESET "Library initialization failed\n"); - return 0; - } - - // Test key generation - unsigned char private_key[32]; - unsigned char public_key[32]; - - if (nostr_generate_keypair(private_key, public_key) != NOSTR_SUCCESS) { - printf(RED "ERROR: " RESET "Key generation failed\n"); - nostr_cleanup(); - return 0; - } - printf(GREEN "GOOD: " RESET "Key generation works\n"); - - // Test bech32 encoding - char nsec[100], npub[100]; - if (nostr_key_to_bech32(private_key, "nsec", nsec) != NOSTR_SUCCESS || - nostr_key_to_bech32(public_key, "npub", npub) != NOSTR_SUCCESS) { - printf(RED "ERROR: " RESET "Bech32 encoding failed\n"); - nostr_cleanup(); - return 0; - } - printf(GREEN "GOOD: " RESET "Bech32 encoding works\n"); - - // Test signing - cJSON* event = nostr_create_and_sign_event(1, "Test message", NULL, private_key, 0); - if (!event) { - printf(RED "ERROR: " RESET "Event creation/signing failed\n"); - nostr_cleanup(); - return 0; - } - printf(GREEN "GOOD: " RESET "Event signing works\n"); - cJSON_Delete(event); - - // Test NIP-44 encryption if available - char plaintext[] = "Hello, NOSTR!"; - char encrypted[1024]; - char decrypted[1024]; - - // Generate recipient keys - unsigned char recipient_private[32], recipient_public[32]; - nostr_generate_keypair(recipient_private, recipient_public); - - if (nostr_nip44_encrypt(private_key, recipient_public, plaintext, encrypted, sizeof(encrypted)) == NOSTR_SUCCESS) { - if (nostr_nip44_decrypt(recipient_private, public_key, encrypted, decrypted, sizeof(decrypted)) == NOSTR_SUCCESS) { - if (strcmp(plaintext, decrypted) == 0) { - printf(GREEN "EXCELLENT: " RESET "NIP-44 encryption/decryption works\n"); - } else { - printf(YELLOW "WARNING: " RESET "NIP-44 decryption mismatch\n"); - } - } else { - printf(YELLOW "WARNING: " RESET "NIP-44 decryption failed\n"); - } - } else { - printf(YELLOW "WARNING: " RESET "NIP-44 encryption failed (may not be enabled)\n"); - } - - nostr_cleanup(); - return 1; -} - -// Test 5: Library Size and Content Verification -static int test_library_size_and_content(void) { - struct stat st; - char command[512]; - char output[4096]; - - printf("Verifying library size and content...\n"); - - // Check library size - if (stat("../libnostr_core.a", &st) != 0) { - printf(RED "ERROR: " RESET "Cannot stat libnostr_core.a\n"); - return 0; - } - - size_t lib_size = st.st_size; - printf("Library size: %zu bytes (%.2f MB)\n", lib_size, lib_size / 1024.0 / 1024.0); - - // Expect "fat" library to be at least 1MB (with secp256k1 bundled) - if (lib_size < 1024 * 1024) { - printf(YELLOW "WARNING: " RESET "Library seems small (%.2f MB). May not include secp256k1.\n", - lib_size / 1024.0 / 1024.0); - } else { - printf(GREEN "GOOD: " RESET "Library size suggests secp256k1 is bundled\n"); - } - - // List archive contents - snprintf(command, sizeof(command), "ar -t ../libnostr_core.a | wc -l"); - if (run_command(command, output, sizeof(output)) == 0) { - int object_count = atoi(output); - printf("Archive contains %d object files\n", object_count); - - if (object_count > 20) { - printf(GREEN "EXCELLENT: " RESET "High object count suggests secp256k1 objects included\n"); - } else { - printf(YELLOW "WARNING: " RESET "Low object count (%d). secp256k1 may not be fully bundled\n", object_count); - } - } - - // Check for secp256k1-specific object files - snprintf(command, sizeof(command), "ar -t ../libnostr_core.a | grep -E '(secp256k1|ecmult)' | head -5"); - if (run_command(command, output, sizeof(output)) == 0 && strlen(output) > 0) { - printf(GREEN "EXCELLENT: " RESET "Found secp256k1 object files in archive:\n"); - printf("%s", output); - } else { - printf(YELLOW "WARNING: " RESET "No obvious secp256k1 object files found\n"); - } - - return 1; -} - -// Main test runner -int main(int argc, char* argv[]) { - (void)argc; - (void)argv; - - printf(BLUE "NOSTR Core Library - Static Linking Only Test\n"); - printf("==============================================" RESET "\n\n"); - - printf("This test verifies that the library maintains its self-contained,\n"); - printf("static-only design with no external cryptographic dependencies.\n\n"); - - // Run all tests - RUN_TEST("Library Dependency Analysis", test_library_dependency_analysis); - RUN_TEST("Symbol Resolution Verification", test_symbol_resolution_verification); - RUN_TEST("Build Process Validation", test_build_process_validation); - RUN_TEST("Runtime Independence Test", test_runtime_independence); - RUN_TEST("Library Size and Content Verification", test_library_size_and_content); - - // Print summary - printf(BLUE "============================================\n"); - printf("TEST SUMMARY\n"); - printf("============================================" RESET "\n"); - printf("Tests run: %d\n", tests_run); - printf("Tests passed: %d\n", tests_passed); - - if (tests_passed == tests_run) { - printf(GREEN "ALL TESTS PASSED!" RESET "\n"); - printf("✅ Library maintains static-only design\n"); - printf("✅ No external crypto dependencies\n"); - printf("✅ Self-contained and portable\n"); - } else { - printf(RED "SOME TESTS FAILED!" RESET "\n"); - printf("❌ %d out of %d tests failed\n", tests_run - tests_passed, tests_run); - printf("⚠️ Library may have external dependencies or missing components\n"); - } - - return (tests_passed == tests_run) ? 0 : 1; -} diff --git a/tests/sync_relay_test b/tests/sync_relay_test new file mode 100755 index 00000000..58934b7a Binary files /dev/null and b/tests/sync_relay_test differ diff --git a/tests/old/sync_test.c b/tests/sync_relay_test.c similarity index 98% rename from tests/old/sync_test.c rename to tests/sync_relay_test.c index 1762fa40..9bbf9255 100644 --- a/tests/old/sync_test.c +++ b/tests/sync_relay_test.c @@ -9,11 +9,13 @@ #include #include -#include #include -#include "../nostr_core/nostr_core.h" +#include "../nostr_core/nostr_common.h" #include "../cjson/cJSON.h" + + + // Helper function to get mode name for display const char* get_mode_name(relay_query_mode_t mode) { switch (mode) { @@ -67,7 +69,7 @@ int main() { const char* test_relays[] = { "ws://127.0.0.1:7777", "wss://relay.laantungir.net", - "wss://relay.corpum.com" + "wss://nostr.mom" }; int relay_count = 3; diff --git a/tests/wss_test b/tests/wss_test new file mode 100755 index 00000000..129f7bb9 Binary files /dev/null and b/tests/wss_test differ