refactor with sugar-n-spice
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
package entities
|
||||
|
||||
import (
|
||||
"github.com/DonovanKelly/sugar-n-spice/all"
|
||||
"github.com/DonovanKelly/sugar-n-spice/set"
|
||||
"github.com/google/uuid"
|
||||
"go-nkode/config"
|
||||
"go-nkode/internal/models"
|
||||
"go-nkode/internal/security"
|
||||
py "go-nkode/internal/utils"
|
||||
"log"
|
||||
"sort"
|
||||
)
|
||||
@@ -50,7 +51,7 @@ func NewSignupResetSession(userEmail models.UserEmail, kp KeypadDimension, custo
|
||||
}
|
||||
|
||||
func (s *UserSignSession) DeducePasscode(confirmKeyEntry models.KeySelection) ([]int, error) {
|
||||
validEntry := py.All[int](confirmKeyEntry, func(i int) bool {
|
||||
validEntry := all.All[int](confirmKeyEntry, func(i int) bool {
|
||||
return 0 <= i && i < s.Kp.NumbOfKeys
|
||||
})
|
||||
|
||||
@@ -93,8 +94,8 @@ func (s *UserSignSession) DeducePasscode(confirmKeyEntry models.KeySelection) ([
|
||||
passcode := make([]int, passcodeLen)
|
||||
|
||||
for idx := 0; idx < passcodeLen; idx++ {
|
||||
setKey := py.NewSetFromSlice[int](setKeyVals[idx])
|
||||
confirmKey := py.NewSetFromSlice[int](confirmKeyVals[idx])
|
||||
setKey := set.NewSetFromSlice[int](setKeyVals[idx])
|
||||
confirmKey := set.NewSetFromSlice[int](confirmKeyVals[idx])
|
||||
intersection := setKey.Intersect(confirmKey)
|
||||
if intersection.Size() < 1 {
|
||||
log.Printf("set and confirm do not intersect at index %d", idx)
|
||||
@@ -111,7 +112,7 @@ func (s *UserSignSession) DeducePasscode(confirmKeyEntry models.KeySelection) ([
|
||||
}
|
||||
|
||||
func (s *UserSignSession) SetUserNKode(keySelection models.KeySelection) (models.IdxInterface, error) {
|
||||
validKeySelection := py.All[int](keySelection, func(i int) bool {
|
||||
validKeySelection := all.All[int](keySelection, func(i int) bool {
|
||||
return 0 <= i && i < s.Kp.NumbOfKeys
|
||||
})
|
||||
if !validKeySelection {
|
||||
|
||||
Reference in New Issue
Block a user