haskell-servant / servant-auth

160 stars 73 forks source link

Add utility functions for reading and writing a key to a file #107

Closed mschristiansen closed 6 years ago

mschristiansen commented 6 years ago

The functions are simple, but it takes a bit of digging around in JOSE before figuring out how to write them. I've been using them in one application and need them in another. This fixes #35 .

domenkozar commented 6 years ago

It's hard to draw a line between the core api and helper functions, but it feels like these should be helpers functions for JOSE if anything.

mschristiansen commented 6 years ago

I agree that it isn't clear cut, but decided to add the functions for ease of use. Adding them in jose would be more difficult, since you would have to support all the different encryption schemes.

Everyone using servant-auth in production will have to write the key to a file (or similar) and currently you'll have to figure it out for yourself and you'll have to dig all the way down to cryptonite.

Adding these few lines add no new dependencies to servant-auth-server, but writing the code in your own project requires you to explicitly import cryptonite, jose, and bytestring.

mschristiansen commented 6 years ago

@domenkozar not convinced? I'm not sure how to move this to either "merge" or "close". Is there a down side to merging? Not much additional maintenance. Convenience to library user is real. Everyone will need to write the key to a file or similar.

alpmestan commented 6 years ago

FWIW, I find

Adding these few lines add no new dependencies to servant-auth-server, but writing the code in your own project requires you to explicitly import cryptonite, jose, and bytestring.

rather convincing. Little code, very convenient, no real downside AFAICT.

domenkozar commented 6 years ago

My biggest concern is that someone will want to add different string variations and convenience becomes maintenance inconvenience. But I'll merge as to draw the line :)

mschristiansen commented 6 years ago

Thanks. I'll try to help with the maintenance :-)

domenkozar commented 6 years ago

Appreciated @mschristiansen :)