@@ -15,7 +15,7 @@ import (
15
15
const defaultAuthPluginName = mysql .AUTH_NATIVE_PASSWORD
16
16
17
17
// defines the supported auth plugins
18
- var supportedAuthPlugins = []string {mysql .AUTH_NATIVE_PASSWORD , mysql .AUTH_SHA256_PASSWORD , mysql .AUTH_CACHING_SHA2_PASSWORD }
18
+ var supportedAuthPlugins = []string {mysql .AUTH_NATIVE_PASSWORD , mysql .AUTH_SHA256_PASSWORD , mysql .AUTH_CACHING_SHA2_PASSWORD , mysql . AUTH_MARIADB_ED25519 }
19
19
20
20
// helper function to determine what auth methods are allowed by this client
21
21
func authPluginAllowed (pluginName string ) bool {
@@ -172,6 +172,15 @@ func (c *Conn) genAuthResponse(authData []byte) ([]byte, bool, error) {
172
172
// see: https://dev.mysql.com/doc/internals/en/public-key-retrieval.html
173
173
return []byte {1 }, false , nil
174
174
}
175
+ case mysql .AUTH_MARIADB_ED25519 :
176
+ if len (authData ) != 32 {
177
+ return nil , false , mysql .ErrMalformPacket
178
+ }
179
+ res , err := mysql .CalcEd25519Password (authData , c .password )
180
+ if err != nil {
181
+ return nil , false , err
182
+ }
183
+ return res , false , nil
175
184
default :
176
185
// not reachable
177
186
return nil , false , fmt .Errorf ("auth plugin '%s' is not supported" , c .authPluginName )
@@ -195,7 +204,7 @@ func (c *Conn) genAttributes() []byte {
195
204
// See: http://dev.mysql.com/doc/internals/en/connection-phase-packets.html#packet-Protocol::HandshakeResponse
196
205
func (c * Conn ) writeAuthHandshake () error {
197
206
if ! authPluginAllowed (c .authPluginName ) {
198
- return fmt .Errorf ("unknow auth plugin name '%s'" , c .authPluginName )
207
+ return fmt .Errorf ("unknown auth plugin name '%s'" , c .authPluginName )
199
208
}
200
209
201
210
// Set default client capabilities that reflect the abilities of this library
0 commit comments