You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 inviteconstconfig={invite: 'your-invite-code'}constresult=awaitload(config,confirmEnterRoom)// Domain-based configuration with DID lookupconstconfig={domain: 'example.com',loadDid: true}constresult=awaitload(config,confirmEnterRoom)// With Keybase verificationconstconfig={domain: 'example.com',keybaseUsername: 'username',privateKeyArmored: 'your-pgp-key'}constresult=awaitload(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.
constconfirmEnterRoom=async(expectations,hostDetails)=>{// expectations contains room requirements// hostDetails may contain verification details if whoami is enabledconsole.log('room rules',expectations.rules)console.log('room reason',expectations.reason)// Example of checking whoami verificationif(hostDetails?.whoami?.keybase){const{ verified, username }=hostDetails.whoami.keybaseif(!verified){thrownewError(`Keybase verification failed for ${username}`)}}// you must return the acceptance object back to the serverreturn{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: