nostr_core_lib/example_basic.c

41 lines
1.1 KiB
C

/*
* Example: Basic NOSTR functionality
* This example shows auto-detection working with selective includes
*/
#include "nostr_core/nip001.h" // Basic protocol
#include "nostr_core/nip006.h" // Key generation (will be created next)
#include "nostr_core/nip019.h" // Bech32 encoding (will be created next)
#include <stdio.h>
int main() {
printf("NOSTR Core Library - Basic Example\n");
// Initialize library
if (nostr_init() != 0) {
printf("Failed to initialize NOSTR library\n");
return 1;
}
printf("Library initialized successfully!\n");
// Generate keypair (from NIP-006)
// unsigned char private_key[32], public_key[32];
// nostr_generate_keypair(private_key, public_key);
// Convert to bech32 (from NIP-019)
// char nsec[100];
// nostr_key_to_bech32(private_key, "nsec", nsec);
// Create basic event (from NIP-001)
// cJSON* event = nostr_create_and_sign_event(1, "Hello Nostr!", NULL, private_key, 0);
printf("Example completed - the build script should detect NIPs: 001, 006, 019\n");
// Cleanup
nostr_cleanup();
return 0;
}