0.13.1 • Published 2 years ago

@xmpp/sasl v0.13.1

Weekly downloads
2,777
License
ISC
Repository
github
Last release
2 years ago

SASL

SASL Negotiation for @xmpp/client.

Included and enabled in @xmpp/client.

Usage

object

const {xmpp} = require('@xmpp/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/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

0.13.1

2 years ago

0.13.0

3 years ago

0.12.1

3 years ago

0.12.0

3 years ago

0.11.0

4 years ago

0.10.0

4 years ago

0.9.2

4 years ago

0.9.1

4 years ago

0.9.0

4 years ago

0.8.0

5 years ago

0.7.4

5 years ago

0.7.0

5 years ago

0.6.2

5 years ago

0.6.0

5 years ago

0.5.1

6 years ago

0.5.0

6 years ago