═══════════════════════════════════════════════════════════════════
🔧 COMPREHENSIVE NOSTR EVENT VALIDATION DEBUG TEST 🔧
═══════════════════════════════════════════════════════════════════
🔍 STEP INIT-1: Initializing nostr library
✅ SUCCESS: Nostr library initialized
ℹ️  INFO: Testing Authorization header:
Nostr eyJraW5kIjoyNDI0MiwiaWQiOiI5NTYxNjA1YjEwNjJjZTM3ZTk1YWI5YjgxZDMwMGQ5YWQ1YmZiOWM1NDRhZTM5NWUxZWI0MWYwMDBjN2Q4OWY2IiwicHVia2V5IjoiNzliZTY2N2VmOWRjYmJhYzU1YTA2Mjk1Y2U4NzBiMDcwMjliZmNkYjJkY2UyOGQ5NTlmMjgxNWIxNmY4MTc5OCIsImNyZWF0ZWRfYXQiOjE3NTU2ODU0MjgsInRhZ3MiOltbInQiLCJ1cGxvYWQiXSxbIngiLCI4NDcxNjE3MWJhYjE2YWQwMjFiZDg5NTMwNTAxODlmZTYwNzU5MTc0MzZjZDExY2M5MzNmMDIxYmJjNWQ1YjBiIl0sWyJleHBpcmF0aW9uIiwiMTc1NTY4OTAyOCJdXSwiY29udGVudCI6IiIsInNpZyI6Ijk1MzE2YWI3NWY4ZDAyYmI5OTVhMTI0OGMyNzRiOTlmOWJjNWRjMGFmNTY0OWU2OTQ5MDE1ZDA2OTkwNGQ0YmRmM2EzYzc5NDI3YWM4MjQ1Njk4NmEyZTkzN2IxZDI1YjZkMmVlOGVlMWU0NDZhODQ5Y2IxOTc3NGRmOTQ4ZWFkIn0=
═══════════════════════════════════════════════════════════════════
🔍 STEP PARSE-1: Parsing Authorization header
DEBUG: parse_authorization_header called with header: Nostr eyJraW5kIjoyNDI0MiwiaWQiOiI5NTYxNjA1YjEwNjJj...
DEBUG: Extracted base64 event (length=616): eyJraW5kIjoyNDI0MiwiaWQiOiI5NTYxNjA1YjEwNjJjZTM3ZTk1YWI5YjgxZDMwMGQ5YWQ1YmZiOWM1NDRhZTM5NWUxZWI0MWYw...
DEBUG: Base64 decode result - decoded_len=461
DEBUG: Successfully decoded JSON (length=461): {"kind":24242,"id":"9561605b1062ce37e95ab9b81d300d9ad5bfb9c544ae395e1eb41f000c7d89f6","pubkey":"79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","created_at":1755685428,"tags":[["t","upload"],["x","84716171bab16ad021bd8953050189fe6075917436cd11cc933f021bbc5d5b0b"],["expiration","1755689028"]],"content":"","sig":"95316ab75f8d02bb995a1248c274b99f9bc5dc0af5649e6949015d069904d4bdf3a3c79427ac82456986a2e937b1d25b6d2ee8ee1e446a849cb19774df948ead"}
✅ SUCCESS: Authorization header parsed successfully
ℹ️  INFO: Decoded JSON: {"kind":24242,"id":"9561605b1062ce37e95ab9b81d300d9ad5bfb9c544ae395e1eb41f000c7d89f6","pubkey":"79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","created_at":1755685428,"tags":[["t","upload"],["x","84716171bab16ad021bd8953050189fe6075917436cd11cc933f021bbc5d5b0b"],["expiration","1755689028"]],"content":"","sig":"95316ab75f8d02bb995a1248c274b99f9bc5dc0af5649e6949015d069904d4bdf3a3c79427ac82456986a2e937b1d25b6d2ee8ee1e446a849cb19774df948ead"}
🔍 STEP PARSE-2: Parsing JSON string
✅ SUCCESS: JSON parsing successful
═══════════════════════════════════════════════════════════════════
🔍 STEP ANALYZE-1: Analyzing event field details
ℹ️  INFO: Field 'kind':
ℹ️  INFO:   Type: Number
ℹ️  INFO:   Value: 24242
ℹ️  INFO: Field 'id':
ℹ️  INFO:   Type: String
ℹ️  INFO:   Value: '9561605b1062ce37e95ab9b81d300d9ad5bfb9c544ae395e1eb41f000c7d89f6'
ℹ️  INFO:   Length: 64
ℹ️  INFO: Field 'pubkey':
ℹ️  INFO:   Type: String
ℹ️  INFO:   Value: '79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798'
ℹ️  INFO:   Length: 64
ℹ️  INFO: Field 'created_at':
ℹ️  INFO:   Type: Number
ℹ️  INFO:   Value: 1755685428
ℹ️  INFO: Field 'tags':
ℹ️  INFO:   Type: Array
ℹ️  INFO:   Size: 3
ℹ️  INFO: Field 'content':
ℹ️  INFO:   Type: String
ℹ️  INFO:   Value: ''
ℹ️  INFO:   Length: 0
ℹ️  INFO: Field 'sig':
ℹ️  INFO:   Type: String
ℹ️  INFO:   Value: '95316ab75f8d02bb995a1248c274b99f9bc5dc0af5649e6949015d069904d4bdf3a3c79427ac82456986a2e937b1d25b6d2ee8ee1e446a849cb19774df948ead'
ℹ️  INFO:   Length: 128
🔍 STEP MAIN-1: Running detailed structure validation
═══════════════════════════════════════════════════════════════════
🔍 STEP STRUCT-1: Starting detailed structure validation
✅ SUCCESS: Event is valid JSON object
🔍 STEP STRUCT-2: Checking required field existence
✅ SUCCESS: Field 'id' exists
✅ SUCCESS: Field 'pubkey' exists
✅ SUCCESS: Field 'created_at' exists
✅ SUCCESS: Field 'kind' exists
✅ SUCCESS: Field 'tags' exists
✅ SUCCESS: Field 'content' exists
✅ SUCCESS: Field 'sig' exists
🔍 STEP STRUCT-3: Validating field types
✅ SUCCESS: Field 'id' is string
✅ SUCCESS: Field 'pubkey' is string
✅ SUCCESS: Field 'created_at' is number
✅ SUCCESS: Field 'kind' is number
✅ SUCCESS: Field 'tags' is array
✅ SUCCESS: Field 'content' is string
✅ SUCCESS: Field 'sig' is string
🔍 STEP STRUCT-4: Validating hex string lengths
ℹ️  INFO: ID string: '9561605b1062ce37e95ab9b81d300d9ad5bfb9c544ae395e1eb41f000c7d89f6' (length: 64)
✅ SUCCESS: ID string length is correct (64 chars)
ℹ️  INFO: Pubkey string: '79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798' (length: 64)
✅ SUCCESS: Pubkey string length is correct (64 chars)
ℹ️  INFO: Signature string: '95316ab75f8d02bb995a1248c274b99f9bc5dc0af5649e6949015d069904d4bdf3a3c79427ac82456986a2e937b1d25b6d2ee8ee1e446a849cb19774df948ead' (length: 128)
✅ SUCCESS: Signature string length is correct (128 chars)
🔍 STEP STRUCT-5: Validating hex characters
ℹ️  INFO: Checking ID hex characters...
✅ SUCCESS: ID hex characters are valid (lowercase)
ℹ️  INFO: Checking pubkey hex characters...
✅ SUCCESS: Pubkey hex characters are valid (lowercase)
ℹ️  INFO: Checking signature hex characters...
✅ SUCCESS: Signature hex characters are valid (lowercase)
🔍 STEP STRUCT-6: Validating timestamp
ℹ️  INFO: Created_at timestamp: 1755685428
✅ SUCCESS: Timestamp is valid: 2025-08-20 10:23:48 UTC
🔍 STEP STRUCT-7: Validating kind
ℹ️  INFO: Event kind: 24242
✅ SUCCESS: Kind is valid: 24242
🔍 STEP STRUCT-8: Validating tags array structure
ℹ️  INFO: Tags array has 3 elements
ℹ️  INFO: Tag[0] has 2 elements
ℹ️  INFO: Tag[0][0]: 't'
ℹ️  INFO: Tag[0][1]: 'upload'
ℹ️  INFO: Tag[1] has 2 elements
ℹ️  INFO: Tag[1][0]: 'x'
ℹ️  INFO: Tag[1][1]: '84716171bab16ad021bd8953050189fe6075917436cd11cc933f021bbc5d5b0b'
ℹ️  INFO: Tag[2] has 2 elements
ℹ️  INFO: Tag[2][0]: 'expiration'
ℹ️  INFO: Tag[2][1]: '1755689028'
✅ SUCCESS: Tags array structure is valid
🔍 STEP STRUCT-9: Validating content
ℹ️  INFO: Content: '' (length: 0)
✅ SUCCESS: Content is valid string
✅ SUCCESS: Structure validation completed successfully
✅ SUCCESS: Detailed structure validation PASSED
🔍 STEP MAIN-2: Running detailed signature validation
═══════════════════════════════════════════════════════════════════
🔍 STEP CRYPTO-1: Starting detailed signature validation
🔍 STEP CRYPTO-2: Creating serialization array
✅ SUCCESS: Serialization array created
🔍 STEP CRYPTO-3: Converting to JSON string
✅ SUCCESS: JSON serialization string created
ℹ️  INFO: Serialization string (length 208): [0,"79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798",1755685428,24242,[["t","upload"],["x","84716171bab16ad021bd8953050189fe6075917436cd11cc933f021bbc5d5b0b"],["expiration","1755689028"]],""]
🔍 STEP CRYPTO-4: Computing SHA256 hash
✅ SUCCESS: SHA256 hash computed
ℹ️  INFO: Event hash (32 bytes):
  0000: 95 61 60 5b 10 62 ce 37 e9 5a b9 b8 1d 30 0d 9a  |.a`[.b.7.Z...0..|
  0010: d5 bf b9 c5 44 ae 39 5e 1e b4 1f 00 0c 7d 89 f6  |....D.9^.....}..|
🔍 STEP CRYPTO-5: Verifying event ID
ℹ️  INFO: Calculated ID: 9561605b1062ce37e95ab9b81d300d9ad5bfb9c544ae395e1eb41f000c7d89f6
ℹ️  INFO: Provided ID:   9561605b1062ce37e95ab9b81d300d9ad5bfb9c544ae395e1eb41f000c7d89f6
✅ SUCCESS: Event ID verification passed
🔍 STEP CRYPTO-6: Preparing signature verification
🔍 STEP CRYPTO-7: Converting hex strings to bytes
✅ SUCCESS: Pubkey hex converted to bytes
ℹ️  INFO: Pubkey bytes (32 bytes):
  0000: 79 be 66 7e f9 dc bb ac 55 a0 62 95 ce 87 0b 07  |y.f~....U.b.....|
  0010: 02 9b fc db 2d ce 28 d9 59 f2 81 5b 16 f8 17 98  |....-.(.Y..[....|
✅ SUCCESS: Signature hex converted to bytes
ℹ️  INFO: Signature bytes (64 bytes):
  0000: 95 31 6a b7 5f 8d 02 bb 99 5a 12 48 c2 74 b9 9f  |.1j._....Z.H.t..|
  0010: 9b c5 dc 0a f5 64 9e 69 49 01 5d 06 99 04 d4 bd  |.....d.iI.].....|
  0020: f3 a3 c7 94 27 ac 82 45 69 86 a2 e9 37 b1 d2 5b  |....'..Ei...7..[|
  0030: 6d 2e e8 ee 1e 44 6a 84 9c b1 97 74 df 94 8e ad  |m....Dj....t....|
🔍 STEP CRYPTO-8: Parsing public key into secp256k1 format
✅ SUCCESS: Public key parsed into secp256k1 format
🔍 STEP CRYPTO-9: Verifying Schnorr signature
✅ SUCCESS: Schnorr signature verification PASSED!
✅ SUCCESS: Detailed signature validation PASSED
═══════════════════════════════════════════════════════════════════
🔍 STEP COMPARE-1: Running standard nostr_validate_event for comparison
ℹ️  INFO: nostr_validate_event result: 0 (Success)
✅ SUCCESS: Standard validation PASSED - matches detailed validation
═══════════════════════════════════════════════════════════════════
✅ SUCCESS: 🎉 ALL VALIDATIONS PASSED! Event is completely valid.
✅ Structure validation: PASSED
✅ Signature validation: PASSED
✅ Standard validation:  PASSED
═══════════════════════════════════════════════════════════════════
