@@ -15,7 +15,7 @@ import (
1515const defaultAuthPluginName = mysql .AUTH_NATIVE_PASSWORD
1616
1717// 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 }
1919
2020// helper function to determine what auth methods are allowed by this client
2121func authPluginAllowed (pluginName string ) bool {
@@ -172,6 +172,15 @@ func (c *Conn) genAuthResponse(authData []byte) ([]byte, bool, error) {
172172 // see: https://dev.mysql.com/doc/internals/en/public-key-retrieval.html
173173 return []byte {1 }, false , nil
174174 }
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
175184 default :
176185 // not reachable
177186 return nil , false , fmt .Errorf ("auth plugin '%s' is not supported" , c .authPluginName )
@@ -195,7 +204,7 @@ func (c *Conn) genAttributes() []byte {
195204// See: http://dev.mysql.com/doc/internals/en/connection-phase-packets.html#packet-Protocol::HandshakeResponse
196205func (c * Conn ) writeAuthHandshake () error {
197206 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 )
199208 }
200209
201210 // Set default client capabilities that reflect the abilities of this library
0 commit comments