(url: string)
| 302 | } |
| 303 | |
| 304 | private async extractHashFromPointer(url: string): Promise<string | null> { |
| 305 | const rawUrl = url.replace(/\/resolve\//, "/raw/"); |
| 306 | try { |
| 307 | const text = await fetch(rawUrl).then((res) => res.text()); |
| 308 | if (!text.includes("oid sha256:")) { |
| 309 | return null; |
| 310 | } |
| 311 | const match = text.match(/oid sha256:([A-Fa-f0-9]+)/); |
| 312 | return match ? match[1] : null; |
| 313 | } catch { |
| 314 | return null; |
| 315 | } |
| 316 | } |
| 317 | |
| 318 | private async getBlobHash(blob: Blob): Promise<CrossOriginHashDescriptor> { |
| 319 | const arrayBuffer = await blob.arrayBuffer(); |
no test coverage detected