Eve-Relay/consts.ts
Danny Morabito 89d9dc3cbe
✂️ Implement message chunking mechanism for NIP-44 size limit compliance
This ensures all messages can be properly encrypted and transmitted regardless of size.

Fixes issue #2
2025-03-24 20:14:52 +01:00

44 lines
1.3 KiB
TypeScript

/**
* Minimum required Proof of Work (PoW) difficulty for note acceptance.
*
* Notes with PoW below this threshold will be rejected without decryption attempts.
* This threshold serves as a DoS protection mechanism for the CCN in case of
* public key compromise.
*/
export const MIN_POW = 8;
/**
* Target Proof of Work (PoW) difficulty for relay-generated notes.
*
* Defines the PoW difficulty level that the relay will compute when generating
* and encrypting its own notes before broadcasting them to the network.
*
* Expected Performance on modern hardware (2025):
* - Difficulty 8: ~1ms
* - Difficulty 21: ~5-6 seconds
*/
export const POW_TO_MINE = 10;
/**
* Maximum size of a note chunk in bytes.
*
* This value determines the maximum size of a note that can be encrypted and
* sent in a single chunk.
*/
export const MAX_CHUNK_SIZE = 32768;
/**
* Interval for cleaning up expired note chunks in milliseconds.
*
* This value determines how often the relay will check for and remove expired
* note chunks from the database.
*/
export const CHUNK_CLEANUP_INTERVAL = 1000 * 60 * 60;
/**
* Maximum age of a note chunk in milliseconds.
*
* This value determines the maximum duration a note chunk can remain in the
* database before it is considered expired and eligible for cleanup.
*/
export const CHUNK_MAX_AGE = 1000 * 60 * 60 * 24;