JSPM

@xmpp-infister/sasl

0.9.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q70490F
  • License ISC

XMPP SASL for JavaScript

Package Exports

  • @xmpp-infister/sasl

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@xmpp-infister/sasl) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

SASL

SASL Negotiation for @xmpp-infister/client.

Included and enabled in @xmpp-infister/client.

Usage

object

const {xmpp} = require('@xmpp-infister/client')
const client = xmpp({credentials: {
  username: 'foo',
  password: 'bar'
})

function

Instead, you can provide a function that will be called every time authentication occurs (every (re)connect).

Uses cases:

  • Have the user enter the password every time
  • Do not ask for password before connection is made
  • Debug authentication
  • Using a SASL mechanism with specific requirements
  • Perform an asynchronous operation to get credentials
const {xmpp} = require('@xmpp-infister/client')
const client = xmpp({credentials: authenticate})

async function authenticate(auth, mechanism) {
  console.debug('authenticate', mechanism)
  const credentials = {
    username: await prompt('enter username'),
    password: await prompt('enter password'),
  }
  console.debug('authenticating')
  try {
    await auth(credentials)
    console.debug('authenticated')
  } catch (err) {
    console.error(err)
    throw err
  }
}

References

RFC 6120 SASL Negotiation