Last version before deleting Makefile and CmakeLists.txt
This commit is contained in:
84
nostr_core/nip011.h
Normal file
84
nostr_core/nip011.h
Normal file
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* NOSTR Core Library - NIP-011: Relay Information Document
|
||||
*/
|
||||
|
||||
#ifndef NIP011_H
|
||||
#define NIP011_H
|
||||
|
||||
#include "nip001.h"
|
||||
#include <stddef.h>
|
||||
|
||||
// NIP-11 Relay Information structures
|
||||
|
||||
// Basic relay information
|
||||
typedef struct {
|
||||
char* name;
|
||||
char* description;
|
||||
char* pubkey;
|
||||
char* contact;
|
||||
char* software;
|
||||
char* version;
|
||||
int* supported_nips;
|
||||
size_t supported_nips_count;
|
||||
} nostr_relay_basic_info_t;
|
||||
|
||||
// Relay limitations
|
||||
typedef struct {
|
||||
int max_message_length;
|
||||
int max_subscriptions;
|
||||
int max_filters;
|
||||
int max_limit;
|
||||
int max_subid_length;
|
||||
int min_prefix;
|
||||
int max_event_tags;
|
||||
int max_content_length;
|
||||
int min_pow_difficulty;
|
||||
int auth_required; // -1 = not specified, 0 = false, 1 = true
|
||||
int payment_required; // -1 = not specified, 0 = false, 1 = true
|
||||
int restricted_writes; // -1 = not specified, 0 = false, 1 = true
|
||||
long created_at_lower_limit;
|
||||
long created_at_upper_limit;
|
||||
} nostr_relay_limitations_t;
|
||||
|
||||
// Content limitations
|
||||
typedef struct {
|
||||
char** relay_countries;
|
||||
size_t relay_countries_count;
|
||||
} nostr_relay_content_limitations_t;
|
||||
|
||||
// Community preferences
|
||||
typedef struct {
|
||||
char** language_tags;
|
||||
size_t language_tags_count;
|
||||
char** tags;
|
||||
size_t tags_count;
|
||||
char* posting_policy;
|
||||
} nostr_relay_community_preferences_t;
|
||||
|
||||
// Icon information
|
||||
typedef struct {
|
||||
char* icon;
|
||||
} nostr_relay_icon_t;
|
||||
|
||||
// Complete relay information structure
|
||||
typedef struct {
|
||||
nostr_relay_basic_info_t basic;
|
||||
|
||||
int has_limitations;
|
||||
nostr_relay_limitations_t limitations;
|
||||
|
||||
int has_content_limitations;
|
||||
nostr_relay_content_limitations_t content_limitations;
|
||||
|
||||
int has_community_preferences;
|
||||
nostr_relay_community_preferences_t community_preferences;
|
||||
|
||||
int has_icon;
|
||||
nostr_relay_icon_t icon;
|
||||
} nostr_relay_info_t;
|
||||
|
||||
// Function declarations
|
||||
int nostr_nip11_fetch_relay_info(const char* relay_url, nostr_relay_info_t** info_out, int timeout_seconds);
|
||||
void nostr_nip11_relay_info_free(nostr_relay_info_t* info);
|
||||
|
||||
#endif // NIP011_H
|
||||
Reference in New Issue
Block a user