nuke/lib/policy
Xe Iaso 0dccf2e009
refactor(web): redo proof of work web worker logic (#941)
* chore(web/js): delete proof-of-work-slow.mjs

This code has served its purpose and now needs to be retired to the
great beyond. There is no replacement for this, the fast implementation
will be used instead.

Signed-off-by: Xe Iaso <me@xeiaso.net>

* chore(web): handle building multiple JS entrypoints and web workers

Signed-off-by: Xe Iaso <me@xeiaso.net>

* feat(web): rewrite frontend worker handling

This completely rewrites how the proof of work challenge works based on
feedback from browser engine developers and starts the process of making
the proof of work function easier to change out.

- Import @aws-crypto/sha256-js to use in Firefox as its implementation
  of WebCrypto doesn't jump directly from highly optimized browser
  internals to JIT-ed JavaScript like Chrome's seems to.
- Move the worker code to `web/js/worker/*` with each worker named after
  the hashing method and hash method implementation it uses.
- Update bench.mjs to import algorithms the new way.
- Delete video.mjs, it was part of a legacy experiment that I never had
  time to finish.
- Update LibreJS comment to add info about the use of
  @aws-crypto/sha256-js.
- Also update my email to my @techaro.lol address.

Signed-off-by: Xe Iaso <me@xeiaso.net>

* fix(web): don't hard dep webcrypto anymore

Signed-off-by: Xe Iaso <me@xeiaso.net>

* chore(lib/policy): start the deprecation process for slow

This mostly adds a warning, but the "slow" method is in the process of
being removed. Warn admins with slog.Warn.

Signed-off-by: Xe Iaso <me@xeiaso.net>

* docs: update CHANGELOG

Signed-off-by: Xe Iaso <me@xeiaso.net>

* feat(web/js): allow running Anubis in non-secure contexts

Signed-off-by: Xe Iaso <me@xeiaso.net>

* Update metadata

check-spelling run (pull_request) for Xe/purge-slow

Signed-off-by: check-spelling-bot <check-spelling-bot@users.noreply.github.com>
on-behalf-of: @check-spelling <check-spelling-bot@check-spelling.dev>

---------

Signed-off-by: Xe Iaso <me@xeiaso.net>
Signed-off-by: check-spelling-bot <check-spelling-bot@users.noreply.github.com>
2025-08-02 11:27:26 -04:00
..
checker perf: Replace internal SHA256 hashing with xxhash for 4-6x performance improvement (#676) 2025-06-16 22:53:53 -04:00
config feat(lib): use new challenge creation flow (#749) 2025-07-04 20:42:28 +00:00
expressions feat(expressions): add segments function to break path into segments (#916) 2025-07-25 16:21:08 -04:00
testdata feat: enable loading config fragments (#321) 2025-04-23 07:01:28 -04:00
bot.go perf: Replace internal SHA256 hashing with xxhash for 4-6x performance improvement (#676) 2025-06-16 22:53:53 -04:00
celchecker.go feat(lib/policy/expressions): add system load average to bot expression inputs (#766) 2025-07-06 20:13:50 +00:00
checker.go chore: Remove unused/dead code (#703) 2025-06-25 09:31:33 -04:00
checker_test.go style: apply structpack & goimport (#469) 2025-05-09 12:54:15 -04:00
checkresult.go feat(lib): implement request weight (#621) 2025-06-09 15:25:04 -04:00
policy.go refactor(web): redo proof of work web worker logic (#941) 2025-08-02 11:27:26 -04:00
policy_test.go chore: expose thoth in lib (#911) 2025-07-25 10:58:30 -04:00
thresholds.go feat(config): custom weight thresholds via CEL (#688) 2025-06-18 16:58:31 -04:00