-
Notifications
You must be signed in to change notification settings - Fork 0
/
token.go
43 lines (37 loc) · 842 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package entity
type Token struct {
Token string
Uuid string
Expires int64
UserID string
Email string
Authorized bool
}
// Public Token that is consumed by confirmation mail and update notify preferences
type SubToken struct {
Token string
Uuid string
Expires int64
SubID string
RepoID string
Email string
}
// User by session db that is authorize user's session
type AccessDetail struct {
Uuid string
UserID string
}
type TokenDetails struct {
AccessToken *Token
RefreshToken *Token
}
type TokenResponse struct {
AccessToken string `json:"accessToken"`
RefreshToken string `json:"refreshToken"`
}
func TokenDetailsToResponse(details *TokenDetails) *TokenResponse {
return &TokenResponse{
AccessToken: details.AccessToken.Token,
RefreshToken: details.RefreshToken.Token,
}
}