Last version before deleting Makefile and CmakeLists.txt
This commit is contained in:
40
example_basic.c
Normal file
40
example_basic.c
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* 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;
|
||||
}
|
||||
Reference in New Issue
Block a user