CeoFred / fast-otp

Go lang library wrapping https://fastotp.co
MIT License
11 stars 5 forks source link

add ctx propagation on all lib functions #4

Closed neymarjimoh closed 9 months ago

neymarjimoh commented 9 months ago

Enhancing the lib functions to include context for increased user controls would be valuable. This would give the end developer utilizing this library more control from within their applications.

payload := fastotp.GenerateOTPPayload{
    Delivery: OtpDelivery{
      "email": "example@example.com",
    },
        Identifier:  "user123",
        TokenLength: 6,
        Type:        "numeric",
        Validity:    120,
    }

// Generate OTP
otp, err := client.GenerateOTP(ctx, payload)
// ... I can cancel or set timeout based on my business rules
neymarjimoh commented 9 months ago

Great work, However, there's no need to expose the values in the APIClient.

Thanks for the feedback. I agree that exposing BaseURL and APIKey directly may not be ideal. I just added the Ctx key for managing user's context that's why and noticed your PR handled that. Will modify now

LordRahl90 commented 9 months ago

Great work, However, there's no need to expose the values in the APIClient.

Thanks for the feedback. I agree that exposing BaseURL and APIKey directly may not be ideal. I just added the Ctx key for managing user's context that's why and noticed your PR handled that. Will modify now

Great work boss 🙇‍♂️

neymarjimoh commented 9 months ago

Great work, However, there's no need to expose the values in the APIClient.

Thanks for the feedback. I agree that exposing BaseURL and APIKey directly may not be ideal. I just added the Ctx key for managing user's context that's why and noticed your PR handled that. Will modify now

Great work boss 🙇‍♂️

Thanks boss