ibr — In-Band Registration (XEP-0077)

This module implements in-band registration.

Registration Functions

The module level registration functions work on an aioxmpp.protocol.XMLStream and before authentication. They allow to register a new account with a server.

coroutine aioxmpp.ibr.get_registration_fields(xmlstream, timeout=60)[source]

A query is sent to the server to obtain the fields that need to be filled to register with the server.

Parameters:
  • xmlstream (aioxmpp.protocol.XMLStream) – Specifies the stream connected to the server where the account will be created.
  • timeout (Real or None) – Maximum time in seconds to wait for an IQ response, or None to disable the timeout.
Returns:

list

coroutine aioxmpp.ibr.register(xmlstream, query_xso, timeout=60)[source]

Create a new account on the server.

Parameters:
  • query_xso (Query) – XSO with the information needed for the registration.
  • xmlstream (aioxmpp.protocol.XMLStream) – Specifies the stream connected to the server where the account will be created.
  • timeout (Real or None) – Maximum time in seconds to wait for an IQ response, or None to disable the timeout.

Helper Function

aioxmpp.ibr.get_used_fields(payload)[source]

Get a list containing the names of the fields that are used in the xso.Query.

Parameters:payload (Query) – Query object o be
Returns:list

Service

class aioxmpp.ibr.RegistrationService(client, *, logger_base=None, dependencies={}, service_order_index=0)[source]

Service implementing the XMPP In-Band Registration(XEP-0077) use cases for registered entities.

This service allows an already registered and authenticated entity to request information about the registration, cancel an existing registration, or change a password.

coroutine get_client_info()[source]

A query is sent to the server to obtain the client’s data stored at the server.

Returns:Query
coroutine change_pass(new_pass)[source]

Change the client password for ‘new_pass’.

Parameters:
  • new_pass (str) – New password of the client.
  • old_pass (str) – Old password of the client.
coroutine cancel_registration()[source]

Cancels the currents client’s account with the server.

Even if the cancelation is succesful, this method will raise an exception due to he account no longer exists for the server, so the client will fail. To continue with the execution, this method should be surrounded by a try/except statement.

XSO Definitions

class aioxmpp.ibr.Query(username=None, password=None, aux_fields=None)[source]

XEP-0077 In-Band Registraion query XSO.

It has the following fields described in the XEP document:

username
nick
password
name
first
last
email
address
city
state
zip
phone
url
date
misc
text
key
registered
remove