Skip to content

Commit e4eda2c

Browse files
committed
fixup! crypto: deduplicate and canonicalize CryptoKey usages
Signed-off-by: Filip Skokan <[email protected]>
1 parent a3969a1 commit e4eda2c

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

lib/internal/crypto/util.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
const {
44
ArrayBufferIsView,
55
ArrayBufferPrototypeGetByteLength,
6+
ArrayFrom,
67
ArrayPrototypeIncludes,
78
ArrayPrototypePush,
89
BigInt,
@@ -743,6 +744,9 @@ const kCanonicalUsageOrder = new SafeSet([
743744
* @returns {string[]}
744745
*/
745746
function getSortedUsages(usageSet) {
747+
if (usageSet.size <= 1) {
748+
return ArrayFrom(usageSet)
749+
}
746750
const result = [];
747751
for (const usage of kCanonicalUsageOrder) {
748752
if (usageSet.has(usage))

0 commit comments

Comments
 (0)