Nostrduino
Loading...
Searching...
No Matches
Nip04.h
Go to the documentation of this file.
1#ifndef _NIP04_H
2#define _NIP04_H
3
4#include "NostrLimits.h"
5#include "NostrString.h"
6#include "NostrUtils.h"
7#include <Arduino.h>
8#include <NostrAES.h>
9
10namespace nostr {
11class Nip04 {
12 public:
13 explicit Nip04(const NostrLimits &limits = NostrLimits()) : limits(limits) {}
14 NostrString decrypt(NostrString &privateKeyHex, NostrString &senderPubKeyHex, NostrString content);
15 NostrString encrypt(NostrString &privateKeyHex, NostrString &recipientPubKeyHex, NostrString content);
16
17 private:
18 NostrString encryptData(const uint8_t key[32], const uint8_t iv[16], const char *message, size_t messageSize);
19 NostrString decryptData(const uint8_t key[32], const uint8_t iv[16], const uint8_t *ciphertext, size_t ciphertextSize);
20 NostrLimits limits;
21};
22}
23
24#endif
#define NostrString
Definition NostrString.h:10
Definition Nip04.h:11
NostrString encrypt(NostrString &privateKeyHex, NostrString &recipientPubKeyHex, NostrString content)
Definition Nip04.cpp:115
NostrString decrypt(NostrString &privateKeyHex, NostrString &senderPubKeyHex, NostrString content)
Definition Nip04.cpp:83
Nip04(const NostrLimits &limits=NostrLimits())
Definition Nip04.h:13
Definition CryptoLock.h:6
Definition NostrLimits.h:9