v0.1.12 - Successfully integrated websocket client, and program connects to relays and publishes kinds 0 and 10002
This commit is contained in:
@@ -529,7 +529,7 @@ int nostr_validate_unified_request(const nostr_unified_request_t *request,
|
||||
"VALIDATOR_DEBUG: STEP 10 FAILED - NIP-42 requires request_url and "
|
||||
"challenge (from event tags)\n");
|
||||
result->valid = 0;
|
||||
result->error_code = NOSTR_ERROR_NIP42_NOT_CONFIGURED;
|
||||
result->error_code = NOSTR_ERROR_NIP42_INVALID_CHALLENGE;
|
||||
strcpy(result->reason, "NIP-42 authentication requires request_url and challenge in event tags");
|
||||
cJSON_Delete(event);
|
||||
return NOSTR_SUCCESS;
|
||||
@@ -549,15 +549,12 @@ int nostr_validate_unified_request(const nostr_unified_request_t *request,
|
||||
|
||||
// Map specific NIP-42 error codes to detailed error messages
|
||||
switch (nip42_result) {
|
||||
case NOSTR_ERROR_NIP42_CHALLENGE_NOT_FOUND:
|
||||
strcpy(result->reason, "Challenge not found or has been used. Request a new challenge from /auth endpoint.");
|
||||
case NOSTR_ERROR_NIP42_INVALID_CHALLENGE:
|
||||
strcpy(result->reason, "Challenge not found or invalid. Request a new challenge from /auth endpoint.");
|
||||
break;
|
||||
case NOSTR_ERROR_NIP42_CHALLENGE_EXPIRED:
|
||||
strcpy(result->reason, "Challenge has expired. Request a new challenge from /auth endpoint.");
|
||||
break;
|
||||
case NOSTR_ERROR_NIP42_INVALID_CHALLENGE:
|
||||
strcpy(result->reason, "Invalid challenge format. Challenge must be a valid hex string.");
|
||||
break;
|
||||
case NOSTR_ERROR_NIP42_URL_MISMATCH:
|
||||
strcpy(result->reason, "Relay URL in auth event does not match server. Use 'ginxsom' as relay value.");
|
||||
break;
|
||||
@@ -576,12 +573,6 @@ int nostr_validate_unified_request(const nostr_unified_request_t *request,
|
||||
case NOSTR_ERROR_EVENT_INVALID_TAGS:
|
||||
strcpy(result->reason, "Required tags missing. Auth event must include 'relay' and 'expiration' tags.");
|
||||
break;
|
||||
case NOSTR_ERROR_NIP42_INVALID_RELAY_URL:
|
||||
strcpy(result->reason, "Invalid relay URL in tags. Use 'ginxsom' as the relay identifier.");
|
||||
break;
|
||||
case NOSTR_ERROR_NIP42_NOT_CONFIGURED:
|
||||
strcpy(result->reason, "NIP-42 authentication not properly configured on server.");
|
||||
break;
|
||||
default:
|
||||
snprintf(result->reason, sizeof(result->reason),
|
||||
"NIP-42 authentication failed (error code: %d). Check event structure and signature.",
|
||||
@@ -1907,7 +1898,7 @@ static int validate_challenge(const char *challenge_id) {
|
||||
}
|
||||
|
||||
validator_debug_log("NIP-42: Challenge not found\n");
|
||||
return NOSTR_ERROR_NIP42_CHALLENGE_NOT_FOUND;
|
||||
return NOSTR_ERROR_NIP42_INVALID_CHALLENGE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user