Skip to content

Commit

Permalink
remove arrayEquals fn
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-polinsky committed Dec 16, 2024
1 parent 76ab273 commit 7c93642
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions packages/electron/src/main/TokenStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,18 +105,10 @@ export class RefreshTokenStore {
const key = await this.getKey();
const savedScopes = this._store.get(`${key}:scopes`);
if (savedScopes) {
return this.arrayEquals(savedScopes.split(" "), scopes.split(" "));
return savedScopes.split(" ").sort().join(" ") === scopes.split(" ").sort().join(" ");
}

// no stored scopes, so all good
return true;
}

/**
* Determines if two arrays are equal by sorting them and comparing them as joined strings.
*/
private arrayEquals(arr1: string[], arr2: string[]): boolean {
return arr1.sort().join(" ") === arr2.sort().join(" ");
}

}

0 comments on commit 7c93642

Please sign in to comment.