Socket
Book a DemoInstallSign in
Socket

@agree-able/invite

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@agree-able/invite

simple ways to get an invite to a room

1.0.4
latest
Source
npmnpm
Version published
Weekly downloads
5
-58.33%
Maintainers
1
Weekly downloads
 
Created
Source

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

FAQs

Package last updated on 10 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.