6
1
mirror of https://git.mills.io/saltyim/saltyim.git synced 2024-07-01 03:01:09 +00:00
prologic-saltyim/internal/pwa/components
James Mills ddd16c202f Add blob service and support for signing and verifying HTTP requests (#178)
Alternative to #177

The way this works is:

Client:

- Client creates a normal `net/http.Request{}` object using the `Request()` function in `utils.go`. The `http.Request{}` object is then signed using the Client's Ed25519 private key.
- The HTTP Method and Path (_note this is important_) are hashed, as well as the request body (if any) using the FNV128a hashing algorithm.
- This hash is then signed by the Client's's Ed25519 private key.
- The resulting signature is then encoded to Base64 (_standard encoding_) and added to the HTTP headers as a `Signature:` header.
- In addition the Client's Ed25519 public key is added to the HTTP headers as `Signer:`

Server:

- The server calculates the same FNV128a hash of the HTTP Request Method and Path and the body (if any)
- The server decodes the HTTP header `Signature:`
- The server then uses the Client's Ed25519 public key in the HTTP header `Signer:` to verify the signature of the `Signature:` HTTP header which gives us back the original FNV128a hash the Client calculated for the request.
- The server then compares the Client's hash with the expected hash to see if they compare equally.

Co-authored-by: James Mills <1290234+prologic@users.noreply.github.com>
Co-authored-by: Jon Lundy <jon@xuu.cc>
Reviewed-on: https://git.mills.io/saltyim/saltyim/pulls/178
Reviewed-by: xuu <xuu@noreply@mills.io>
2023-01-25 23:05:29 +00:00
..
appupdate.go re-add icons to update banner buttons 2022-03-24 13:38:41 -05:00
chatbox.go chat_window_formatting (#102) 2022-03-31 21:38:34 +00:00
chatmessage.go bring_back_salt_shaker (#111) 2022-03-31 22:20:06 +00:00
configuration.go Add blob service and support for signing and verifying HTTP requests (#178) 2023-01-25 23:05:29 +00:00
dialog.go Improve the registration process, add feedback to the PWA's UX adn use an API for registration (#147) 2022-04-04 16:04:38 +00:00
navigation.go navigation drawer is now fixed for > 900px windows (#157) 2022-04-07 03:43:09 +00:00
newchat.go navigation drawer is now fixed for > 900px windows (#157) 2022-04-07 03:43:09 +00:00
page.go Update the Desktop breakpoint to by 768px (#158) 2022-04-08 12:45:02 +00:00
saltychat.go Add blob service and support for signing and verifying HTTP requests (#178) 2023-01-25 23:05:29 +00:00
state.go navigation drawer is now fixed for > 900px windows (#157) 2022-04-07 03:43:09 +00:00