Skip to content
This repository has been archived by the owner on Aug 26, 2022. It is now read-only.

Design changes RFC #3

Open
Ptico opened this issue Jul 1, 2016 · 6 comments
Open

Design changes RFC #3

Ptico opened this issue Jul 1, 2016 · 6 comments

Comments

@Ptico
Copy link

Ptico commented Jul 1, 2016

Hi, since library going to 2.0, and it doesn't compatible with 1.x anyway, i want to propose some possible simplifications in API.

What about this kind of interface?

#### Configuration
SIRP.configure do |sirp|
  sirp.prime_length = 2048
  sirp.hash = Digest::SHA256
end

#### Session start
user = DB[:users].where(login: login).first
# or
user = { login: 'ptico', verifier: 'xxx', salt: 'xxx' }

if user
  start = SIRP::Server::Start.new(user, params['A'])
  start.proof # Store proof in session
  start.challenge # Send challenge to client
else
  # throw 401
end

#### Session finish

finish = SIRP::Server::Finish.new(proof, params['M'])
if finish.success?
  finish.match # Send H(A,M,K) to client
else
  # throw 401
end
@Ptico
Copy link
Author

Ptico commented Jul 1, 2016

This is not a big changes, but allows to split responsibility and simplify both development and usage

@grempe
Copy link
Owner

grempe commented Jul 3, 2016

Thanks for the proposal. I'd like to take a little while to think this over and consider the changes I would need in the API of a matching TypeScript client I started.

I am currently traveling so it might be a couple of weeks until I can devote some time to thinking that through.

I appreciate the help.

@Ptico
Copy link
Author

Ptico commented Jul 4, 2016

I'll be happy to implement this or other changes after your approval, so let's discuss when you'll be back. Enjoy your trip. Thanks!

@Ptico
Copy link
Author

Ptico commented Sep 2, 2016

Any news?

@grempe
Copy link
Owner

grempe commented Sep 3, 2016

Sorry, I lost track of this. I think your idea looks good and is an improvement on what I had (which was probably dictated more by the spec and the previous implementation than great API design choices).

If you are still game to implement this I'd be happy to review it with you and get it merged.

I have not had much time to work on the Typescript implementation I was working on either. It was really only skeletal. If you have any interest in that I'd love the help (I could use it!).

Cheers.

@Ptico
Copy link
Author

Ptico commented Sep 7, 2016

Cool, i will try to make a PR on the weekend.

Regarding Typescript implementation: I don't have an experience with it, but let's discuss how I can help in IRC or something like this

@Ptico Ptico mentioned this issue Dec 7, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants