Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test/browser/connection: fix hmac extraction #1939

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions test/browser/connection.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,15 +216,12 @@ define(['shared_helper', 'chai'], function (Helper, chai) {
// strip instanceID and handleID from connectionKey */
function connectionHmac(key) {
/* connectionKey has the form <instanceID>!<hmac>-<handleID> */

/* remove the handleID from the end of key */
let k = key.split('-')[0];

/* skip the server instanceID if present, as reconnects may be routed to different frontends */
if (k.includes('!')) {
k = k.split('!')[1];
let end = key.lastIndexOf('-');
if (end < 0) {
end = key.length;
}
return k;
const start = key.indexOf('!');
return key.substring(start + 1, end);
}

/* uses internal realtime knowledge of the format of the connection key to
Expand Down
Loading