fix wonky nip-44 retardations i mean tests

This commit is contained in:
2025-02-15 15:46:41 +00:00
parent acd6b5958b
commit bc9c3d44df
2 changed files with 6 additions and 6 deletions

View File

@@ -362,7 +362,7 @@ func TestConversationKeyFail003(t *testing.T) {
assertConversationKeyFail(t,
"fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364139",
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"error parsing receiver public key '02ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff': invalid public key: x >= field prime",
"invalid public key: x >= field prime",
// "invalid public key: x >= field prime",
)
}
@@ -381,7 +381,7 @@ func TestConversationKeyFail005(t *testing.T) {
assertConversationKeyFail(t,
"0000000000000000000000000000000000000000000000000000000000000002",
"1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
"error parsing receiver public key '021234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef': invalid public key: x coordinate 1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef is not on the secp256k1 curve",
"invalid public key: x coordinate 1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef is not on the secp256k1 curve",
// "invalid public key: x coordinate 1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef is not on the secp256k1 curve",
)
}
@@ -391,7 +391,7 @@ func TestConversationKeyFail006(t *testing.T) {
assertConversationKeyFail(t,
"0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20",
"0000000000000000000000000000000000000000000000000000000000000000",
"error parsing receiver public key '020000000000000000000000000000000000000000000000000000000000000000': invalid public key: x coordinate 0000000000000000000000000000000000000000000000000000000000000000 is not on the secp256k1 curve",
"invalid public key: x coordinate 0000000000000000000000000000000000000000000000000000000000000000 is not on the secp256k1 curve",
// "invalid public key: x coordinate 0000000000000000000000000000000000000000000000000000000000000000 is not on the secp256k1 curve",
)
}
@@ -401,7 +401,7 @@ func TestConversationKeyFail007(t *testing.T) {
assertConversationKeyFail(t,
"0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20",
"eb1f7200aecaa86682376fb1c13cd12b732221e774f553b0a0857f88fa20f86d",
"error parsing receiver public key '02eb1f7200aecaa86682376fb1c13cd12b732221e774f553b0a0857f88fa20f86d': invalid public key: x coordinate eb1f7200aecaa86682376fb1c13cd12b732221e774f553b0a0857f88fa20f86d is not on the secp256k1 curve",
"invalid public key: x coordinate eb1f7200aecaa86682376fb1c13cd12b732221e774f553b0a0857f88fa20f86d is not on the secp256k1 curve",
// "invalid public key: x coordinate eb1f7200aecaa86682376fb1c13cd12b732221e774f553b0a0857f88fa20f86d is not on the secp256k1 curve",
)
}
@@ -411,7 +411,7 @@ func TestConversationKeyFail008(t *testing.T) {
assertConversationKeyFail(t,
"0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20",
"709858a4c121e4a84eb59c0ded0261093c71e8ca29efeef21a6161c447bcaf9f",
"error parsing receiver public key '02709858a4c121e4a84eb59c0ded0261093c71e8ca29efeef21a6161c447bcaf9f': invalid public key: x coordinate 709858a4c121e4a84eb59c0ded0261093c71e8ca29efeef21a6161c447bcaf9f is not on the secp256k1 curve",
"invalid public key: x coordinate 709858a4c121e4a84eb59c0ded0261093c71e8ca29efeef21a6161c447bcaf9f is not on the secp256k1 curve",
// "invalid public key: x coordinate 709858a4c121e4a84eb59c0ded0261093c71e8ca29efeef21a6161c447bcaf9f is not on the secp256k1 curve",
)
}

View File

@@ -41,7 +41,7 @@ func (s *Server) auth(r *http.Request) (authed bool) {
func (s *Server) unauthorized(w http.ResponseWriter) {
w.Header().Set("WWW-Authenticate", `Basic realm="restricted", charset="UTF-8"`)
http.Error(w, "Unauthorized", http.StatusUnauthorized)
fmt.Fprintf(w, "your npub is not welcome here")
fmt.Fprintf(w, "your npub is not welcome here\n")
}
func (s *Server) handleHTTP(w http.ResponseWriter, r *http.Request) {