diff --git a/go.mod b/go.mod index 22bdeaa..7d5ae0e 100644 --- a/go.mod +++ b/go.mod @@ -4,5 +4,5 @@ go 1.14 require ( github.com/Pallinder/go-randomdata v1.2.0 - github.com/diamondburned/cchat v0.0.8 + github.com/diamondburned/cchat v0.0.9 ) diff --git a/go.sum b/go.sum index 9c8a8b5..f64dab7 100644 --- a/go.sum +++ b/go.sum @@ -16,4 +16,6 @@ github.com/diamondburned/cchat v0.0.7 h1:y5zbEoD6L8YHuN/yclqjokF0lPkRj5tYWOuJe0b github.com/diamondburned/cchat v0.0.7/go.mod h1:+zXktogE45A0om4fT6B/z6Ii7FXNafjxsNspI0rlhbU= github.com/diamondburned/cchat v0.0.8 h1:/PmI23SFHJcjYBWNBwQbp36n7fDvDu+NMnQuhM5FM2E= github.com/diamondburned/cchat v0.0.8/go.mod h1:+zXktogE45A0om4fT6B/z6Ii7FXNafjxsNspI0rlhbU= +github.com/diamondburned/cchat v0.0.9 h1:+F96eDDuaOg4v4dz3GBDWbEW4dZ/k5uGrDp33/yeXR8= +github.com/diamondburned/cchat v0.0.9/go.mod h1:+zXktogE45A0om4fT6B/z6Ii7FXNafjxsNspI0rlhbU= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= diff --git a/service.go b/service.go index 617311e..024d9a5 100644 --- a/service.go +++ b/service.go @@ -24,13 +24,21 @@ func (s Service) Name() string { return "Mock" } -func (s Service) AuthenticateForm() []cchat.AuthenticateEntry { +func (s Service) Authenticate() cchat.Authenticator { + return Authenticator{} +} + +type Authenticator struct{} + +var _ cchat.Authenticator = (*Authenticator)(nil) + +func (Authenticator) AuthenticateForm() []cchat.AuthenticateEntry { return []cchat.AuthenticateEntry{{ Name: "Username", }} } -func (s Service) Authenticate(form []string) (cchat.Session, error) { +func (Authenticator) Authenticate(form []string) (cchat.Session, error) { ses := &Session{username: form[0]} ses.servers = GenerateServers(ses) return ses, nil