5#include "ArduinoJson.h"
9#define NOSTR_DIGEST_SIZE 32
10#define BASE64_STANDARD 0
11#define BASE64_NOPADDING 1
12#define BASE64_URLSAFE 2
19 static unsigned long long subs;
#define NostrString
Definition NostrString.h:10
Definition NostrUtils.h:16
static NostrString hexToBase64(NostrString hex)
Definition NostrUtils.cpp:176
static void setRandomBytesProvider(std::function< bool(uint8_t *, size_t)> randomBytesProvider)
Definition NostrUtils.cpp:87
static void jsonStringify(JsonVariantConst source, NostrString *json)
Definition NostrUtils.cpp:160
static bool decodeHexExact(const NostrString &input, uint8_t *output, size_t outputCapacity, size_t expectedBytes)
Definition NostrUtils.cpp:168
static std::function< unsigned long long()> timeSecondsProvider
Definition NostrUtils.h:21
static std::function< void(const NostrString &)> logger
Definition NostrUtils.h:18
static bool fillRandom(uint8_t *output, size_t outputSize)
Definition NostrUtils.cpp:139
static unsigned long long subs
Definition NostrUtils.h:19
static NostrString getPublicKey(NostrString privKeyHex)
Definition NostrUtils.cpp:276
static NostrString toHex(const uint8_t *array, size_t arraySize)
Definition NostrUtils.cpp:164
static bool ecdh(NostrString privKeyHex, NostrString pubKeyHex, uint8_t *out)
Definition NostrUtils.cpp:291
static NostrString sign(NostrString privateKeyHex, uint8_t *message, size_t messageSize)
Definition NostrUtils.cpp:304
static long int randomInt(long int min, long int max)
Definition NostrUtils.cpp:121
static void setUnixTimeSecondsProvider(std::function< unsigned long long()> timeSecondsProvider)
Definition NostrUtils.cpp:83
static void log(const NostrString &message)
Definition NostrUtils.cpp:95
static void init()
Definition NostrUtils.cpp:336
static size_t fromHex(NostrString hex, uint8_t *output, size_t outputSize)
Definition NostrUtils.cpp:218
static void close()
Definition NostrUtils.cpp:342
static bool jsonParse(const NostrString *json, JsonDocument *doc)
Definition NostrUtils.cpp:150
static long long unixTimeSeconds()
Definition NostrUtils.cpp:99
static NostrString getNewSubscriptionId()
Definition NostrUtils.cpp:107
static size_t toBase64(const uint8_t *array, size_t arraySize, char *output, size_t outputSize, uint8_t flags)
Definition NostrUtils.cpp:227
static size_t fromBase64(const char *encoded, size_t encodedSize, uint8_t *output, size_t outputSize, uint8_t flags)
Definition NostrUtils.cpp:222
static NostrString base64ToHex(NostrString base64ToHex)
Definition NostrUtils.cpp:201
static size_t sha256(NostrString message, uint8_t *hash)
Definition NostrUtils.cpp:256
static bool verify(NostrString pubKeyHex, uint8_t *messageHash, NostrString signatureHex)
Definition NostrUtils.cpp:325
static void setLogger(std::function< void(const NostrString &)> logger)
Definition NostrUtils.cpp:91
static std::function< bool(uint8_t *, size_t)> randomBytesProvider
Definition NostrUtils.h:20
Definition CryptoLock.h:6