ssb-db is a core component within the Secure Scuttlebutt (SSB) ecosystem, providing a secure, replicatable, append-only database for cryptographic message feeds. It is built as a plugin for secret-stack applications, enabling peer-to-peer data synchronization and communication without a central authority. The package ensures message unforgeability through digital signing tied to unique public/private key pairs, forming immutable "feeds." Currently at version 20.4.1, ssb-db has a moderate release cadence, with several minor versions released in recent history (v20.x in 2024), indicating active maintenance and feature development. Key differentiators include its foundational role in the decentralized SSB protocol, strict append-only data model (though flexible through delta encoding for "deletions"), and built-in support for message encryption and indexing. It's designed for applications requiring resilient, offline-first, and censorship-resistant data storage.
npm install ssb-dbVerified import paths — ran on the pinned version, not inferred.
This example demonstrates initializing an `ssb-db` instance using `secret-stack`, publishing a new message to the current identity's feed, and then streaming all messages from the log and specifically from the current identity's history. It showcases basic message creation and retrieval patterns.
Update custom `addBoxer` implementations to accept and utilize the `previous` messageId parameter.
Review and update custom `addBoxer` implementations to include an `init` method if necessary and account for initialization delays, ensuring they complete before dependent db operations.
After adding a new unboxer (e.g., for a new private group format), call the `rebuild` function (exposed since v20.1.0) on your `ssb-db` instance to ensure all flume indexes are consistent.
Review how unboxed messages are handled if using v20.0.0 and update to a later version to ensure consistent behavior, or modify downstream plugins accordingly to avoid conflicts.
Ensure only one `secret-stack` application using `ssb-db` is running at any given time, or configure different database directories and network ports for multiple instances if necessary.
Ensure all `ssb-db` instances are properly closed (`app.close()` in `secret-stack`) before attempting to start a new one, or configure each instance to use a unique database directory and port.
Always include a `type` property in the message object passed to `app.publish()`, for example: `{ type: 'post', text: 'My message' }`.After registering a new unboxer, explicitly call `app.rebuild()` (exposed since v20.1.0) on your `ssb-db` instance to ensure all flume indexes are reprocessed with the new unboxer.