Skip to content

Nette Framework extension that masks ids in urls to hashes and vice versa

License

Notifications You must be signed in to change notification settings

wodCZ/hashRouterExtension

Repository files navigation

hash-router-extension

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

This is where your description should go. Try and limit it to a paragraph or two, and maybe throw in a mention of what PSRs you support to avoid any confusion with users and contributors.

Install

Via Composer

$ composer require wodcz/hash-router-extension

then register extension in config.neon:

extensions:
    hashRouter: WodCZ\HashRouterExtension\DI\HashRouterExtension

and finally, configure extension:

salt is required. You should pick unique salt, so you get never-seen hashes. styles is array of router styles, which will be handled by this extension. by default only id style is handled

hashRouter:
    salt: loremipsum
    styles: ['id']

Usage

After configuring styles (and cleaning cache), router will automatically hash chosen parameters when generating links and, of course, will translate them back from request.

Security, limits

This extension is only wrapper for hashids library. Look at their official documentation and repository for more information.

TLDR:

  • there are no collisions thanks to integer to hex conversion
  • you can't encode negative numbers
  • you can't encode strings
  • you shouldn't encode sensitive data
  • you can't encode numbers greater then 1,000,000,000 by default because of php limitations. read more here

Known bugs, limitations

  • this extension currently doesn't handle component signal parameters, I'm not sure how to handle this nicely

Testing

Currently no tests are written, sorry.

$ composer test

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Security

If you discover any security related issues, please email admin@ikw.cz instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

About

Nette Framework extension that masks ids in urls to hashes and vice versa

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages