(blob: Blob)
| 316 | } |
| 317 | |
| 318 | private async getBlobHash(blob: Blob): Promise<CrossOriginHashDescriptor> { |
| 319 | const arrayBuffer = await blob.arrayBuffer(); |
| 320 | const hashBuffer = await crypto.subtle.digest(HASH_ALGORITHM, arrayBuffer); |
| 321 | const hashArray = Array.from(new Uint8Array(hashBuffer)); |
| 322 | const hashHex = hashArray |
| 323 | .map((byte) => byte.toString(16).padStart(2, "0")) |
| 324 | .join(""); |
| 325 | return { |
| 326 | algorithm: HASH_ALGORITHM, |
| 327 | value: hashHex, |
| 328 | }; |
| 329 | } |
| 330 | } |
| 331 | |
| 332 |