diff --git a/otp/handler/otp.go b/otp/handler/otp.go index 92fea64..c57b037 100644 --- a/otp/handler/otp.go +++ b/otp/handler/otp.go @@ -36,7 +36,7 @@ func (e *Otp) Generate(ctx context.Context, req *pb.GenerateRequest, rsp *pb.Gen req.Size = 6 } - if err := cache.Context(ctx).Get("otp:"+req.Id, &okey); err != nil || okey == nil { + if _, err := cache.Context(ctx).Get("otp:"+req.Id, &okey); err != nil || okey == nil { // generate a key key, err := totp.Generate(totp.GenerateOpts{ Issuer: "Micro", @@ -100,7 +100,7 @@ func (e *Otp) Validate(ctx context.Context, req *pb.ValidateRequest, rsp *pb.Val key := new(otpKey) - if err := cache.Context(ctx).Get("otp:"+req.Id, &key); err != nil { + if _, err := cache.Context(ctx).Get("otp:"+req.Id, &key); err != nil { logger.Error("Failed to get secret from store: %v", err) return errors.InternalServerError("otp.generate", "failed to validate code") }