34 lines
900 B
C
34 lines
900 B
C
#include "nip004.h"
|
|
#include "utils.h"
|
|
#include <stdio.h>
|
|
|
|
int main() {
|
|
printf("Testing crypto initialization...\n");
|
|
|
|
if (nostr_crypto_init() != 0) {
|
|
printf("❌ Crypto init failed\n");
|
|
return 1;
|
|
}
|
|
printf("✅ Crypto init successful\n");
|
|
|
|
// Test random bytes generation
|
|
unsigned char random_bytes[16];
|
|
if (nostr_secp256k1_get_random_bytes(random_bytes, 16) != 1) {
|
|
printf("❌ Random bytes generation failed\n");
|
|
return 1;
|
|
}
|
|
printf("✅ Random bytes generation successful\n");
|
|
|
|
// Test base64 encoding
|
|
char output[64];
|
|
size_t encoded_len = base64_encode(random_bytes, 16, output, sizeof(output));
|
|
if (encoded_len == 0) {
|
|
printf("❌ Base64 encoding failed\n");
|
|
return 1;
|
|
}
|
|
printf("✅ Base64 encoding successful: %s\n", output);
|
|
|
|
nostr_crypto_cleanup();
|
|
return 0;
|
|
}
|