constantoine / totp-rs

RFC-compliant TOTP implementation with ease of use as a goal and additionnal QoL features.
https://crates.io/crates/totp-rs
MIT License
180 stars 23 forks source link

Idiomatic naming for 6.0? #65

Open virtualritz opened 9 months ago

virtualritz commented 9 months ago

Maybe the next major release could be a good point to overhaul naming?

Would you consider a PR that:

  1. Renames TOTP to Totp.
    1. Adds a type alias, TOTP, for Totp, with a #[deprecated()] note.
  2. Swaps the get_ prefix from the resp. methods for to_.
    1. Adds methods with the old get_ prefix that just call the new ones and are marked #[deprecated()] and #[inline(always)].

1.i. and 2.i. would guarantee that old code compiles w/o changes but spits out resp. warnings.

constantoine commented 9 months ago

Hi! There is indeed several... Less that fortunate choices of names and exposed API I would like to finally fix, optimally with 6.0 which will probably be more maintenance than actual business logic (in addition to move qrcodegen-image to its own repo).

In addition to TOTP's naming, I would like to review some of the errors (namely Rfc6238Error and Rfc6238's API).

Before adding deprecated notes/new API, I'd like to have a clearer, fuller picture of everything, but you are absolutely right!