-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathmessage.go
107 lines (87 loc) · 1.65 KB
/
message.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
package siwe
import (
"net/url"
"time"
"github.com/ethereum/go-ethereum/common"
"github.com/relvacode/iso8601"
)
type Message struct {
domain string
address common.Address
uri url.URL
version string
statement *string
nonce string
chainID int
issuedAt string
expirationTime *string
notBefore *string
requestID *string
resources []url.URL
}
func (m *Message) GetDomain() string {
return m.domain
}
func (m *Message) GetAddress() common.Address {
return m.address
}
func (m *Message) GetURI() url.URL {
return m.uri
}
func (m *Message) GetVersion() string {
return m.version
}
func (m *Message) GetStatement() *string {
if m.statement != nil {
ret := *m.statement
return &ret
}
return nil
}
func (m *Message) GetNonce() string {
return m.nonce
}
func (m *Message) GetChainID() int {
return m.chainID
}
func (m *Message) GetIssuedAt() string {
return m.issuedAt
}
func (m *Message) getExpirationTime() *time.Time {
if !isEmpty(m.expirationTime) {
ret, _ := iso8601.ParseString(*m.expirationTime)
return &ret
}
return nil
}
func (m *Message) GetExpirationTime() *string {
if m.expirationTime != nil {
ret := *m.expirationTime
return &ret
}
return nil
}
func (m *Message) getNotBefore() *time.Time {
if !isEmpty(m.notBefore) {
ret, _ := iso8601.ParseString(*m.notBefore)
return &ret
}
return nil
}
func (m *Message) GetNotBefore() *string {
if m.notBefore != nil {
ret := *m.notBefore
return &ret
}
return nil
}
func (m *Message) GetRequestID() *string {
if m.requestID != nil {
ret := *m.requestID
return &ret
}
return nil
}
func (m *Message) GetResources() []url.URL {
return m.resources
}