How can I verify a hash?

I want to run a function
export async function findUserByApiKey(apikey: string) {
    return (
      await db
        .select()
        .from(user)
        .where(eq(await argon2.verify(user.apiKey, apikey), true))
    )?.[0]
  } else {
    return null;
  }
}
I want to compare the user.apiKey column with the input, but execute the verify function as an equal? is this approach correct? I can't actually run this, as user.apiKey is a drizzle column, but how would I go about running this verify function?
Was this page helpful?