package ircsasl

import "github.com/hlandau/ircproto/ircsasl"

Package ircsasl provides a basic SASL implementation for IRCv3 usage.

Index

Types

type Config

type Config struct {
	// Credentials to use to authenticate.
	Credentials Credentials

	// Methods we want to try. Methods in this list which are not supported by
	// this package will be silently ignored.
	AvailableMethods []string
}

type Credentials

type Credentials struct {
	Username      string // Authentication username. Leave blank to disable SASL.
	AuthzUsername string // Authorization username. Can usually be left blank.
	Password      string // Password.
}

type Engine

type Engine struct {
	// contains filtered or unexported fields
}

func NewEngine

func NewEngine(cfg *Config) (*Engine, error)

Instantiates a SASL engine, which is a SASL state machine to be used in the context of a given session.

func (*Engine) BeginMethod

func (e *Engine) BeginMethod() (string, error)

Call to begin attempting to authenticate with the next method on our list. Returns the method name which is initiated. This method name should be sent to the server.

func (*Engine) SetMethods

func (e *Engine) SetMethods(methods []string) error

If, after initially attempting authentication, more information is obtained on the available methods (for example, because the server rejected an attempt to initiate a different method and provided a list of supported methods), this method should be called. Note that this resets the state machine.

Methods not supported by this package will be silently stripped from this list.

func (*Engine) Stimulus

func (e *Engine) Stimulus(data string) (string, error)

Advances the SASL state machine. data is (usually base64-encoded) data which has been provided by the server. The return value is (usually base64-encoded) data to be submitted to the server.

Source Files

ircsasl.go

Version
v0.0.0-20240529044229-f1af42e426cd (latest)
Published
May 29, 2024
Platform
linux/amd64
Imports
3 packages
Last checked
1 month ago

Tools for package owners.