mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-11-15 16:50:16 +01:00
libsecp256k1: use a static global context and add verification tests.
This commit is contained in:
20
libsecp256k1/signverify_test.go
Normal file
20
libsecp256k1/signverify_test.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package libsecp256k1
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"testing"
|
||||
|
||||
"github.com/nbd-wtf/go-nostr"
|
||||
"github.com/nbd-wtf/go-nostr/test_common"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestEventVerification(t *testing.T) {
|
||||
for _, jevt := range test_common.NormalEvents {
|
||||
evt := &nostr.Event{}
|
||||
json.Unmarshal([]byte(jevt), evt)
|
||||
ok, _ := CheckSignature(evt)
|
||||
shouldBe, _ := evt.CheckSignature()
|
||||
assert.Equal(t, ok, shouldBe, "%s signature must be %s", jevt, shouldBe)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user