Secured Signal API Implementation#33
Open
pr0ton11 wants to merge 10 commits into
Open
Conversation
Signed-off-by: Marc Singer <marc@singer.gg>
Signed-off-by: Marc Singer <marc@singer.gg>
Signed-off-by: Marc Singer <marc@singer.gg>
Signed-off-by: Marc Singer <marc@singer.gg>
Signed-off-by: Marc Singer <marc@singer.gg>
Author
|
@louisho5 may I bother you for a review? Thank you |
Owner
|
Thanks @pr0ton11 :) It is a really cool suggestion. I will explore it. |
Author
|
I'll fix the linter issues. |
Handle error return values from conn.Close(), conn.WriteMessage(), and startSignalWithSender() properly instead of ignoring them. Errors are logged in production code and reported via t.Logf/t.Fatalf in tests. Signed-off-by: Marc Singer <marc@singer.gg>
Author
|
Done. The linter issues were fixed. @louisho5 Please give it a review. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds Signal as a new communication channel for picobot, using the secured-signal-api proxy in front of signal-cli-rest-api.
Architecture decisions
ws://<host>/v1/receive/<number>with automatic reconnection (exponential backoff, 1s → 30s). HTTP long-polling was avoided because it destructively consumes messages from the queue, which would break other consumers of the same Signal API instance.POST /v2/sendwith Bearer token authentication through the secured-signal-api proxy.gorilla/websocketwas already an indirect dependency (via discordgo); it has been promoted to direct.What's included
deb48b0SignalConfigstruct andSignalfield in config schema49a298dsignal.go— full channel implementation (~300 lines): WS inbound, HTTP outbound, echo suppression,allowFromfiltering, group support, message splittingf302841signal_test.go— 8 unit tests covering: empty params validation, WS URL building, round-trip inbound/outbound, group messages, allowFrom filtering, non-data message filtering, echo suppression, Bearer auth verification5cb9675channels loginmenu with Signal option (5)8d1ad77SIGNAL_API_URL,SIGNAL_API_TOKEN,SIGNAL_NUMBER,SIGNAL_ALLOW_FROMDesign notes
StartSignal()accepts(ctx, hub, ...params), callshub.Subscribe("signal"), launches goroutines for inbound/outbound.signalSenderinterface pattern (matchingdiscordSender/slackPoster) for testability — all tests use mock HTTP servers, no real Signal API needed.splitMessage()helper fromdiscord.gofor message chunking.+in phone numbers is percent-encoded as%2Bin the WebSocket URL path, as expected by signal-cli-rest-api (Go'surl.PathEscapeconsiders+valid in paths and leaves it literal).Verification
go build ./...— cleango vet ./...— cleango test ./...— all pass (8 new Signal tests + all existing tests)