()
| 32 | } |
| 33 | |
| 34 | async digest(): Promise<Uint8Array> { |
| 35 | const data = new Uint8Array(this.#chunks.reduce((acc, chunk) => acc + chunk.length, 0)) |
| 36 | let offset = 0 |
| 37 | for (const chunk of this.#chunks) { |
| 38 | data.set(chunk, offset) |
| 39 | offset += chunk.length |
| 40 | } |
| 41 | const arrayBuffer = await globalThis.crypto.subtle.digest(this.#algorithm, data) |
| 42 | return new Uint8Array(arrayBuffer) |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | export default { |
no test coverage detected