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

@agree-able/invite

v1.0.4

Published

simple ways to get an invite to a room

Downloads

417

Readme

Agreeable Room Invitations

A utility for loading and configuring room settings with support for invites, domain-based configuration, and identity verification through Keybase.

Installation

npm install @agree-able/invite

Quick Start

import { load } from '@agree-able/invite'

// Simple usage with direct invite
const config = { invite: 'your-invite-code' }
const result = await load(config, confirmEnterRoom)

// Domain-based configuration with DID lookup
const config = { 
  domain: 'example.com',
  loadDid: true
}
const result = await load(config, confirmEnterRoom)

// With Keybase verification
const config = {
  domain: 'example.com',
  keybaseUsername: 'username',
  privateKeyArmored: 'your-pgp-key'
}
const result = await load(config, confirmEnterRoom)

The confirmEnterRoom Function

The confirmEnterRoom function is required and must handle room entry expectations. It receives room expectations and host details, and should return an acceptance object.

const confirmEnterRoom = async (expectations, hostDetails) => {
  // expectations contains room requirements
  // hostDetails may contain verification details if whoami is enabled
  
  console.log('room rules', expectations.rules)
  console.log('room reason', expectations.reason)

  // Example of checking whoami verification
  if (hostDetails?.whoami?.keybase) {
    const { verified, username } = hostDetails.whoami.keybase
    if (!verified) {
      throw new Error(`Keybase verification failed for ${username}`)
    }
  }

  // you must return the acceptance object back to the server
  return {
    reason: true, // 'agree to the reason for the room'
    rules: true // 'agree to the rules for the room'
  }
}

Key Features

  • Direct invite code support
  • Domain-based room key lookup
  • DID (Decentralized Identifier) resolution
  • Keybase identity verification
  • PGP signing support

Configuration Options

The load function accepts a configuration object with the following options:

  • invite: Direct invite code (z32 string)
  • domain: Domain to lookup breakout room key from
  • loadDid: Whether to load DID from domain
  • hostProveWhoami: Enable host whoami verification
  • keybaseUsername: Keybase username for verification
  • privateKeyArmoredFile: File location of PGP private key
  • privateKeyArmored: PGP private key in armored format

Returns

The function returns a Promise resolving to an object containing:

  • invite: The room invite code
  • did: The DID (if requested and available)

License

MIT