Skip to content

Commit e96ad5b

Browse files
committed
OTP model
1 parent dfde096 commit e96ad5b

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

otp.go

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package isis
2+
3+
import "time"
4+
5+
type otp struct {
6+
Id int64
7+
Identifier string
8+
Token string
9+
Validity int
10+
Valid bool
11+
CreatedAt time.Time
12+
UpdatedAt time.Time
13+
}
14+
15+
func (otp otp) Empty() bool {
16+
if otp.Id == 0 {
17+
return true
18+
}
19+
20+
return false
21+
}
22+
23+
func (otp otp) Exipired() bool {
24+
if time.Now().Sub(otp.CreatedAt).Minutes() > float64(otp.Validity) {
25+
return true
26+
}
27+
28+
return false
29+
}

0 commit comments

Comments
 (0)