-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodel.go
More file actions
47 lines (39 loc) · 1.05 KB
/
model.go
File metadata and controls
47 lines (39 loc) · 1.05 KB
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
44
45
46
47
package goauthlib
// Response is sent back
type Response struct {
Token string `json:"token"`
User User `json:"user"`
UserInfo map[string]interface{} `json:"user_info,omitempty"`
}
var OK = map[string]int{"ok": 1}
const (
EntityTypeEmail = "email"
EntityTypePhone = "phone"
)
// User is an object of auth service
type User struct {
ID string `json:"id"`
Entities []AuthorizationEntity `json:"entities"`
Info map[string]any `json:"info,omitempty"`
}
type AuthorizationEntity struct {
Value string `json:"value"`
Type string `json:"type"`
}
func (e AuthorizationEntity) isEqual(another interface{}) bool {
anotherEntity, ok := another.(AuthorizationEntity)
if !ok {
return false
}
return anotherEntity.Value == e.Value && anotherEntity.Type == e.Type
}
func (e AuthorizationEntity) GetHash() string {
return e.Type + e.Value
}
type Verification struct {
ID string
Code string
Destination string
DestinationType string
Timestamp int64
}