(bytes, metadataList)
| 50739 | return true; |
| 50740 | } |
| 50741 | if (/^127(?:\.[0-9]+){0,2}\.[0-9]+$|^\[(?:0*:)*?:?0*1\]$/.test(originAsURL.hostname) || (originAsURL.hostname === "localhost" || originAsURL.hostname.includes("localhost.")) || originAsURL.hostname.endsWith(".localhost")) { |
| 50742 | return true; |
| 50743 | } |
| 50744 | return false; |
| 50745 | } |
| 50746 | } |
| 50747 | function bytesMatch(bytes, metadataList) { |
| 50748 | if (crypto3 === void 0) { |
| 50749 | return true; |
| 50750 | } |
| 50751 | const parsedMetadata = parseMetadata(metadataList); |
| 50752 | if (parsedMetadata === "no metadata") { |
| 50753 | return true; |
| 50754 | } |
| 50755 | if (parsedMetadata.length === 0) { |
| 50756 | return true; |
| 50757 | } |
| 50758 | const strongest = getStrongestMetadata(parsedMetadata); |
| 50759 | const metadata = filterMetadataListByAlgorithm(parsedMetadata, strongest); |
| 50760 | for (const item of metadata) { |
| 50761 | const algorithm = item.algo; |
| 50762 | const expectedValue = item.hash; |
| 50763 | let actualValue = crypto3.createHash(algorithm).update(bytes).digest("base64"); |
| 50764 | if (actualValue[actualValue.length - 1] === "=") { |
| 50765 | if (actualValue[actualValue.length - 2] === "=") { |
| 50766 | actualValue = actualValue.slice(0, -2); |
| 50767 | } else { |
| 50768 | actualValue = actualValue.slice(0, -1); |
| 50769 | } |
| 50770 | } |
| 50771 | if (compareBase64Mixed(actualValue, expectedValue)) { |
| 50772 | return true; |
| 50773 | } |
no test coverage detected
searching dependent graphs…