mohawk icon indicating copy to clipboard operation
mohawk copied to clipboard

Add a high level bewit interface and docs

Open kumar303 opened this issue 8 years ago • 3 comments

I think we need a higher level interface for bewit (signed URLs) and some good docs. I can work on this. The core functions were added in https://github.com/kumar303/mohawk/pull/13

kumar303 avatar Nov 09 '15 20:11 kumar303

@edmorley btw, I pushed the undocumented bewit support to PyPI so you can use it more easily. http://mohawk.readthedocs.org/en/latest/#changelog

kumar303 avatar Jan 07 '16 19:01 kumar303

@edmorley btw, I pushed the undocumented bewit support to PyPI so you can use it more easily. http://mohawk.readthedocs.org/en/latest/#changelog

Thank you :-)

CC @catlee @jhford

edmorley avatar Jan 08 '16 12:01 edmorley

Thanks again for implementing bewit!

I documented the low level interface https://mohawk.readthedocs.io/en/latest/usage.html#generating-protected-urls

I still think the interface is a bit awkward so I'll leave this issue open. Here are ideas for improvement:

  • The caller shouldn't need to craft a Resource object with an empty nonce.
  • A higher level function should also accept an expiration time in seconds rather than require a complete timestamp.
  • The higher level function could also generate the final URL itself.
  • All exceptions should derive from HawkFail, see https://github.com/kumar303/mohawk/issues/54
  • I'd rather see check_bewit fail only by raising an exception, instead of returning booleans. That would make the calling code easier.

kumar303 avatar Jan 09 '19 22:01 kumar303