fix typos

This commit is contained in:
Yasuhiro Matsumoto
2023-09-11 23:23:46 +09:00
committed by fiatjaf_
parent 0f66883dc7
commit e55f5492ab
3 changed files with 6 additions and 6 deletions

View File

@ -78,7 +78,7 @@ func Encrypt(message string, key []byte) (string, error) {
func Decrypt(content string, key []byte) (string, error) {
parts := strings.Split(content, "?iv=")
if len(parts) < 2 {
return "", fmt.Errorf("error parsing encrypted message: no initilization vector")
return "", fmt.Errorf("error parsing encrypted message: no initialization vector")
}
ciphertext, err := base64.StdEncoding.DecodeString(parts[0])

View File

@ -7,7 +7,7 @@ import (
func TestEncryptionAndDecryption(t *testing.T) {
sharedSecret := make([]byte, 32)
message := "hello hellow"
message := "hello hello"
ciphertext, err := Encrypt(message, sharedSecret)
if err != nil {

View File

@ -11,7 +11,7 @@ func TestBasicNsonParse(t *testing.T) {
for _, jevt := range nsonTestEvents {
evt := &nostr.Event{}
if err := Unmarshal(jevt, evt); err != nil {
t.Fatalf("error unmarshaling nson: %s", err)
t.Fatalf("error unmarshalling nson: %s", err)
}
checkParsedCorrectly(t, evt, jevt)
}
@ -21,7 +21,7 @@ func TestNsonPartialGet(t *testing.T) {
for _, jevt := range nsonTestEvents {
evt := &nostr.Event{}
if err := Unmarshal(jevt, evt); err != nil {
t.Fatalf("error unmarshaling nson: %s", err)
t.Fatalf("error unmarshalling nson: %s", err)
}
wrapper := New(jevt)
@ -60,7 +60,7 @@ func TestNsonEncode(t *testing.T) {
evt := &nostr.Event{}
if err := Unmarshal(nevt, evt); err != nil {
t.Fatalf("error unmarshaling nson: %s", err)
t.Fatalf("error unmarshalling nson: %s", err)
}
checkParsedCorrectly(t, pevt, jevt)
checkParsedCorrectly(t, evt, jevt)
@ -71,7 +71,7 @@ func checkParsedCorrectly(t *testing.T, evt *nostr.Event, jevt string) (isBad bo
var canonical nostr.Event
err := json.Unmarshal([]byte(jevt), &canonical)
if err != nil {
t.Fatalf("error unmarshaling normal json: %s", err)
t.Fatalf("error unmarshalling normal json: %s", err)
}
if evt.ID != canonical.ID {