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

@unstoppabledomains/chat

v3.4.0

Published

Decentralized chat library

Downloads

31

Readme

Resolution

NPM version

A library for decentralized chat with blockchain domains and gundb

You can use UnstoppableChat in a <script> tag from a CDN

Architecture

Unstoppable Chat combines the technologies of blockchain domains and GunDB.

Gundb credentials are made from signing a blockchain domain using the domain owner's private key.

const domainName = 'example.crypto';

const username = sign(domainName, privateKey);

const password = sign(username, privateKey);

A gundb user is identified by their username and publicKey

The gundb username and publicKey are found in the blockchain domain's text record gundb.username.value and gundb.public_key.value. We recommend using the unstoppabledomains resolution library to help resolve blockchain domains.

Initialization

const GUNDB_SUPER_PEER = 'https://unstoppable-superpeer.herokuapp.com/';

const chat = new UnstoppableChat(GUNDB_SUPER_PEER);

Login

chat.join(username, password, domainName);

Contacts

const contactsListener = await chat.loadContacts();
const contactInvitesListener = await chat.loadContactInvites();

contactsListener.on((contacts) => {
    for (const contact of contacts) {
        const contactMessagesListener = await chat.loadMessagesOfContact(
            contact.pubKey,
            contact.name,
        );
        contactMessagesListener.on((messages) => {});
    }
});

// Auto accept contact invites
contactInvitesListener.on((contactInvites) => {
    for (const contactInvite of contactInvites) {
        chat.acceptContactInvite(
            contactInvite.alias,
            contactInvite.pubKey,
            contactInvite.name,
        );
    }
});

chat.addContact(username, publicKey, domainName);
chat.sendMessageToContact(publicKey, message);

Channels

const channelsListener = await chat.loadChannels();
const channelInvitesListener = await chat.loadChannelInvites();

channelsListener.on((channels) => {});
channelInvitesListener.on((channelInvites) => {
  for (const channelInvite of channelInvites) {
    chat.acceptChannelInvite(channelInvite) ||
      chat.denyChannelInvite(channelInvite);
  }
});

const channel = await chat.createChannel(channelName);

chat.inviteToChannel(channel, username, publicKey, domainName);
chat.leaveChannel(channel);

Announcements

const announcementsListener = await chat.loadAnnouncements();
const announcementInvitesListener = await chat.loadAnnouncementInvites();

announcementsListener.on((announcements) => {});
announcementInvitesListener.on((announcementInvites) => {
  for (const announcementInvite of announcementInvites) {
    chat.acceptAnnouncementInvite(announcementInvite) ||
      chat.denyAnnouncementInvite(announcementInvite);
  }
});

const announcement = await chat.createAnnouncement(announcementName);

chat.inviteToAnnouncement(announcement, username, publicKey, domainName);
chat.leaveAnnouncement(announcement);