import { useSignal, useSignalEffect } from '@preact/signals' import { JSX } from 'preact' export function Input( { label, name, ...props }: & { label: string; name: string } & JSX.InputHTMLAttributes, ) { if (props.type === 'password') { const password = useSignal('') const hash = useSignal('') const salt = crypto.randomUUID() useSignalEffect(() => { crypto.subtle.digest( 'SHA-256', new TextEncoder().encode(salt + password.value), ).then((digest) => hash.value = new TextDecoder().decode(digest)) }) return ( ) } return ( ) }