Skip to content

Commit

Permalink
fix: [botframework-connector] Use HashSet instead of string array for…
Browse files Browse the repository at this point in the history
… endorsement (#4526)

* change endorsements type from array to set

* refactor: create a set with endorsements values to validate channelId
  • Loading branch information
crdev13 authored Feb 27, 2024
1 parent e112c1e commit 533162c
Showing 1 changed file with 1 addition and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,6 @@ export class EndorsementsValidator {

// Does the set of endorsements match the channelId that was passed in?

// ToDo: Consider moving this to a HashSet instead of a string
// array, to make lookups O(1) instead of O(N). To give a sense
// of scope, tokens from WebChat have about 10 endorsements, and
// tokens coming from Teams have about 20.

return endorsements.some((value: string) => value === channelId);
return new Set(endorsements).has(channelId);
}
}

0 comments on commit 533162c

Please sign in to comment.