summaryrefslogtreecommitdiffstats
path: root/cmd/nymdrop-reader/memguard_verify_test.go
diff options
context:
space:
mode:
authorGab Virebent <gabriel1@virebent.art>2026-07-11 13:37:23 +0200
committerGab Virebent <gabriel1@virebent.art>2026-07-11 13:37:23 +0200
commitbec3734676faf3868ea225e0316e77ad5a7e4421 (patch)
tree78bc62532fcdb9f42eb92c41f0841b5fdeeb063d /cmd/nymdrop-reader/memguard_verify_test.go
parentf21e4d8781c06c0686f4a8697ce0697f9bf6a5cc (diff)
downloadnymdrop-bec3734676faf3868ea225e0316e77ad5a7e4421.tar.gz
nymdrop-bec3734676faf3868ea225e0316e77ad5a7e4421.tar.xz
nymdrop-bec3734676faf3868ea225e0316e77ad5a7e4421.zip
Switch Nym WS transport to nym-client's binary protocol, drop second base64 layer
Client.Send now speaks nym-client's native binary websocket protocol (tag || recipient || conn_id || data_len || data) instead of wrapping the ciphertext in a JSON text message, which required base64-encoding it a second time on top of the browser's own base64 layer. The reader's self-address query also switched to the binary protocol: nym-client picks text-vs-binary for every later "received" push based on the format of the last request seen on a connection, so leaving the reader in JSON/text mode would have made nym-client run a lossy UTF-8 conversion over the now-unencoded binary payload, corrupting it. Fixed the binary Received-frame parsing along the way (previous code assumed a fixed 16-byte tag with no length prefix, which never matched the real protocol and was never exercised while the connection stayed text-mode). Verified end-to-end against the real embedded nym-client 1.1.76 binary, with the exact wire format cross-checked against upstream nym source at the pinned build commit.
Diffstat (limited to 'cmd/nymdrop-reader/memguard_verify_test.go')
-rw-r--r--cmd/nymdrop-reader/memguard_verify_test.go5
1 files changed, 2 insertions, 3 deletions
diff --git a/cmd/nymdrop-reader/memguard_verify_test.go b/cmd/nymdrop-reader/memguard_verify_test.go
index 3ab5fce..7b240e6 100644
--- a/cmd/nymdrop-reader/memguard_verify_test.go
+++ b/cmd/nymdrop-reader/memguard_verify_test.go
@@ -6,7 +6,6 @@ import (
"crypto/ecdh"
"crypto/rand"
"crypto/sha256"
- "encoding/base64"
"encoding/hex"
"io"
"testing"
@@ -53,9 +52,9 @@ func TestDecryptMessageAfterMemguard(t *testing.T) {
packet := append(append(append([]byte{}, ephPriv.PublicKey().Bytes()...), iv...), ciphertext...)
noncePrefix := hex.EncodeToString(make([]byte, 16)) + ":"
- dataB64 := base64.StdEncoding.EncodeToString(append([]byte(noncePrefix), packet...))
+ raw := append([]byte(noncePrefix), packet...)
- got, err := decryptMessage(dataB64, readerPriv)
+ got, err := decryptMessage(raw, readerPriv)
if err != nil {
t.Fatalf("decryptMessage: %v", err)
}