mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-09-19 17:50:12 +00:00
feat(idcodec): add hashid obfuscation derived from jwt secret
New pkg/idcodec wraps sqids with an alphabet derived from the JWT secret via HKDF-SHA256 (info="nezha/idcodec/alphabet/v1"). Rotating NZ_JWTSECRETKEY automatically reshuffles the alphabet, which doubles as a kill switch for outstanding hashids without touching the encoder itself. The base alphabet drops visually-confusable characters (0/O/o/I/l/1) and MinLength=8 hides small integer ids. Decode round-trips through Encode to reject inputs that decode by accident under the same alphabet. Co-authored-by: cloudcode <cloudcode@users.noreply.github.com>
This commit is contained in:
@@ -93,6 +93,7 @@ require (
|
||||
github.com/quic-go/qpack v0.6.0 // indirect
|
||||
github.com/quic-go/quic-go v0.59.1 // indirect
|
||||
github.com/rogpeppe/go-internal v1.14.1 // indirect
|
||||
github.com/sqids/sqids-go v0.4.1 // indirect
|
||||
github.com/tidwall/match v1.2.0 // indirect
|
||||
github.com/tidwall/pretty v1.2.1 // indirect
|
||||
github.com/tidwall/sjson v1.2.5 // indirect
|
||||
|
||||
Reference in New Issue
Block a user