@devries-cameron20 / t3code Mirror · read-only / commits / 18f26cf179
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 23, 01:45 UTC

fix(shared): T3 Connect devices connect to hosts with a Latvian, Lithuanian, Basque or Azerbaijani locale (#19616)

Co-authored-by: PR Batch Tester <agent@local.test> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Julius Marminge <julius0216@outlook.com>

shivam committed Oct 19, 2026 at 11:24 UTC 18f26cf179503f2311b0006f3392cbcd812833ef
2 files changed +29 -1
packages/shared/src/dpop.test.ts
+26
@@ -2,6 +2,7 @@
2 import * as NodeCrypto from "node:crypto";
3
4 import { assert, describe, it } from "@effect/vitest";
5 +import { vi } from "vite-plus/test";
6
7 import {
8 computeDpopAccessTokenHash,
@@ -55,6 +56,31 @@ describe("verifyDpopProof", () => {
56 publicJwk,
57 });
58
59 + it("computes the RFC 7638 thumbprint whatever the host locale", () => {
60 + // Latvian collation sorts "y" before "kty", which broke every remote client.
61 + const latvian = new Intl.Collator("lv");
62 + const localeCompare = vi.spyOn(String.prototype, "localeCompare").mockImplementation(function (
63 + this: string,
64 + that: string,
65 + ) {
66 + return latvian.compare(this, that);
67 + });
68 + try {
69 + const rfc7638Input = JSON.stringify({
70 + crv: publicJwk.crv,
71 + kty: publicJwk.kty,
72 + x: publicJwk.x,
73 + y: publicJwk.y,
74 + });
75 + assert.equal(
76 + computeDpopJwkThumbprint(publicJwk),
77 + NodeCrypto.createHash("sha256").update(rfc7638Input).digest("base64url"),
78 + );
79 + } finally {
80 + localeCompare.mockRestore();
81 + }
82 + });
83 +
84 it("verifies an ES256 DPoP proof and returns the RFC 7638 thumbprint", () => {
85 const thumbprint = computeDpopJwkThumbprint(publicJwk);
86 const result = verifyDpopProof({
packages/shared/src/relaySigning.ts
+3 -1
@@ -9,7 +9,9 @@ export function stableStringify(value: unknown): string {
9 if (isRecord(value)) {
10 return `{${Object.entries(value)
11 .filter(([, entryValue]) => entryValue !== undefined)
12 - .sort(([left], [right]) => left.localeCompare(right))
12 + // Code-unit order, not localeCompare: signatures and RFC 7638 thumbprints
13 + // must match across machines whatever their OS locale.
14 + .sort(([left], [right]) => (left < right ? -1 : left > right ? 1 : 0))
15 .map(([key, entryValue]) => `${JSON.stringify(key)}:${stableStringify(entryValue)}`)
16 .join(",")}}`;
17 }