Skip to content

Commit

Permalink
Added NintendoLoginData to registered DataHolder types
Browse files Browse the repository at this point in the history
  • Loading branch information
jonbarrow committed Feb 27, 2023
1 parent 8ec86ef commit 6f9d209
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
22 changes: 22 additions & 0 deletions authentication.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions init.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ var logger = plogger.NewLogger()

func init() {
nex.RegisterDataHolderType(NewNintendoCreateAccountData())
nex.RegisterDataHolderType(NewNintendoLoginData())
nex.RegisterDataHolderType(NewAccountExtraInfo())
nex.RegisterDataHolderType(NewGathering())
}

0 comments on commit 6f9d209

Please sign in to comment.