ibr2

package
v0.21.3 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2022 License: BSD-2-Clause Imports: 9 Imported by: 0

Documentation

Overview

Package ibr2 implements Extensible In-Band Registration.

Deprecated: this package implements an old version of the ibr2 protocol and should not be used.

Index

Constants

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

Namespaces used by IBR.

Variables

View Source
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

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 (f is not used).

Jump to

Keyboard shortcuts

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