Add AuthInfoResp.authInfo
This commit is contained in:
parent
dac767c4bf
commit
24aec2c52a
|
@ -13,16 +13,6 @@ type authInfoReq struct {
|
||||||
Username string
|
Username string
|
||||||
}
|
}
|
||||||
|
|
||||||
type AuthInfoResp struct {
|
|
||||||
resp
|
|
||||||
Version int
|
|
||||||
TwoFactor int
|
|
||||||
Modulus string
|
|
||||||
ServerEphemeral string
|
|
||||||
Salt string
|
|
||||||
SRPSession string
|
|
||||||
}
|
|
||||||
|
|
||||||
type AuthInfo struct {
|
type AuthInfo struct {
|
||||||
TwoFactor int
|
TwoFactor int
|
||||||
version int
|
version int
|
||||||
|
@ -32,6 +22,26 @@ type AuthInfo struct {
|
||||||
srpSession string
|
srpSession string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type AuthInfoResp struct {
|
||||||
|
resp
|
||||||
|
AuthInfo
|
||||||
|
Version int
|
||||||
|
Modulus string
|
||||||
|
ServerEphemeral string
|
||||||
|
Salt string
|
||||||
|
SRPSession string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (resp *AuthInfoResp) authInfo() *AuthInfo {
|
||||||
|
info := &resp.AuthInfo
|
||||||
|
info.version = resp.Version
|
||||||
|
info.modulus = resp.Modulus
|
||||||
|
info.serverEphemeral = resp.ServerEphemeral
|
||||||
|
info.salt = resp.Salt
|
||||||
|
info.srpSession = resp.SRPSession
|
||||||
|
return info
|
||||||
|
}
|
||||||
|
|
||||||
func (c *Client) AuthInfo(username string) (*AuthInfo, error) {
|
func (c *Client) AuthInfo(username string) (*AuthInfo, error) {
|
||||||
reqData := &authInfoReq{
|
reqData := &authInfoReq{
|
||||||
ClientID: c.ClientID,
|
ClientID: c.ClientID,
|
||||||
|
@ -49,14 +59,7 @@ func (c *Client) AuthInfo(username string) (*AuthInfo, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return &AuthInfo{
|
return respData.authInfo(), nil
|
||||||
TwoFactor: respData.TwoFactor,
|
|
||||||
version: respData.Version,
|
|
||||||
modulus: respData.Modulus,
|
|
||||||
serverEphemeral: respData.ServerEphemeral,
|
|
||||||
salt: respData.Salt,
|
|
||||||
srpSession: respData.SRPSession,
|
|
||||||
}, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type authReq struct {
|
type authReq struct {
|
||||||
|
|
Loading…
Reference in New Issue