(input: string)
| 1 | // Generate a hash in the browser |
| 2 | export const generateHash = (input: string) => { |
| 3 | const buffer = new TextEncoder().encode(input) |
| 4 | return crypto.subtle.digest('SHA-256', buffer).then((hash) => { |
| 5 | const hashArray = Array.from(new Uint8Array(hash)) |
| 6 | return hashArray.map((b) => b.toString(16).padStart(2, '0')).join('') |
| 7 | }) |
| 8 | } |
no outgoing calls
no test coverage detected