BREAKING CHANGE: Library now requires system-installed dependencies Major Changes: - Convert secp256k1 from bundled static lib to system dependency - Convert OpenSSL from bundled static lib to system dependency - Convert curl from bundled static lib to system dependency - Update build.sh with pkg-config detection and fallback logic - Remove all static library extraction/building logic - Update README.md with new dependency requirements and installation Build System: - Add detect_system_secp256k1() with pkg-config support - Add detect_system_openssl() with pkg-config support - Add detect_system_curl() with pkg-config support - Remove secp256k1 building/extraction from ar archive - Update CFLAGS and LIBS to use system library variables - Clear error messages for missing dependencies with install commands Documentation: - Add system dependency installation for Ubuntu/Debian/CentOS/macOS - Update all compile/link examples to include -lssl -lcrypto -lcurl -lsecp256k1 - Remove references to 'self-contained' and 'no external dependencies' - Update integration examples throughout README Benefits: - Smaller library size (only internal code bundled) - Automatic security updates via system package manager - Standard Linux library distribution pattern - Reduced build complexity - Better system integration with pkg-config Required Installation: Ubuntu/Debian: sudo apt install libssl-dev libcurl4-openssl-dev libsecp256k1-dev CentOS/RHEL: sudo yum install openssl-devel libcurl-devel libsecp256k1-devel macOS: brew install openssl curl secp256k1
34 lines
900 B
C
34 lines
900 B
C
#include "nip004.h"
|
|
#include "utils.h"
|
|
#include <stdio.h>
|
|
|
|
int main() {
|
|
printf("Testing crypto initialization...\n");
|
|
|
|
if (nostr_crypto_init() != 0) {
|
|
printf("❌ Crypto init failed\n");
|
|
return 1;
|
|
}
|
|
printf("✅ Crypto init successful\n");
|
|
|
|
// Test random bytes generation
|
|
unsigned char random_bytes[16];
|
|
if (nostr_secp256k1_get_random_bytes(random_bytes, 16) != 1) {
|
|
printf("❌ Random bytes generation failed\n");
|
|
return 1;
|
|
}
|
|
printf("✅ Random bytes generation successful\n");
|
|
|
|
// Test base64 encoding
|
|
char output[64];
|
|
size_t encoded_len = base64_encode(random_bytes, 16, output, sizeof(output));
|
|
if (encoded_len == 0) {
|
|
printf("❌ Base64 encoding failed\n");
|
|
return 1;
|
|
}
|
|
printf("✅ Base64 encoding successful: %s\n", output);
|
|
|
|
nostr_crypto_cleanup();
|
|
return 0;
|
|
}
|