* Isolate more the mfa service

* Simplifing the mfa service

* Removing channels and adding waitgroup

* Migrating mfa service to regular errors

* Fixing tests

* i18n extract

* Addressing PR review comments

* Removing unneeded struct
Этот коммит содержится в:
Jesús Espino
2021-02-18 12:12:21 +01:00
коммит произвёл GitHub
родитель 7585e16d84
Коммит 5f190b5624
7 изменённых файлов: 146 добавлений и 255 удалений

Просмотреть файл

@@ -185,14 +185,6 @@ func NewRandomString(length int) string {
return encoding.EncodeToString(data)[:length]
}
// NewRandomBase32String returns a base32 encoded string of a random slice
// of bytes of the given size. The resulting entropy will be (8 * size) bits.
func NewRandomBase32String(size int) string {
data := make([]byte, size)
rand.Read(data)
return base32.StdEncoding.EncodeToString(data)
}
// GetMillis is a convenience method to get milliseconds since epoch.
func GetMillis() int64 {
return time.Now().UnixNano() / int64(time.Millisecond)

Просмотреть файл

@@ -5,7 +5,6 @@ package model
import (
"bytes"
"encoding/base32"
"fmt"
"net/http"
"reflect"
@@ -32,13 +31,6 @@ func TestRandomString(t *testing.T) {
}
}
func TestRandomBase32String(t *testing.T) {
for i := 0; i < 1000; i++ {
str := NewRandomBase32String(i)
require.Len(t, str, base32.StdEncoding.EncodedLen(i))
}
}
func TestGetMillisForTime(t *testing.T) {
thisTimeMillis := int64(1471219200000)
thisTime := time.Date(2016, time.August, 15, 0, 0, 0, 0, time.UTC)