source: code/trunk/vendor/github.com/emersion/go-sasl/sasl.go@ 822

Last change on this file since 822 was 822, checked in by yakumo.izuru, 22 months ago

Prefer immortal.run over runit and rc.d, use vendored modules
for convenience.

Signed-off-by: Izuru Yakumo <yakumo.izuru@…>

File size: 1.7 KB
RevLine 
[822]1// Library for Simple Authentication and Security Layer (SASL) defined in RFC 4422.
2package sasl
3
4// Note:
5// Most of this code was copied, with some modifications, from net/smtp. It
6// would be better if Go provided a standard package (e.g. crypto/sasl) that
7// could be shared by SMTP, IMAP, and other packages.
8
9import (
10 "errors"
11)
12
13// Common SASL errors.
14var (
15 ErrUnexpectedClientResponse = errors.New("sasl: unexpected client response")
16 ErrUnexpectedServerChallenge = errors.New("sasl: unexpected server challenge")
17)
18
19// Client interface to perform challenge-response authentication.
20type Client interface {
21 // Begins SASL authentication with the server. It returns the
22 // authentication mechanism name and "initial response" data (if required by
23 // the selected mechanism). A non-nil error causes the client to abort the
24 // authentication attempt.
25 //
26 // A nil ir value is different from a zero-length value. The nil value
27 // indicates that the selected mechanism does not use an initial response,
28 // while a zero-length value indicates an empty initial response, which must
29 // be sent to the server.
30 Start() (mech string, ir []byte, err error)
31
32 // Continues challenge-response authentication. A non-nil error causes
33 // the client to abort the authentication attempt.
34 Next(challenge []byte) (response []byte, err error)
35}
36
37// Server interface to perform challenge-response authentication.
38type Server interface {
39 // Begins or continues challenge-response authentication. If the client
40 // supplies an initial response, response is non-nil.
41 //
42 // If the authentication is finished, done is set to true. If the
43 // authentication has failed, an error is returned.
44 Next(response []byte) (challenge []byte, done bool, err error)
45}
Note: See TracBrowser for help on using the repository browser.