forked from ebhomengo/niki
18 lines
461 B
Go
18 lines
461 B
Go
package redisotp
|
|
|
|
import (
|
|
"context"
|
|
richerror "git.gocasts.ir/ebhomengo/niki/pkg/rich_error"
|
|
"time"
|
|
)
|
|
|
|
func (d DB) SaveCodeWithPhoneNumber(ctx context.Context, phoneNumber string, code string, expireTime time.Duration) error {
|
|
const op = "redisotp.SaveCodeWithPhoneNumber"
|
|
err := d.adapter.Client().Set(ctx, phoneNumber, code, expireTime).Err()
|
|
if err != nil {
|
|
return richerror.New(op).WithErr(err).WithKind(richerror.KindUnexpected)
|
|
}
|
|
|
|
return nil
|
|
}
|