mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-05-02 06:40:13 +02:00
nip04: augment tests with cross-compatibility vectors.
This commit is contained in:
parent
2b9b4dfa2f
commit
a9972245f3
@ -3,6 +3,8 @@ package nip04
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/nbd-wtf/go-nostr"
|
||||
)
|
||||
|
||||
func TestEncryptionAndDecryption(t *testing.T) {
|
||||
@ -45,3 +47,15 @@ func TestEncryptionAndDecryptionWithMultipleLengths(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestNostrToolsCompatibility(t *testing.T) {
|
||||
sk1 := "92996316beebf94171065a714cbf164d1f56d7ad9b35b329d9fc97535bf25352"
|
||||
sk2 := "591c0c249adfb9346f8d37dfeed65725e2eea1d7a6e99fa503342f367138de84"
|
||||
pk2, _ := nostr.GetPublicKey(sk2)
|
||||
shared, _ := ComputeSharedSecret(pk2, sk1)
|
||||
ciphertext := "A+fRnU4aXS4kbTLfowqAww==?iv=QFYUrl5or/n/qamY79ze0A=="
|
||||
plaintext, _ := Decrypt(ciphertext, shared)
|
||||
if plaintext != "hello" {
|
||||
t.Fatal("invalid decryption of nostr-tools payload")
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user