Rollback of nip44 changes, and added ability to modify timestamps in giftwraps.

This commit is contained in:
2025-10-27 13:16:06 -04:00
parent a8dc2ed046
commit f3068f82f3
5 changed files with 16 additions and 16 deletions

View File

@@ -1 +1 @@
0.4.7
0.4.8

View File

@@ -2,10 +2,10 @@
#define NOSTR_CORE_H
// Version information (auto-updated by increment_and_push.sh)
#define VERSION "v0.4.7"
#define VERSION "v0.4.8"
#define VERSION_MAJOR 0
#define VERSION_MINOR 4
#define VERSION_PATCH 7
#define VERSION_PATCH 8
/*
* NOSTR Core Library - Complete API Reference

Binary file not shown.

Binary file not shown.

View File

@@ -46,7 +46,7 @@ static nip44_test_vector_t test_vectors[] = {
NULL
},
{
"1MB payload test",
"64KB payload test",
"91ba716fa9e7ea2fcbad360cf4f8e0d312f73984da63d90f524ad61a6a1e7dbe", // Same keys as basic test
"96f6fa197aa07477ab88f6981118466ae3a982faab8ad5db9d5426870c73d220",
NULL, // Will be generated dynamically
@@ -99,12 +99,12 @@ static int test_nip44_round_trip(const nip44_test_vector_t* tv) {
// Special handling for large payload tests
char* test_plaintext;
if (strcmp(tv->name, "1MB payload test") == 0) {
// Generate exactly 1MB (1,048,576 bytes) of predictable content
const size_t payload_size = 1048576;
if (strcmp(tv->name, "64KB payload test") == 0) {
// Generate exactly 64KB (65,535 bytes) of predictable content - max NIP-44 size
const size_t payload_size = 65535;
test_plaintext = malloc(payload_size + 1);
if (!test_plaintext) {
printf(" FAIL: Memory allocation failed for 1MB test payload\n");
printf(" FAIL: Memory allocation failed for 64KB test payload\n");
return -1;
}
@@ -118,7 +118,7 @@ static int test_nip44_round_trip(const nip44_test_vector_t* tv) {
}
test_plaintext[payload_size] = '\0';
printf(" Generated 1MB test payload (%zu bytes)\n", payload_size);
printf(" Generated 64KB test payload (%zu bytes)\n", payload_size);
printf(" Pattern: \"%s\" repeated\n", pattern);
printf(" First 64 chars: \"%.64s...\"\n", test_plaintext);
printf(" Last 64 chars: \"...%.64s\"\n", test_plaintext + payload_size - 64);
@@ -158,10 +158,10 @@ static int test_nip44_round_trip(const nip44_test_vector_t* tv) {
}
// Test decryption - use recipient private key + sender public key
char* decrypted = malloc(1048576 + 1); // 1MB + 1 for null terminator
char* decrypted = malloc(65536 + 1); // 64KB + 1 for null terminator
if (!decrypted) {
printf(" FAIL: Memory allocation failed for decrypted buffer\n");
if (strcmp(tv->name, "1MB payload test") == 0) free(test_plaintext);
if (strcmp(tv->name, "64KB payload test") == 0) free(test_plaintext);
free(encrypted);
return -1;
}
@@ -170,7 +170,7 @@ static int test_nip44_round_trip(const nip44_test_vector_t* tv) {
sender_public_key,
encrypted,
decrypted,
1048576 + 1
65536 + 1
);
if (decrypt_result != NOSTR_SUCCESS) {
@@ -192,17 +192,17 @@ static int test_nip44_round_trip(const nip44_test_vector_t* tv) {
return -1;
}
if (strcmp(tv->name, "1MB payload test") == 0) {
printf("1MB payload round-trip: PASS\n");
if (strcmp(tv->name, "64KB payload test") == 0) {
printf("64KB payload round-trip: PASS\n");
printf(" ✅ Content verification: All %zu bytes match perfectly!\n", strlen(test_plaintext));
printf(" Encrypted length: %zu bytes\n", strlen(encrypted));
printf(" 🎉 1MB NIP-44 STRESS TEST COMPLETED SUCCESSFULLY! 🎉\n");
printf(" 🎉 64KB NIP-44 STRESS TEST COMPLETED SUCCESSFULLY! 🎉\n");
} else {
printf(" PASS: Expected: \"%s\", Actual: \"%s\"\n", test_plaintext, decrypted);
printf(" Encrypted output: %s\n", encrypted);
}
if (strcmp(tv->name, "1MB payload test") == 0) free(test_plaintext);
if (strcmp(tv->name, "64KB payload test") == 0) free(test_plaintext);
free(encrypted);
free(decrypted);