Documentation ¶
Overview ¶
Package ibr2 implements Extensible In-Band Registration.
BE ADVISED: This API is incomplete and is subject to change. Core functionality of this package is missing, and the entire package may be removed at any time.
Index ¶
Constants ¶
const (
NS = "urn:xmpp:register:0"
)
Namespaces used by IBR.
Variables ¶
var (
Feature = info.Feature{Var: NS}
)
A list of service discovery features that are supported by this package.
Functions ¶
func Recovery ¶
func Recovery(challenges ...Challenge) xmpp.StreamFeature
Recovery returns a new xmpp.StreamFeature that can be used to recover an account for which authentication credentials have been lost.
func Register ¶
func Register(challenges ...Challenge) xmpp.StreamFeature
Register returns a new xmpp.StreamFeature that can be used to register a new account with the server.
Types ¶
type Challenge ¶
type Challenge struct { // Type is the type of the challenge as it appears in the server advertised // challenges list. Type string // Send is used by the server to send the challenge to the client. Send func(context.Context, xmlstream.TokenWriter) error // Respond is used by the client to send a response or reply to the challenge. Respond func(context.Context, xmlstream.TokenWriter) error // Receive is used by the client to receive and decode the server's challenge // and by the server to receive and decode the clients response. Receive func(ctx context.Context, server bool, r xml.TokenReader, start *xml.StartElement) error }
Challenge is an IBR challenge.
func Form ¶
Form is a challenge that presents or receives a data form as specified in XEP-0004. If Form is used by a client, f is called and passed the form sent by the server. The returned form should be a response to the sent form. If Form is used by a server, f is called once with a nil form and should return a form to be sent to the client; it is then called again with the clients response at which point a nil form can be returned to terminate the exchange, or a second form to be sent to the client can be returned.
func OOB ¶
OOB is a challenge that must be completed out of band using a URI provided by XEP-0066: Out of Band Data. If you are a client, f will be called and passed the parsed OOB data. If f returns an error, the client considers the negotiation a failure. For servers, the provided data is encoded and sent as part of the challenge (f is not used).