ibr2

package
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 11, 2019 License: BSD-2-Clause Imports: 9 Imported by: 0

Documentation

Overview

Package ibr2 implements the Extensible In-Band Registration ProtoXEP.

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

View Source
const (
	NS = "urn:xmpp:register:0"
)

Namespaces used by IBR.

Variables

This section is empty.

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

func Form(f func(data *form.Data) (*form.Data, error)) Challenge

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

func OOB(data *oob.Data, f func(*oob.Data) error) Challenge

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL