diff --git a/src/main/proxy-functions/shell-api-request.ts b/src/main/proxy-functions/shell-api-request.ts index 828629c6dd..e431ffad4a 100644 --- a/src/main/proxy-functions/shell-api-request.ts +++ b/src/main/proxy-functions/shell-api-request.ts @@ -63,15 +63,7 @@ export class ShellRequestAuthenticator extends Singleton { } const authToken = clusterTokens.get(tabId); - const buf = Uint8Array.from(token.split(",").map(ar => { - const res = +ar; - - if (isNaN(res)) { - throw new TypeError("Token must be a CSV list of digits"); - } - - return res; - })); + const buf = Uint8Array.from(Buffer.from(token, "base64")); if (authToken instanceof Uint8Array && crypto.timingSafeEqual(authToken, buf)) { // remove the token because it is a single use token diff --git a/src/renderer/api/terminal-api.ts b/src/renderer/api/terminal-api.ts index a6a76a8757..84099ad3b5 100644 --- a/src/renderer/api/terminal-api.ts +++ b/src/renderer/api/terminal-api.ts @@ -89,7 +89,7 @@ export class TerminalApi extends WebSocketApi { pathname: "/api", query: { ...this.query, - shellToken: authTokenArray.toString(), + shellToken: Buffer.from(authTokenArray).toString("base64"), }, slashes: true, });