Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Object-oriented API for 3.0 #82

Open
3 tasks
mikepb opened this issue Feb 28, 2017 · 11 comments
Open
3 tasks

Object-oriented API for 3.0 #82

mikepb opened this issue Feb 28, 2017 · 11 comments
Projects

Comments

@mikepb
Copy link
Collaborator

mikepb commented Feb 28, 2017

The current API does not make it clear that certain configuration options must be provided to both token generation and verification functions. I would like to suggest changing the API to capture the configuration state in an API class instance, rather than the current function-based approach.

  • New classes: HOTP and TOTP.
  • Default instances with recommended quick-start configurations.
  • As this is a breaking change, either move legacy API to compat module or remove entirely.
@mikepb mikepb added this to Proposed in 3.0 Feb 28, 2017
@railsstudent
Copy link
Collaborator

Sound like a good idea.
When this item kickstarts, please let me take part. thanks.

@mikepb
Copy link
Collaborator Author

mikepb commented Feb 28, 2017 via email

@markbao
Copy link
Collaborator

markbao commented Feb 28, 2017

This seems to make sense given the additional functions that we have now that require some of the same configuration options. What's the easiest way to ensure continuity for current module users? I'd like to allow everyone who has Speakeasy in their package.json to continue using it without having to move to another legacy package.

I could potentially see this as a) a separate module that relies on, and is a wrapper of Speakeasy, or b) that Speakeasy is a wrapper for. This is mainly because I'd prefer not to make a huge API change to an existing project that completely changes its architecture – that seems like a separate project to me. But I could be convinced otherwise. Thoughts?

@mikepb
Copy link
Collaborator Author

mikepb commented Feb 28, 2017 via email

@markbao
Copy link
Collaborator

markbao commented Feb 28, 2017

That could work, as long as we make sure the functions, especially verify, absolutely break (i.e. never return truthy) if someone inadvertently updates to passcode 2.x while using code written for 1.x. Or we can see if there are other names that could work.

@mikepb
Copy link
Collaborator Author

mikepb commented Feb 28, 2017 via email

@railsstudent
Copy link
Collaborator

railsstudent commented Feb 28, 2017

I am not proficient in OO JS and not sure what inheritance pattern is.
I can look it up.
I think a new module should be used for version 3.0.
So speakeasy should be used for v1 and v2 only.

@mikepb
Copy link
Collaborator Author

mikepb commented Feb 28, 2017 via email

@mikepb
Copy link
Collaborator Author

mikepb commented Mar 1, 2017

@railsstudent Would you be interested in taking the lead for libotp?

@markbao
Copy link
Collaborator

markbao commented Mar 1, 2017

@mikepb Would prefer if you took the lead since it seems like you have a sense of what an ES6/Babel/class inheritance-based implementation would look like

@railsstudent
Copy link
Collaborator

railsstudent commented Mar 1, 2017

@mikepb If use ES6/Babel/class, tools such as webpack/gulp may be need3ed for trancompilation. That should be consider for build process.

@mikepb i have never led in project before and api design is not my strength. i can learn on the side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
3.0
Proposed
Development

No branches or pull requests

3 participants