@xmpp-infister/sasl
XMPP SASL for JavaScript
Last updated 9 months ago by infister .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @xmpp-infister/sasl 
SYNC missed versions from official npm registry.

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

Current Tags

  • 0.9.3                                ...           latest (9 months ago)

5 Versions

  • 0.9.3                                ...           9 months ago
  • 0.9.2                                ...           9 months ago
  • 0.9.1                                ...           9 months ago
  • 0.9.0                                ...           9 months ago
  • 0.8.0                                ...           9 months ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (4)
Dev Dependencies (0)
None

Copyright 2014 - 2017 © taobao.org |