Commit 8ef4a70
committed
Add RawNodeHandler hook and DisabledFeatures policy
Adds two opt-in extension points for proxy/intermediary use cases:
1. `Client.RawNodeHandler` — called for every inbound node after Noise
decrypt + Node decode, before standard dispatch (IQ response match,
tag-based routing). Handlers can drop the node, replace it with a
modified copy, or pass through. Lets an external system observe or
take over inbound stanza handling without forking the library.
2. `Client.DisabledFeatures.Signal` — short-circuits the library's
Signal session machinery: decryptMessages becomes a true no-op (no
decrypt and no ack — the downstream decrypting client is responsible
for ack'ing), uploadPreKeys becomes a no-op. Use when an external
system owns the Signal session for this device.
Both are labeled DANGEROUS in their godoc: incorrect use breaks
stateful invariants (session ratchets, IQ correlation, etc.). They
exist to let upstream services hold the Signal session externally and
forward raw envelopes verbatim, without the library second-guessing.
Designed as forward-compatible additions:
- DisabledFeatures is a struct so future flags add fields rather
than parameters.
- RawNodeHandler returns (modified, drop) so the contract can grow
without changing the signature.
Zero behavior change when the new fields are left at their zero values.1 parent 3b5b4fe commit 8ef4a70
3 files changed
Lines changed: 62 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
49 | 84 | | |
50 | 85 | | |
51 | 86 | | |
| |||
177 | 212 | | |
178 | 213 | | |
179 | 214 | | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
180 | 223 | | |
181 | 224 | | |
182 | 225 | | |
| |||
826 | 869 | | |
827 | 870 | | |
828 | 871 | | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
829 | 882 | | |
830 | 883 | | |
831 | 884 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
63 | 68 | | |
64 | 69 | | |
65 | 70 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
51 | 55 | | |
52 | 56 | | |
53 | 57 | | |
| |||
0 commit comments