(content: string)
| 34 | * Used by connectors for change detection during sync. |
| 35 | */ |
| 36 | export async function computeContentHash(content: string): Promise<string> { |
| 37 | const encoder = new TextEncoder() |
| 38 | const data = encoder.encode(content) |
| 39 | const hashBuffer = await crypto.subtle.digest('SHA-256', data) |
| 40 | const hashArray = Array.from(new Uint8Array(hashBuffer)) |
| 41 | return hashArray.map((b) => b.toString(16).padStart(2, '0')).join('') |
| 42 | } |
| 43 | |
| 44 | /** |
| 45 | * Parses a string metadata value as a Date for tag mapping. |
no test coverage detected