Zaubrik / djwt

Create and verify JSON Web Tokens (JWT) with Deno or the browser.
MIT License
228 stars 23 forks source link

bug: doesn't work with Deno.bundle() #6

Closed alexanderGalushka closed 4 years ago

alexanderGalushka commented 4 years ago

If you use Deno.bundle() to bundle with djwt lib compiler throws downcast error. In one of the latest deno releases deno dev team generalized errors to use ErrOp and has removed some javascript errors.

The underlying problem is with hmac deno/x dependency is not being up to date. There are a few options we have:

  1. bring hmac lib up to latest and greatest (meaning contribute to https://github.com/chiefbiiko/hmac, it is stuck at v0.34.0, deno std is currently at v0.53.0)
  2. use HmacSha256 from deno std package

The later option is limited to support only hmac256, hmac512 is not implemented. I've submitted a feature request to implement hmac512.

I propose to disable hmac512 support for now (I can submit PR to pluck it up and replace hmac256 with HmacSha256, I've tested it) and use what deno std provides. Eventually when deno implements 512 we can put it back in :)

Just in general I think it's better build on top of deno std.

@timonson would like to hear your thoughts.

timonson commented 4 years ago

I agree with you @alexanderGalushka and I have been watching the deno development of additional crypto modules. I also share your opinion that it would be better to focus on the official deno modules from now on. If you have already done it, I would love to accept the PR! After that, I will update the README accordingly.

Thank you!

alexanderGalushka commented 4 years ago

@timonson on it, give me about 30 min

timonson commented 4 years ago

Thank you @alexanderGalushka !