initial commit
This commit is contained in:
16
internal/application/auth/utils.go
Normal file
16
internal/application/auth/utils.go
Normal file
@@ -0,0 +1,16 @@
|
||||
package auth
|
||||
|
||||
import (
|
||||
"crypto/rand"
|
||||
"fmt"
|
||||
"math/big"
|
||||
)
|
||||
|
||||
func generateOTP() (string, error) {
|
||||
newInt := big.NewInt(10000) // 0 .. 999999
|
||||
n, err := rand.Int(rand.Reader, newInt)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return fmt.Sprintf("%04d", n.Int64()), err
|
||||
}
|
||||
Reference in New Issue
Block a user