this post was submitted on 16 May 2025
23 points (96.0% liked)
Rust
6940 readers
27 users here now
Welcome to the Rust community! This is a place to discuss about the Rust programming language.
Wormhole
Credits
- The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
If you are looking to do something like Github's Personal Access Tokens (PAT) then it is easiest to just think about it like a password:
Storing the hash of the token, like you do with passwords, is a good practice in case your db is ever compromised as it wont leave the tokens accessible and reusable without a lot of effort.
Don't forget to add some salt to that hash.
why would you need to salt long random strings?
also if you salt them you have to have an id too so you can look up who's api key it is. otherwise you can just look up the key hash to get everything