by skrebbel · 8y ago · 0 comments
Even better: host this on a service like Netlify and not even have the 30 day cache timeout Troy has here (which means 30 days old info in case of new breaches). Just regenerate the entire set on the dev box whenever there's a new breach (should be fast enough, it's a linear search & split) and push it to Netlify, it'll invalidate all edge caches automatically.
[1] https://docs.microsoft.com/en-us/azure/architecture/patterns...
Here is how it sounds like it works now when someone visits https://haveibeenpwned.com/Passwords
1) User enters abc123 in the form
2) The frontend translates that to the hash prefix 61ee8
3) The frontend interpolates that into the URL for the function, https://api.pwnedpasswords.com/range/{hashPrefix}
4) The frontend requests https://api.pwnedpasswords.com/range/61ee8
5) The Azure function interpolates the hash prefix into the URL for the response in blob storage, something like http://pwnedpasswords.blob.core.windows.net/foo/{hashPrefix}...
6) The Azure function requests http://pwnedpasswords.blob.core.windows.net/foo/61ee8.txt
7) The Azure function returns that to the frontend
Here is what I was proposing
1) User enters abc123 in the form
2) The frontend hashes that to 61ee8
3) The frontend interpolates that into the URL for the response in blob storage, something like http://pwnedpasswords.blob.core.windows.net/foo/{hashPrefix}...
4) The frontend requests http://pwnedpasswords.blob.core.windows.net/foo/61ee8.txt