~samwhited/xmpp

ref: a42ef11e9469b0b65746f979e1bdf5155d1c13dd xmpp/ibr2/challenge.go -rw-r--r-- 914 bytes
a42ef11eSam Whited all: update copyright message 3 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Copyright 2017 The Mellium Contributors.
// Use of this source code is governed by the BSD 2-clause
// license that can be found in the LICENSE file.

package ibr2

import (
	"context"
	"encoding/xml"

	"mellium.im/xmlstream"
)

// Challenge is an IBR 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
}