mercure_dart 1.0.2
mercure_dart: ^1.0.2 copied to clipboard
Pure Dart implementation of the Mercure protocol. Zero dependencies. Multi-platform: mobile, desktop, server and web.
Changelog #
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
1.0.2 - 2026-04-08 #
Security #
- SSE pipeline hardening — configurable size limits to prevent memory exhaustion from malicious SSE streams:
SseLineDecoder:maxLineLengthparameter (default 1 MB). Lines exceeding the limit are discarded with aStateError.SseParser:maxEventSizeparameter (default 10 MB). Events exceeding the limit are discarded with aStateError.
- Error message sanitization — HTTP response bodies are truncated to 200 characters in exception messages to prevent information leakage (IO transport, web transport, subscriptions API).
MercureEvent.toString()truncation — event data is truncated to 100 characters in debug output to prevent sensitive payloads from leaking into logs.
Added #
- Input validation on
MercureSubscriberandPublishOptionsconstructors:topicsmust be non-empty and contain no empty strings. - Defensive JSON deserialization in
SubscriptionInfo.fromJsonandSubscriptionsResponse.fromJson:TypeErroris caught and rethrown asFormatExceptionwith context.
Changed #
PublishOptionsconstructor is no longerconst(body validation requires runtime checks).
1.0.1 - 2026-04-08 #
Fixed #
- Repository URL corrected to
owlnext-fracross all files (pubspec, README, CONTRIBUTING, SECURITY, CHANGELOG). - CI badge now targets
mainbranch explicitly for accurate status display. - Architecture diagram alignment fixed (consistent column widths with box-drawing characters).
Added #
- Table of contents in README.
- Emoji icons on features list.
1.0.0 - 2026-04-08 #
Added #
- Models:
MercureEvent,PublishOptions,SubscriptionInfo,SubscriptionsResponse— immutable data classes for the Mercure protocol. - Authentication:
MercureAuthsealed class withBearer,Cookie, andQueryParamvariants. - SSE parser:
SseLineDecoder(bytes to lines) andSseParser(lines to events) — spec-compliantStreamTransformerimplementations handling all SSE edge cases. - Transport layer:
MercureTransportabstract interface with platform-specific implementations:MercureTransportIo(dart:io) —HttpClientwith custom SSE parsing pipeline and automatic reconnection with exponential backoff.MercureTransportWeb(dart:html) — nativeEventSourcefor subscribe,HttpRequestfor publish.- Conditional import factory for automatic platform selection.
- MercureSubscriber — facade for subscribing to hub updates via
Stream<MercureEvent>. - MercurePublisher — facade for publishing updates to the hub.
- Discovery —
discoverMercureHub()function withLinkheader parser (RFC 8288). - Subscriptions API —
MercureSubscriptionsApifor querying active subscriptions (JSON-LD). - Reconnection: exponential backoff with jitter,
Last-Event-IDreconciliation,retry:hint support,earliesthistory retrieval. - Zero runtime dependencies — pure Dart SDK only.
- CI: GitHub Actions workflow (analyze, unit tests on SDK 3.0.0 + stable, integration tests with Mercure Docker).
- Integration test infrastructure with Docker (
dunglas/mercure) and minimal JWT HS256 generator. - Library entry point:
import 'package:mercure_dart/mercure_dart.dart';