npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@smashchats/library

v0.0.0-alpha-c2f221b

Published

This ES Module library provides the core functionality for implementing and interacting with the **Smash Protocol**—a modular, **1:N social messaging** and **curated content-sharing** protocol. It powers the free and open digital neighborhoods of tomorrow

Downloads

1,019

Readme

Smash-Node-Lib

This ES Module library provides the core functionality for implementing and interacting with the Smash Protocol—a modular, 1:N social messaging and curated content-sharing protocol. It powers the free and open digital neighborhoods of tomorrow, promoting decentralization, interoperability, and user ownership.

WARNING. This is a work in progress. We are currently working on the alpha version of the Smash Protocol under a (non-exhaustive) list of assumptions. BREAKING CHANGES WITHOUT NOTICE ARE TO BE EXPECTED. And, in general, documentation is deemed not yet available.

License Version

Coverage Security Rating Maintainability Rating Lines of Code


Table of Contents

  1. Introduction
  2. Features
  3. Getting Started
  4. Usage
  5. Development Guide
  6. References
  7. Contributing
  8. License

Introduction

The Smash Protocol enables secure, decentralized communication and content sharing without intermediaries. Smash-Node-Lib is an open-source library for building JavaScript-based clients, plugins, or microservices that interact with the protocol.

Key Principles:

  • Open Standards: Fully modular and built on open APIs for interoperability.
  • Decentralization: Peer-to-peer communication with no central authority.
  • User Ownership: Your data, your rules.

For more details, see the full documentation.

Features

Smash-Node-Lib is currently in the alpha stage of development. The Smash Protocol is not yet fully functional.

  • 1:N Messaging: Support for both one-on-one and group communications.
  • Neighborhood-Based Organization: Join or create digital communities with unique rules and curation.
  • Modular Design: Built as microservices for flexibility and extensibility.
  • Secure Communication: Signal Protocol implementation ensures privacy.
  • Open APIs: Integrate seamlessly with other applications or build your own clients.
  • AT Protocol: Integrate with the AT Protocol for decentralized identity and social networking.

Getting Started

Follow these steps to start using the Smash-Node-Lib:

  1. Clone the Repository:

Using Radicle:

WARNING: The Smash-Node-Lib repository is currently private. You'll need to ask a maintainer to add you to the 'allow list'. Read more in our CONTRIBUTING.md.

rad clone rad:zZ6oTFp8JrVyhEQmrcfkQkQgmoQJ # RID for the Smash-Node-Lib repo

You can find an updated list of all Smash's repository IDs (RIDs) on our developer notes.

Using our GitHub mirror repository:

WARNING: The Smash-Node-Lib repository is currently private. You'll need to ask a maintainer to grant you access to the repository. Read more in our CONTRIBUTING.md.

git clone https://github.com/smashchats/smash-node-lib.git
  1. Install Dependencies:
npm install
  1. Set Up Your Development Environment:
rad node connect z6MkiXzPZSV6yx6wHSdSPNpVVytxauiLzhU1jG8sVmxdZkcn@rad-node.smashchats.com:8778

You can find a list of all Smash's seeding nodes on our developer notes.

  1. Run All Test Suites:

Looking at tests is a great way to understand how to use the library. Tests have been written using Jest and designed to provide a comprehensive set of examples on interacting with the Smash-Node-Lib library.

npm test

Usage

WARNING: The Smash-Node-Lib has not yet been published. The following examples are not yet fully functional.

ATTENTION: Have a look at our 'Smash Simple Neighborhood' repository for a working example of how to use the Smash-Node-Lib library in its current state.

Process unhandledRejections

Handle errors gracefully in your application:

const logger: Logger = ...;
process.on('unhandledRejection', (reason, promise) => {
    SmashMessaging.handleError(reason, promise, logger);
});

Processing messages

  1. The Smash messaging protocol might deliver messages out of order.
  2. The Smash messaging protocol might deliver duplicate messages.

Deduplication

All messages bear a message.sha256 hash. This property is used to detect duplicates. Already processed messages can safely be discarded if a duplicate is detected.

Re-ordering

Two properties of the message protocol ensure that messages can get re-ordered:

  1. message.timestamp: sender's claimed timestamp of when the message was first queued.
  2. message.after: the sha256 hash of the message that this message depends on.

If present, the message.after property is deemed trustable. Indeed, as it requires the sender to know the sha256 hash of the previous message, this property can't be set to fake messages sent after a message that wasn't previously received by the sender. The sender could however always set this property to the sha256 hash of a previously received message. This is impossible to enforce, but should not be harmful as long as clearly indicated.

Developers should always set message.after to the sha256 hash of the previous message. This ensures that messages can get re-ordered correctly. When this value is unknown or ignored, the convention is to set it to the 0 value or to an empty string.

When the message.after property is unavailable, re-ordering is limited to the message.timestamp property.

Out of order messages

Messages received with inconsistent timestamp and message.after ordering should be flagged as suspicious. Same for messages with a timestamp that is too far in the past, or, in the future (out of sync clocks).

References

Contributing

We welcome contributions from the community! Check out our Contributing Guide to get started. Ensure adherence to our Code of Conduct.

Contributions are managed through Radicle, a decentralized Git collaboration network. Learn more in our CONTRIBUTING.md.

Browse open issues.

License

All contributions to Smash-Simple-Neighborhood are made under our extended AGPL-3.0 License. By contributing, you agree to license your work under these terms.

By using this repository, you agree to the terms of the Smash License.

Any changes or derived projects MUST be open-sourced under a compatible license.

Contact