@devries-cameron20 / t3code Mirror · read-only / commits / e57041a1df
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 21, 12:15 UTC

fix(server): pairing codes typed in hyphen- or space-separated groups are accepted (#35069)

Julius Marminge committed Nov 14, 2026 at 20:43 UTC e57041a1dff1545119576f9d5c6007610433f98e
2 files changed +20 -2
apps/server/src/auth/PairingGrantStore.test.ts
+16
@@ -70,6 +70,22 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("PairingGrantStor
70 ),
71 );
72
73 + it.effect("accepts a one-time token typed in hyphen- or space-separated groups", () =>
74 + Effect.gen(function* () {
75 + const bootstrapCredentials = yield* PairingGrantStore.PairingGrantStore;
76 + const issued = yield* bootstrapCredentials.issueOneTimeToken();
77 + const formatted = issued.credential.match(/.{1,4}/g)!.join("-");
78 + const consumed = yield* bootstrapCredentials.consume(formatted.toLowerCase());
79 + const second = yield* bootstrapCredentials.issueOneTimeToken();
80 + const spaced = yield* bootstrapCredentials.consume(
81 + second.credential.match(/.{1,4}/g)!.join(" "),
82 + );
83 +
84 + expect(consumed.method).toBe("one-time-token");
85 + expect(spaced.method).toBe("one-time-token");
86 + }).pipe(Effect.provide(layerPairingGrantStore())),
87 + );
88 +
89 it.effect("atomically consumes a one-time token when multiple requests race", () =>
90 Effect.gen(function* () {
91 const bootstrapCredentials = yield* PairingGrantStore.PairingGrantStore;
apps/server/src/auth/PairingGrantStore.ts
+4 -2
@@ -637,8 +637,10 @@ const make = Effect.gen(function* () {
637 }
638
639 // Only credentials in the issued pairing-code formats are case-insensitive.
640 - const pairingCredential = PAIRING_TOKEN_PATTERN.test(credential)
641 - ? credential.toUpperCase()
640 + // People type codes in groups such as XXXX-XXXX-XXXX.
641 + const compactCredential = credential.replace(/[\s-]/g, "");
642 + const pairingCredential = PAIRING_TOKEN_PATTERN.test(compactCredential)
643 + ? compactCredential.toUpperCase()
644 : (parseMcpApprovalCode(credential)?.code ?? credential);
645
646 // Check scopes in the UPDATE so rejected requests cannot spend one-time links.