Skip to content

Commit

Permalink
add message signing test
Browse files Browse the repository at this point in the history
  • Loading branch information
Alesfatalis committed Apr 13, 2024
1 parent 57125b8 commit 8a03b3e
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions verifier_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package ergo

import (
"github.com/stretchr/testify/assert"
"testing"
)

func TestMessageSigning(t *testing.T) {
key := NewSecretKey()
addr := key.Address()
keys := NewSecretKeys()
keys.Add(key)
testWallet := NewWalletFromSecretKeys(keys)
msg := []byte("this is a message")
sig, sigErr := testWallet.SignMessageUsingP2PK(addr, msg)
assert.NoError(t, sigErr)
res, verifyErr := VerifySignature(addr, msg, sig)
assert.NoError(t, verifyErr)
assert.True(t, res)
}

0 comments on commit 8a03b3e

Please sign in to comment.