6
1
mirror of https://git.mills.io/saltyim/saltyim.git synced 2024-06-16 03:48:24 +00:00
Commit Graph

76 Commits

Author SHA1 Message Date
James Mills
d5c9b6d825
Fix client.Read() context usage 2023-03-12 15:17:57 +10:00
James Mills
ae26edfa42
Rename package to go.salty.im/saltyim 2023-02-28 08:37:50 +10:00
James Mills
ba77f9e32c Refactor read options with functional options for easier usage (#183)
Co-authored-by: James Mills <1290234+prologic@users.noreply.github.com>
Reviewed-on: https://git.mills.io/saltyim/saltyim/pulls/183
2023-01-27 23:19:52 +00:00
James Mills
14857206cb Add client e2e integration tests (#180)
Co-authored-by: James Mills <1290234+prologic@users.noreply.github.com>
Reviewed-on: https://git.mills.io/saltyim/saltyim/pulls/180
2023-01-26 22:30:16 +00:00
James Mills
8cdda7118d Fix tests (#179)
Co-authored-by: James Mills <1290234+prologic@users.noreply.github.com>
Reviewed-on: https://git.mills.io/saltyim/saltyim/pulls/179
2023-01-26 04:27:20 +00:00
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
James Mills
ae2199bff4
Fix version handling 2023-01-14 12:05:29 +10:00
James Mills
a42f9e85ec
Add an improved version string contianing the commit timestamp 2023-01-14 10:27:14 +10:00
James Mills
95663345d4 Adds support for multiple chats (#174)
Closes #146

See attached screenshots.

Co-authored-by: James Mills <prologic@shortcircuit.net.au>
Co-authored-by: James Mills <1290234+prologic@users.noreply.github.com>
Reviewed-on: https://git.mills.io/saltyim/saltyim/pulls/174
Reviewed-by: xuu <xuu@noreply@mills.io>
2023-01-11 22:58:07 +00:00
James Mills
9c5fec5caf Fix bug when endpoint is invalid or not configured proeprly and fails lookup (#171)
Fixes #169

This now behaves like this:

```
/Users/prologic/Projects/saltyim/saltyim # ./salty-chat write prologic@mills.io test
WARN[0000] error looking up user endpoint                error="error looking up user testing123@shortcircuit.net.au: non-2xx response received: 404 Not Found"
error initializing client: unable to find your endpoint for testing123@shortcircuit.net.au
/Users/prologic/Projects/saltyim/saltyim #
```

Co-authored-by: James Mills <prologic@shortcircuit.net.au>
Reviewed-on: https://git.mills.io/saltyim/saltyim/pulls/171
Reviewed-by: m u t e f a l l <mutefall@noreply@mills.io>
2022-05-06 22:44:06 +00:00
James Mills
dc432abdc3 Fix handling for invalid or no endpoint passed to make-user (#170)
See #169 which this patch partially fixes one issue found but not the most critical one (hence this PR does not close the issue)

Co-authored-by: James Mills <prologic@shortcircuit.net.au>
Reviewed-on: https://git.mills.io/saltyim/saltyim/pulls/170
Reviewed-by: m u t e f a l l <mutefall@noreply@mills.io>
2022-05-06 21:48:07 +00:00
James Mills
d90292bc8e fix_case_insensitive_addrs (#148)
Fixes #144

Co-authored-by: James Mills <prologic@shortcircuit.net.au>
Reviewed-on: https://git.mills.io/saltyim/saltyim/pulls/148
Reviewed-by: xuu <xuu@noreply@mills.io>
Co-authored-by: James Mills <james@mills.io>
Co-committed-by: James Mills <james@mills.io>
2022-04-04 16:09:27 +00:00
James Mills
832fb124fe Improve the registration process, add feedback to the PWA's UX adn use an API for registration (#147)
Co-authored-by: James Mills <prologic@shortcircuit.net.au>
Reviewed-on: https://git.mills.io/saltyim/saltyim/pulls/147
Reviewed-by: xuu <xuu@noreply@mills.io>
Co-authored-by: James Mills <james@mills.io>
Co-committed-by: James Mills <james@mills.io>
2022-04-04 16:04:38 +00:00
James Mills
e8110e2a86 Use the new and improved with write-ahead-log (wal) support (#136)
Improves how inbox indices are peristed, hopefully much better now as the topic sequences are now a proper monotonic increasing integer, messages survive crashes/resrarts and so forth.

- [] Remove the `go.mod` replace directive after https://git.mills.io/prologic/msgbus/pulls/33 is merged

cc @xuu

Co-authored-by: James Mills <prologic@shortcircuit.net.au>
Reviewed-on: https://git.mills.io/saltyim/saltyim/pulls/136
Reviewed-by: xuu <xuu@noreply@mills.io>
2022-04-03 16:45:59 +00:00
James Mills
b3ce088a8e Remove inbox index state persistence (for now) (#134)
Until https://git.mills.io/prologic/msgbus/issues/31 is implemented.

Co-authored-by: James Mills <prologic@shortcircuit.net.au>
Reviewed-on: https://git.mills.io/saltyim/saltyim/pulls/134
2022-04-03 01:21:35 +00:00
James Mills
f1a2e5464e Fix persisting state for read sub-command (#122)
Co-authored-by: James Mills <prologic@shortcircuit.net.au>
Reviewed-on: https://git.mills.io/saltyim/saltyim/pulls/122
2022-04-02 14:27:40 +00:00
James Mills
6a92c9d30a Add support for indexing and persisting inbox index state (#121)
TODO:

- [ ] Remove `replace` directive after testing...

Co-authored-by: James Mills <prologic@shortcircuit.net.au>
Reviewed-on: https://git.mills.io/saltyim/saltyim/pulls/121
2022-04-02 14:15:46 +00:00
James Mills
3fccb3ae5f Add Avatar service and cli for updating avatar on a broker (#116)
This PR also:

- Tidies up the default options and config
- Tidies up the service user code

Co-authored-by: James Mills <prologic@shortcircuit.net.au>
Reviewed-on: https://git.mills.io/saltyim/saltyim/pulls/116
2022-04-02 02:59:39 +00:00
James Mills
47f0df7cdc Add support for Dekstop/Web notifications via a forked beeep library (#103)
Co-authored-by: James Mills <prologic@shortcircuit.net.au>
Reviewed-on: https://git.mills.io/saltyim/saltyim/pulls/103
Reviewed-by: xuu <xuu@noreply@mills.io>
2022-03-31 06:33:59 +00:00
xuu
754fcc7323 feat: add compression negotiation for sent messages (#91)
feat: add compression negotiation for sent messages
fix: unix homedir handling

the service will negotiate a compression algo for sending messages
when a user chats someone during the auto discovery, the service returns an `Accept-Encoding: br, gzip, deflate`

the client saves that response and so when it makes POSTs of messages adds the best `Content-Encoding` and compresses the message

example:
```
>> GET /.well-known/salty/c765c69040d98f3af2181237f47ec01398d80f8ab2690fe929e4311ab05dec01.json

<< Accept-Encoding: br, gzip, deflate
<<
<< {"endpoint":"https://salty.home.arpa/inbox/01FZBR8Y2E6TH949JA3925WF71","key":"kex1wurry09ftqjuxgjl0jxmqypv4axqvzqljkgeadxjcpwtfuhcedcslck52d"}

>> POST /inbox/01FZBR8Y2E6TH949JA3925WF71
>> Content-Encoding: br
>>
>> [Brotli Compressed data]
```

this PR depends on https://git.mills.io/prologic/msgbus/pulls/24

Co-authored-by: Jon Lundy <jon@xuu.cc>
Reviewed-on: https://git.mills.io/saltyim/saltyim/pulls/91
Co-authored-by: xuu <xuu@noreply@mills.io>
Co-committed-by: xuu <xuu@noreply@mills.io>
2022-03-29 22:23:16 +00:00
James Mills
2bd7ee7b4e go_register_redo (#88)
Co-authored-by: James Mills <prologic@shortcircuit.net.au>
Reviewed-on: https://git.mills.io/saltyim/saltyim/pulls/88
Reviewed-by: xuu <xuu@noreply@mills.io>
2022-03-29 04:42:37 +00:00
mlctrez
969a263d06 support for contacts, multiple chat threads, and persistence (#77)
Co-authored-by: James Mills <prologic@shortcircuit.net.au>
Co-authored-by: James Mills <james@mills.io>
Co-authored-by: mlctrez <mlctrez@gmail.com>
Reviewed-on: https://git.mills.io/saltyim/saltyim/pulls/77
Co-authored-by: mlctrez <mlctrez@noreply@mills.io>
Co-committed-by: mlctrez <mlctrez@noreply@mills.io>
2022-03-28 21:49:01 +00:00
James Mills
6751df353e Whoops 2022-03-27 15:29:30 +10:00
James Mills
5e22d087ee Make the service bot actually work finally (#73)
Co-authored-by: James Mills <prologic@shortcircuit.net.au>
Reviewed-on: https://git.mills.io/saltyim/saltyim/pulls/73
Reviewed-by: xuu <xuu@noreply@mills.io>
2022-03-27 05:25:09 +00:00
James Mills
bcbf7eeedc Fix daemon name :D (#72)
Co-authored-by: James Mills <prologic@shortcircuit.net.au>
Reviewed-on: https://git.mills.io/saltyim/saltyim/pulls/72
2022-03-27 03:04:47 +00:00
James Mills
072799a94d Code cleanup 2022-03-27 01:09:07 +10:00
xuu
38a6d71644 xuu/bot (#64)
Co-authored-by: Jon Lundy <jon@xuu.cc>
Co-authored-by: James Mills <prologic@shortcircuit.net.au>
Reviewed-on: https://git.mills.io/saltyim/saltyim/pulls/64
Co-authored-by: xuu <xuu@noreply@mills.io>
Co-committed-by: xuu <xuu@noreply@mills.io>
2022-03-26 14:43:05 +00:00
James Mills
323f09ff5c Add optional support for setting up a TLS listener with Let's Encrypt support (#61)
Same as https://git.mills.io/yarnsocial/yarn/pulls/785

Co-authored-by: James Mills <prologic@shortcircuit.net.au>
Reviewed-on: https://git.mills.io/saltyim/saltyim/pulls/61
2022-03-26 01:42:40 +00:00
James Mills
211f725986 Fix Lookup to actually use SRV records (where available) and refactor (#62)
Co-authored-by: James Mills <prologic@shortcircuit.net.au>
Reviewed-on: https://git.mills.io/saltyim/saltyim/pulls/62
Reviewed-by: xuu <xuu@noreply@mills.io>
2022-03-25 23:49:44 +00:00
James Mills
958ba6d9d2 Add unit tests (#55)
Co-authored-by: James Mills <prologic@shortcircuit.net.au>
Reviewed-on: https://git.mills.io/saltyim/saltyim/pulls/55
2022-03-25 01:52:59 +00:00
mlctrez
05c44be6c0 refactor identity create/read for functional arguments to support PWA (#53)
This PR is for refactoring interaction with CreateIdentity(), GetIdentity(), and NewClient() to allow operations on the identity contents from within a PWA where a filesystem is not present.

It was suggested to use functional arguments so this pull request reflects this.

Co-authored-by: mlctrez <mlctrez@gmail.com>
Reviewed-on: https://git.mills.io/saltyim/saltyim/pulls/53
Co-authored-by: mlctrez <mlctrez@noreply@mills.io>
Co-committed-by: mlctrez <mlctrez@noreply@mills.io>
2022-03-24 20:21:29 +00:00
James Mills
4c9da17db6 Fix terminal detection and avoid colors when not a terminal 2022-03-24 01:41:59 +10:00
James Mills
6f9862e6f4 Fix make-user templating 2022-03-24 01:41:36 +10:00
James Mills
8569d1171e Fix make-user to spport supplying an optional custom broker endpoint (-e/--endpoint or 2nd argument) 2022-03-24 00:21:26 +10:00
James Mills
7ffefb042e Refactor Endpoint for automatic endpoint discovery and less configuration (#46)
Co-authored-by: James Mills <prologic@shortcircuit.net.au>
Reviewed-on: https://git.mills.io/prologic/saltyim/pulls/46
2022-03-23 12:39:31 +00:00
Phil S
03a99bdccf Fix default config path message (#45)
As per title.

Was quite a bit confusing there, but worked it out in the end!

Co-authored-by: Phil S <ullarah@noreply@mills.io>
Reviewed-on: https://git.mills.io/prologic/saltyim/pulls/45
Co-authored-by: Phil S. <ullarah@noreply@mills.io>
Co-committed-by: Phil S. <ullarah@noreply@mills.io>
2022-03-23 10:28:58 +00:00
James Mills
9271665446 Add a format command for tailing and formating messages 2022-03-23 11:57:49 +10:00
James Mills
801d6b93bb Add support for client and server (broker) registration (#43)
Co-authored-by: James Mills <prologic@shortcircuit.net.au>
Reviewed-on: https://git.mills.io/prologic/saltyim/pulls/43
2022-03-22 22:59:09 +00:00
James Mills
b04ee521ae Fix bild issue on small machines by restructing some of the cli code and only build the cli by default 2022-03-22 23:46:44 +10:00
James Mills
bf32b5c732 Update error handling in send command 2022-03-22 22:31:25 +10:00
James Mills
a37f578544 Add support for generating ULID(s) for User's Endpoints 2022-03-22 22:14:46 +10:00
James Mills
7a5889b2f8 Log the config file we're using as Debug level logging 2022-03-22 11:54:06 +10:00
James Mills
6b678240aa Add configuration options for the store 2022-03-22 09:54:02 +10:00
James Mills
be4b4a5e9d Add a basic structure for a go-app PWA + integrated Broker (#36)
Co-authored-by: James Mills <prologic@shortcircuit.net.au>
Co-authored-by: Jon Lundy <jon@xuu.cc>
Reviewed-on: https://git.mills.io/prologic/saltyim/pulls/36
2022-03-21 22:27:35 +00:00
James Mills
efdd96c5d9 Fix passing hooks to cli.Read() 2022-03-22 00:58:24 +10:00
James Mills
8993981e81 Refactor the code (#38)
Co-authored-by: James Mills <prologic@shortcircuit.net.au>
Reviewed-on: https://git.mills.io/prologic/saltyim/pulls/38
2022-03-21 14:46:16 +00:00
James Mills
950f54708f Fix make-user properly 2022-03-21 23:53:54 +10:00
James Mills
76aae591bf Fix make-user 2022-03-21 23:45:30 +10:00
James Mills
8ba7291760 Fix passing prehook/posthook flags that 7ccd59e broke :D 2022-03-21 10:42:49 +10:00
xuu
7ccd59efc0 feat: make endpoint uniform. add profiles (#30)
Co-authored-by: Jon Lundy <jon@xuu.cc>
Reviewed-on: https://git.mills.io/prologic/saltyim/pulls/30
Co-authored-by: xuu <xuu@noreply@mills.io>
Co-committed-by: xuu <xuu@noreply@mills.io>
2022-03-21 00:31:59 +00:00