9.3 KiB
9.3 KiB
=== NIP-42 Authentication Test Started ===
2026-04-03 06:54:31 - Starting NIP-42 authentication tests
[INFO] === Starting NIP-42 Authentication Tests ===
[INFO] Checking dependencies...
[WARNING] wscat not found. Some manual WebSocket tests will be skipped
[WARNING] Install with: npm install -g wscat
[SUCCESS] Dependencies check complete
[INFO] Test 1: Checking NIP-42 support in relay info
[SUCCESS] NIP-42 is advertised in supported NIPs
2026-04-03 06:54:31 - Supported NIPs: 1,2,4,9,11,12,13,15,16,20,22,33,40,42,50,70
[INFO] Test 2: Testing AUTH challenge generation
[WARNING] Could not extract admin private key from relay.log - using manual test approach
[INFO] Manual test: Connect to relay and send an event without auth to trigger challenge
[INFO] Test 3: Testing complete NIP-42 authentication flow
[INFO] Generated test keypair: test_pubkey
[INFO] Attempting to publish event without authentication...
[INFO] Publishing test event to relay...
2026-04-03 06:54:32 - Event publish result: connecting to localhost:8888... ok.
{"kind":1,"id":"8a51708dfcc53c5edbf47aeab1ae56b97899694794d8affd7739c3f7b87b610a","pubkey":"8c7bd82b022d6e697d31815fb00e1f64dd4b3ba7592b24a31b75f2a721beb93b","created_at":1775213671,"tags":[],"content":"NIP-42 test event - should require auth","sig":"557b2621ed7f582a2f928a4c29b8f4e396a12c7c41690241eb58a92c60f072c67507fa670fabf1ed63a6d4c4ca8c3d4166b9e08cc2a1550e5508c6f989e62de3"}
publishing to ws://localhost:8888... success.
[SUCCESS] Relay requested authentication as expected
[INFO] Test 4: Testing WebSocket AUTH message handling
[WARNING] Skipping WebSocket tests - wscat not available
[INFO] Test 5: Testing NIP-42 configuration options
[INFO] Retrieving current relay configuration...
[WARNING] Could not retrieve configuration events
[INFO] Test 6: Testing NIP-42 performance and stability
[INFO] Testing multiple authentication attempts...
2026-04-03 06:54:32 - Attempt 1: .192952597s - connecting to localhost:8888... ok.
{"kind":1,"id":"a48afbcfff3ab978445520e96e8e810aad931c833c471c35d9b303a4f390da6b","pubkey":"c249bdf23a777d5fb928438ac3d4cd518b73e8fb50b9e1db7ec865efdd23a7ac","created_at":1775213672,"tags":[],"content":"Performance test event 1","sig":"392986c6ead33401e004fbb4f4966ddff7121c9807b061dcb3fc5a495de963b655f4177242e1a39c1b9ccb86dd303481395be627893196b342004e943ddae60b"}
publishing to ws://localhost:8888... success.
2026-04-03 06:54:33 - Attempt 2: .199129450s - connecting to localhost:8888... ok.
{"kind":1,"id":"f4ac3b73a902a6f3c627a1a5b8bafdba1e835e03355082ec28d00f1fd62aa067","pubkey":"c249bdf23a777d5fb928438ac3d4cd518b73e8fb50b9e1db7ec865efdd23a7ac","created_at":1775213673,"tags":[],"content":"Performance test event 2","sig":"06afeeda5a7d157c4347b8cb754c791173da9cb6c00844e714b1da8fc32812ec525adeec6f9b75417f6be163d74486df9a6b656af4b08aa415d63db197c4ee75"}
publishing to ws://localhost:8888... success.
2026-04-03 06:54:33 - Attempt 3: .188421441s - connecting to localhost:8888... ok.
{"kind":1,"id":"df8273cd2870e7f3ea091f07fb0f5cbd97b7ffaf39838798f90589b9f86cce8f","pubkey":"c249bdf23a777d5fb928438ac3d4cd518b73e8fb50b9e1db7ec865efdd23a7ac","created_at":1775213673,"tags":[],"content":"Performance test event 3","sig":"139fe32222df11d18101b44cf9d831c1c1a4ed92b5baff8c30af7da798426cb872c69fecb8292a625ad85f44066b4a6ff733ec1b56ab3910d09426bb1213f630"}
publishing to ws://localhost:8888... success.
2026-04-03 06:54:34 - Attempt 4: .188708837s - connecting to localhost:8888... ok.
{"kind":1,"id":"03d9ac7f2e1d3d6f1245419030125b04da85e10780334a1ec047a3fbfb0ff63d","pubkey":"c249bdf23a777d5fb928438ac3d4cd518b73e8fb50b9e1db7ec865efdd23a7ac","created_at":1775213673,"tags":[],"content":"Performance test event 4","sig":"d6c182b0f5de8958600018522f8205ecfbe52c1c0e2dcf8dd284cd2d4ee9574f6faf552fd0c9ad86b5cf9ace0004de166a2c2a49e91473baa919b95e25749fe5"}
publishing to ws://localhost:8888... success.
2026-04-03 06:54:34 - Attempt 5: .185255190s - connecting to localhost:8888... ok.
{"kind":1,"id":"d66f7c81d0d3feedcffceb21e154830ca2eed3a5f12fd82487cd2e62a0686551","pubkey":"c249bdf23a777d5fb928438ac3d4cd518b73e8fb50b9e1db7ec865efdd23a7ac","created_at":1775213674,"tags":[],"content":"Performance test event 5","sig":"5881990789e0e08b8edd15da976e608c8f82e25054ba3c70088288d981680fa84bb369e9d63f6a5115b25c863fadc30f156cc710a6b57833d6f812e1b4a8a25a"}
publishing to ws://localhost:8888... success.
[SUCCESS] Performance test completed: 5/5 successful responses
[INFO] Test 7: Testing kind-specific NIP-42 authentication requirements
[INFO] Generated test keypair for kind-specific tests: test_pubkey
[INFO] Testing kind 1 event (regular note) - should work without authentication...
2026-04-03 06:54:35 - Kind 1 event result: connecting to localhost:8888... ok.
{"kind":1,"id":"f8d497058ff70d53728f3f8b862ce5b381f6555db67620e0da47cb89d2c3d6e0","pubkey":"26e49670b48e5520753879c0c6f2a144ad98acaf524e54b4c0389b4882fec048","created_at":1775213675,"tags":[],"content":"Regular note - should not require auth","sig":"d492893112deb591eeecda03654e6610c8b52e050826702005497918a4cf7bdf390d1702e46c13d581def1a041e034b2a39dfec5730fb5ec027321026496c130"}
publishing to ws://localhost:8888... success.
[SUCCESS] Kind 1 event accepted without authentication (correct behavior)
[INFO] Testing kind 4 event (direct message) - should require authentication...
2026-04-03 06:54:45 - Kind 4 event result: connecting to localhost:8888... ok.
{"kind":4,"id":"f2d20b15cf31f6107ff582d2e7a39fda1f578d2c2760740c0079bc39a6bddf16","pubkey":"26e49670b48e5520753879c0c6f2a144ad98acaf524e54b4c0389b4882fec048","created_at":1775213675,"tags":[["p,test_pubkey"]],"content":"This is a direct message - should require auth","sig":"dfe27324122441339808abeb533606718ca320b9694dad2410b91d08c56455e93674ba509062828f2125348f20e4117e438d2fa043b6fbfe7bbd06426e0467af"}
publishing to ws://localhost:8888...
[SUCCESS] Kind 4 event requested authentication (correct behavior for DMs)
[INFO] Testing kind 14 event (chat message) - should require authentication...
2026-04-03 06:54:55 - Kind 14 event result: connecting to localhost:8888... ok.
{"kind":14,"id":"a51d6d54aa8618c3ab2e5b39585847942817281615699befcb7469aeac7ca48c","pubkey":"26e49670b48e5520753879c0c6f2a144ad98acaf524e54b4c0389b4882fec048","created_at":1775213685,"tags":[["p,test_pubkey"]],"content":"Chat message - should require auth","sig":"bbe020047f6f5ed1e2a9a51287bc49b4e5c02f8914ae1387272928b942008a4a725eaee7a05ce750cae71d54f8cbf53f7e4a0765411b48429cbb5c57ea5c2fc6"}
publishing to ws://localhost:8888...
[SUCCESS] Kind 14 event requested authentication (correct behavior for DMs)
[INFO] Testing other event kinds - should work without authentication...
2026-04-03 06:54:56 - Kind 0 event result: connecting to localhost:8888... ok.
{"kind":0,"id":"9c1f0b16cedd06789b1f00adf59cadfc5d63a33a25c9b34a11c269b2f902b77f","pubkey":"26e49670b48e5520753879c0c6f2a144ad98acaf524e54b4c0389b4882fec048","created_at":1775213695,"tags":[],"content":"Test event kind 0 - should not require auth","sig":"bd37bd831569fa12a77508fbd722903da8655056e7f10352629ff7ee025be7d7d5b8a7470b3c40ce3c1cb950d7f8ef9a1aece431d1cc1680fb8ee831cb0e04e2"}
publishing to ws://localhost:8888... success.
[SUCCESS] Kind 0 event accepted without authentication (correct)
2026-04-03 06:54:56 - Kind 3 event result: connecting to localhost:8888... ok.
{"kind":3,"id":"0419f1522362986946630e056905e3abb6340c9db38d9db4c2e60d0451fc07a9","pubkey":"26e49670b48e5520753879c0c6f2a144ad98acaf524e54b4c0389b4882fec048","created_at":1775213696,"tags":[],"content":"Test event kind 3 - should not require auth","sig":"980ef210c9f12b79e4769e93a2d1c9737d7ec48abe584f4c8d193b5791fdc72bf98820108b2cd044046ca4d625ad9905642c6ced0fc96737d218080504dbef84"}
publishing to ws://localhost:8888... success.
[SUCCESS] Kind 3 event accepted without authentication (correct)
2026-04-03 06:54:56 - Kind 7 event result: connecting to localhost:8888... ok.
{"kind":7,"id":"973125984064b9f748dabe16a1f630483f9549d8395cd81bdd239691d5a5517b","pubkey":"26e49670b48e5520753879c0c6f2a144ad98acaf524e54b4c0389b4882fec048","created_at":1775213696,"tags":[],"content":"Test event kind 7 - should not require auth","sig":"15b7e57d59cbeba58169a46c6b40a3a82c18d47c41b1733f557d055a76fabd06782db2b0bf926a3ab785146dd6a6865b31ec2d5141296dd3a787b8aa966699b1"}
publishing to ws://localhost:8888... success.
[SUCCESS] Kind 7 event accepted without authentication (correct)
[INFO] Kind-specific authentication test completed
[INFO] === NIP-42 Test Results Summary ===
[SUCCESS] Dependencies: PASS
[SUCCESS] NIP-42 Support: PASS
[SUCCESS] Auth Challenge: PASS
[SUCCESS] Auth Flow: PASS
[SUCCESS] WebSocket AUTH: PASS
[SUCCESS] Configuration: PASS
[SUCCESS] Performance: PASS
[SUCCESS] Kind-Specific Auth: PASS
[SUCCESS] All NIP-42 tests completed successfully!
[SUCCESS] NIP-42 authentication implementation is working correctly
[INFO] === NIP-42 Authentication Tests Complete ===
2026-04-03 06:54:31 - Starting NIP-42 authentication tests
[INFO] === Starting NIP-42 Authentication Tests ===
[INFO] Checking dependencies...
[WARNING] wscat not found. Some manual WebSocket tests will be skipped
[WARNING] Install with: npm install -g wscat
[SUCCESS] Dependencies check complete
[INFO] Test 1: Checking NIP-42 support in relay info
[SUCCESS] NIP-42 is advertised in supported NIPs
2026-04-03 06:54:31 - Supported NIPs: 1,2,4,9,11,12,13,15,16,20,22,33,40,42,50,70
[INFO] Test 2: Testing AUTH challenge generation
[WARNING] Could not extract admin private key from relay.log - using manual test approach
[INFO] Manual test: Connect to relay and send an event without auth to trigger challenge
[INFO] Test 3: Testing complete NIP-42 authentication flow
[INFO] Generated test keypair: test_pubkey
[INFO] Attempting to publish event without authentication...
[INFO] Publishing test event to relay...
2026-04-03 06:54:32 - Event publish result: connecting to localhost:8888... ok.
{"kind":1,"id":"8a51708dfcc53c5edbf47aeab1ae56b97899694794d8affd7739c3f7b87b610a","pubkey":"8c7bd82b022d6e697d31815fb00e1f64dd4b3ba7592b24a31b75f2a721beb93b","created_at":1775213671,"tags":[],"content":"NIP-42 test event - should require auth","sig":"557b2621ed7f582a2f928a4c29b8f4e396a12c7c41690241eb58a92c60f072c67507fa670fabf1ed63a6d4c4ca8c3d4166b9e08cc2a1550e5508c6f989e62de3"}
publishing to ws://localhost:8888... success.
[SUCCESS] Relay requested authentication as expected
[INFO] Test 4: Testing WebSocket AUTH message handling
[WARNING] Skipping WebSocket tests - wscat not available
[INFO] Test 5: Testing NIP-42 configuration options
[INFO] Retrieving current relay configuration...
[WARNING] Could not retrieve configuration events
[INFO] Test 6: Testing NIP-42 performance and stability
[INFO] Testing multiple authentication attempts...
2026-04-03 06:54:32 - Attempt 1: .192952597s - connecting to localhost:8888... ok.
{"kind":1,"id":"a48afbcfff3ab978445520e96e8e810aad931c833c471c35d9b303a4f390da6b","pubkey":"c249bdf23a777d5fb928438ac3d4cd518b73e8fb50b9e1db7ec865efdd23a7ac","created_at":1775213672,"tags":[],"content":"Performance test event 1","sig":"392986c6ead33401e004fbb4f4966ddff7121c9807b061dcb3fc5a495de963b655f4177242e1a39c1b9ccb86dd303481395be627893196b342004e943ddae60b"}
publishing to ws://localhost:8888... success.
2026-04-03 06:54:33 - Attempt 2: .199129450s - connecting to localhost:8888... ok.
{"kind":1,"id":"f4ac3b73a902a6f3c627a1a5b8bafdba1e835e03355082ec28d00f1fd62aa067","pubkey":"c249bdf23a777d5fb928438ac3d4cd518b73e8fb50b9e1db7ec865efdd23a7ac","created_at":1775213673,"tags":[],"content":"Performance test event 2","sig":"06afeeda5a7d157c4347b8cb754c791173da9cb6c00844e714b1da8fc32812ec525adeec6f9b75417f6be163d74486df9a6b656af4b08aa415d63db197c4ee75"}
publishing to ws://localhost:8888... success.
2026-04-03 06:54:33 - Attempt 3: .188421441s - connecting to localhost:8888... ok.
{"kind":1,"id":"df8273cd2870e7f3ea091f07fb0f5cbd97b7ffaf39838798f90589b9f86cce8f","pubkey":"c249bdf23a777d5fb928438ac3d4cd518b73e8fb50b9e1db7ec865efdd23a7ac","created_at":1775213673,"tags":[],"content":"Performance test event 3","sig":"139fe32222df11d18101b44cf9d831c1c1a4ed92b5baff8c30af7da798426cb872c69fecb8292a625ad85f44066b4a6ff733ec1b56ab3910d09426bb1213f630"}
publishing to ws://localhost:8888... success.
2026-04-03 06:54:34 - Attempt 4: .188708837s - connecting to localhost:8888... ok.
{"kind":1,"id":"03d9ac7f2e1d3d6f1245419030125b04da85e10780334a1ec047a3fbfb0ff63d","pubkey":"c249bdf23a777d5fb928438ac3d4cd518b73e8fb50b9e1db7ec865efdd23a7ac","created_at":1775213673,"tags":[],"content":"Performance test event 4","sig":"d6c182b0f5de8958600018522f8205ecfbe52c1c0e2dcf8dd284cd2d4ee9574f6faf552fd0c9ad86b5cf9ace0004de166a2c2a49e91473baa919b95e25749fe5"}
publishing to ws://localhost:8888... success.
2026-04-03 06:54:34 - Attempt 5: .185255190s - connecting to localhost:8888... ok.
{"kind":1,"id":"d66f7c81d0d3feedcffceb21e154830ca2eed3a5f12fd82487cd2e62a0686551","pubkey":"c249bdf23a777d5fb928438ac3d4cd518b73e8fb50b9e1db7ec865efdd23a7ac","created_at":1775213674,"tags":[],"content":"Performance test event 5","sig":"5881990789e0e08b8edd15da976e608c8f82e25054ba3c70088288d981680fa84bb369e9d63f6a5115b25c863fadc30f156cc710a6b57833d6f812e1b4a8a25a"}
publishing to ws://localhost:8888... success.
[SUCCESS] Performance test completed: 5/5 successful responses
[INFO] Test 7: Testing kind-specific NIP-42 authentication requirements
[INFO] Generated test keypair for kind-specific tests: test_pubkey
[INFO] Testing kind 1 event (regular note) - should work without authentication...
2026-04-03 06:54:35 - Kind 1 event result: connecting to localhost:8888... ok.
{"kind":1,"id":"f8d497058ff70d53728f3f8b862ce5b381f6555db67620e0da47cb89d2c3d6e0","pubkey":"26e49670b48e5520753879c0c6f2a144ad98acaf524e54b4c0389b4882fec048","created_at":1775213675,"tags":[],"content":"Regular note - should not require auth","sig":"d492893112deb591eeecda03654e6610c8b52e050826702005497918a4cf7bdf390d1702e46c13d581def1a041e034b2a39dfec5730fb5ec027321026496c130"}
publishing to ws://localhost:8888... success.
[SUCCESS] Kind 1 event accepted without authentication (correct behavior)
[INFO] Testing kind 4 event (direct message) - should require authentication...
2026-04-03 06:54:45 - Kind 4 event result: connecting to localhost:8888... ok.
{"kind":4,"id":"f2d20b15cf31f6107ff582d2e7a39fda1f578d2c2760740c0079bc39a6bddf16","pubkey":"26e49670b48e5520753879c0c6f2a144ad98acaf524e54b4c0389b4882fec048","created_at":1775213675,"tags":[["p,test_pubkey"]],"content":"This is a direct message - should require auth","sig":"dfe27324122441339808abeb533606718ca320b9694dad2410b91d08c56455e93674ba509062828f2125348f20e4117e438d2fa043b6fbfe7bbd06426e0467af"}
publishing to ws://localhost:8888...
[SUCCESS] Kind 4 event requested authentication (correct behavior for DMs)
[INFO] Testing kind 14 event (chat message) - should require authentication...
2026-04-03 06:54:55 - Kind 14 event result: connecting to localhost:8888... ok.
{"kind":14,"id":"a51d6d54aa8618c3ab2e5b39585847942817281615699befcb7469aeac7ca48c","pubkey":"26e49670b48e5520753879c0c6f2a144ad98acaf524e54b4c0389b4882fec048","created_at":1775213685,"tags":[["p,test_pubkey"]],"content":"Chat message - should require auth","sig":"bbe020047f6f5ed1e2a9a51287bc49b4e5c02f8914ae1387272928b942008a4a725eaee7a05ce750cae71d54f8cbf53f7e4a0765411b48429cbb5c57ea5c2fc6"}
publishing to ws://localhost:8888...
[SUCCESS] Kind 14 event requested authentication (correct behavior for DMs)
[INFO] Testing other event kinds - should work without authentication...
2026-04-03 06:54:56 - Kind 0 event result: connecting to localhost:8888... ok.
{"kind":0,"id":"9c1f0b16cedd06789b1f00adf59cadfc5d63a33a25c9b34a11c269b2f902b77f","pubkey":"26e49670b48e5520753879c0c6f2a144ad98acaf524e54b4c0389b4882fec048","created_at":1775213695,"tags":[],"content":"Test event kind 0 - should not require auth","sig":"bd37bd831569fa12a77508fbd722903da8655056e7f10352629ff7ee025be7d7d5b8a7470b3c40ce3c1cb950d7f8ef9a1aece431d1cc1680fb8ee831cb0e04e2"}
publishing to ws://localhost:8888... success.
[SUCCESS] Kind 0 event accepted without authentication (correct)
2026-04-03 06:54:56 - Kind 3 event result: connecting to localhost:8888... ok.
{"kind":3,"id":"0419f1522362986946630e056905e3abb6340c9db38d9db4c2e60d0451fc07a9","pubkey":"26e49670b48e5520753879c0c6f2a144ad98acaf524e54b4c0389b4882fec048","created_at":1775213696,"tags":[],"content":"Test event kind 3 - should not require auth","sig":"980ef210c9f12b79e4769e93a2d1c9737d7ec48abe584f4c8d193b5791fdc72bf98820108b2cd044046ca4d625ad9905642c6ced0fc96737d218080504dbef84"}
publishing to ws://localhost:8888... success.
[SUCCESS] Kind 3 event accepted without authentication (correct)
2026-04-03 06:54:56 - Kind 7 event result: connecting to localhost:8888... ok.
{"kind":7,"id":"973125984064b9f748dabe16a1f630483f9549d8395cd81bdd239691d5a5517b","pubkey":"26e49670b48e5520753879c0c6f2a144ad98acaf524e54b4c0389b4882fec048","created_at":1775213696,"tags":[],"content":"Test event kind 7 - should not require auth","sig":"15b7e57d59cbeba58169a46c6b40a3a82c18d47c41b1733f557d055a76fabd06782db2b0bf926a3ab785146dd6a6865b31ec2d5141296dd3a787b8aa966699b1"}
publishing to ws://localhost:8888... success.
[SUCCESS] Kind 7 event accepted without authentication (correct)
[INFO] Kind-specific authentication test completed
[INFO] === NIP-42 Test Results Summary ===
[SUCCESS] Dependencies: PASS
[SUCCESS] NIP-42 Support: PASS
[SUCCESS] Auth Challenge: PASS
[SUCCESS] Auth Flow: PASS
[SUCCESS] WebSocket AUTH: PASS
[SUCCESS] Configuration: PASS
[SUCCESS] Performance: PASS
[SUCCESS] Kind-Specific Auth: PASS
[SUCCESS] All NIP-42 tests completed successfully!
[SUCCESS] NIP-42 authentication implementation is working correctly
[INFO] === NIP-42 Authentication Tests Complete ===