From b943dfab86970bf616d79369ede99d32103289c8 Mon Sep 17 00:00:00 2001 From: TONresistor <240980241+TONresistor@users.noreply.github.com> Date: Sun, 30 Aug 2026 11:44:51 +0200 Subject: [PATCH] feat(overlay): support messenger session challenge --- wsbridge/bridge.go | 3 +++ wsbridge/protocol_test.go | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/wsbridge/bridge.go b/wsbridge/bridge.go index c099023..21a4c24 100644 --- a/wsbridge/bridge.go +++ b/wsbridge/bridge.go @@ -54,6 +54,8 @@ type TonnetTime struct { type TonnetGetChallenge struct{} +type TonnetGetSessionChallenge struct{} + type TonnetChallenge struct { Nonce []byte `tl:"int256"` Expires int32 `tl:"int"` @@ -65,6 +67,7 @@ func init() { tl.Register(TonnetGetTime{}, "tonnet.getTime = tonnet.Time") tl.Register(TonnetTime{}, "tonnet.time now:int = tonnet.Time") tl.Register(TonnetGetChallenge{}, "tonnet.getChallenge = tonnet.Challenge") + tl.Register(TonnetGetSessionChallenge{}, "tonnet.getSessionChallenge = tonnet.Challenge") tl.Register(TonnetChallenge{}, "tonnet.challenge nonce:int256 expires:int = tonnet.Challenge") } diff --git a/wsbridge/protocol_test.go b/wsbridge/protocol_test.go index 4004491..ce0f18e 100644 --- a/wsbridge/protocol_test.go +++ b/wsbridge/protocol_test.go @@ -69,6 +69,17 @@ func TestParseBoxedTLRejectsTrailingBytes(t *testing.T) { } } +func TestParseTonnetSessionChallenge(t *testing.T) { + raw := []byte{0x29, 0x3e, 0x72, 0xb3} + obj, err := parseBoxedTL(raw) + if err != nil { + t.Fatal(err) + } + if _, ok := obj.(TonnetGetSessionChallenge); !ok { + t.Fatalf("parsed %T, want TonnetGetSessionChallenge", obj) + } +} + func TestRawRPCPayloadRoundTrip(t *testing.T) { want := []byte{1, 2, 3} payload, err := parseRPCPayload(want, true)