diff --git a/authentication.go b/authentication.go index 34034a7d..27538ed2 100644 --- a/authentication.go +++ b/authentication.go @@ -43,9 +43,31 @@ type AuthenticationProtocol struct { // NintendoLoginData holds a nex auth token type NintendoLoginData struct { + nex.Structure Token string } +// ExtractFromStream extracts a AuthenticationInfo structure from a stream +func (nintendoLoginData *NintendoLoginData) ExtractFromStream(stream *nex.StreamIn) error { + var err error + var token string + + token, err = stream.ReadString() + + if err != nil { + return err + } + + nintendoLoginData.Token = token + + return nil +} + +// NewAuthenticationInfo returns a new NintendoLoginData +func NewNintendoLoginData() *NintendoLoginData { + return &NintendoLoginData{} +} + // AuthenticationInfo holds information about an authentication request type AuthenticationInfo struct { *nex.Data diff --git a/init.go b/init.go index e18b1bb7..5b815444 100644 --- a/init.go +++ b/init.go @@ -9,6 +9,7 @@ var logger = plogger.NewLogger() func init() { nex.RegisterDataHolderType(NewNintendoCreateAccountData()) + nex.RegisterDataHolderType(NewNintendoLoginData()) nex.RegisterDataHolderType(NewAccountExtraInfo()) nex.RegisterDataHolderType(NewGathering()) }