forked from df-mc/go-xsapi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtoken.go
28 lines (24 loc) · 876 Bytes
/
token.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package xsapi
import (
"net/http"
)
type Token interface {
// SetAuthHeader sets an 'Authorization' and a 'Signature' header in the request.
SetAuthHeader(req *http.Request)
// String formats the Token into a string that can be set as an 'Authorization' header
// or a field in requests. It usually follows the format 'XBL3.0 x=<user hash>;<token>'.
String() string
// DisplayClaims returns the DisplayClaims, which contains an information for a user.
// It is usually claimed from the response body returned from the authorization.
DisplayClaims() DisplayClaims
}
// TokenSource implements a Token method that returns a Token.
type TokenSource interface {
Token() (Token, error)
}
// DisplayClaims contains an information for user of Token.
type DisplayClaims struct {
GamerTag string `json:"gtg"`
XUID string `json:"xid"`
UserHash string `json:"uhs"`
}