Remove deprecated test files and optimize encryption functions
Some checks failed
Go / build (push) Has been cancelled
Go / release (push) Has been cancelled

- Deleted `testresults.txt` and `testmain_test.go` as they were no longer needed.
- Updated the Go workflow to streamline the build process by removing commented-out build steps for various platforms.
- Refactored encryption benchmarks to improve performance and clarity in the `benchmark_test.go` file.
- Introduced a new LICENSE file for the encryption package, specifying the MIT License.
- Enhanced the README with usage instructions and links to the NIP-44 specification.
- Bumped version to v0.25.3 to reflect these changes.
This commit is contained in:
2025-11-05 13:28:17 +00:00
parent 256537ba86
commit 7af08f9fd2
15 changed files with 699 additions and 1104 deletions

View File

@@ -70,7 +70,7 @@ func TestNWCEncryptionDecryption(t *testing.T) {
testMessage := `{"method":"get_info","params":null}`
// Test encryption
encrypted, err := encryption.Encrypt([]byte(testMessage), convKey)
encrypted, err := encryption.Encrypt(convKey, []byte(testMessage), nil)
if err != nil {
t.Fatalf("encryption failed: %v", err)
}
@@ -80,14 +80,14 @@ func TestNWCEncryptionDecryption(t *testing.T) {
}
// Test decryption
decrypted, err := encryption.Decrypt(encrypted, convKey)
decrypted, err := encryption.Decrypt(convKey, encrypted)
if err != nil {
t.Fatalf("decryption failed: %v", err)
}
if string(decrypted) != testMessage {
if decrypted != testMessage {
t.Fatalf(
"decrypted message mismatch: got %s, want %s", string(decrypted),
"decrypted message mismatch: got %s, want %s", decrypted,
testMessage,
)
}
@@ -111,8 +111,8 @@ func TestNWCEventCreation(t *testing.T) {
t.Fatal(err)
}
convKey, err := encryption.GenerateConversationKeyWithSigner(
clientKey, walletPubkey,
convKey, err := encryption.GenerateConversationKey(
clientKey.Sec(), walletPubkey,
)
if err != nil {
t.Fatal(err)
@@ -124,14 +124,14 @@ func TestNWCEventCreation(t *testing.T) {
t.Fatal(err)
}
encrypted, err := encryption.Encrypt(reqBytes, convKey)
encrypted, err := encryption.Encrypt(convKey, reqBytes, nil)
if err != nil {
t.Fatal(err)
}
// Create NWC event
ev := &event.E{
Content: encrypted,
Content: []byte(encrypted),
CreatedAt: time.Now().Unix(),
Kind: 23194,
Tags: tag.NewS(