NegentropyEncoder class
Negentropy protocol encoder implementation for NIP-77 Handles varint encoding, fingerprints, bounds, and message framing
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
bytesToHex(
Uint8List bytes) → String - Converts bytes to hex string
-
calculateFingerprint(
List< Uint8List> ids) → Uint8List -
Calculates fingerprint from a list of event IDs
Fingerprint = SHA256(XOR of all IDs || count as little-endian u64)
0:16 -
createInitialMessage(
List< NegentropyItem> items, int idSize) → Uint8List - Creates an initial client message (NEG-OPEN query payload)
-
decodeBound(
Uint8List data, [int offset = 0]) → (int, Uint8List, int) - Decodes a bound from bytes
-
decodeVarint(
Uint8List data, [int offset = 0]) → (int, int) - Decodes a varint from bytes, returns (value, bytesConsumed)
-
encodeBound(
int timestamp, Uint8List idPrefix) → Uint8List - Encodes a bound (timestamp + ID prefix)
-
encodeVarint(
int value) → Uint8List - Encodes an integer as a varint (base-128, MSB-first)
-
hexToBytes(
String hex) → Uint8List - Parses a hex string to bytes
-
reconcile(
Uint8List message, List< NegentropyItem> items) → (Uint8List, List<String> , List<String> ) - Reconciles received message and creates response Returns (response bytes, need IDs, have IDs)
Constants
- fingerprintSize → const int
- Size of fingerprint in bytes
- idSize → const int
- Size of event ID in bytes (32 bytes = 64 hex chars)
- modeFingerprint → const int
- modeIdList → const int
- modeSkip → const int
- Mode constants
- protocolVersion → const int
- Protocol version byte