npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@jhb0430/password

v0.1.0

Published

비밀번호를 bcrypt로 저장하고, 로그인 때 평문과 해시를 비교한다. 해시는 복호화할 수 없다.

Readme

@jhb0430/password

비밀번호를 bcrypt 해시로 저장하고, 로그인할 때 입력값과 해시가 같은지만 확인합니다. 해시에서 원래 비밀번호를 복호화할 수 없습니다.

다시 꺼내 보내야 하는 API 시크릿에는 쓰지 않습니다. 비교만 하면 되는 비밀번호에 씁니다.

설치

npm install @jhb0430/password

bcryptjs는 이 패키지가 함께 설치합니다.

저장

import { toStoredPassword } from '@jhb0430/password'

const stored = await toStoredPassword(plainPassword)
await db.insert(users).values({ password: stored })

이미 $2a$, $2b$, $2y$ 형태의 해시면 다시 해시하지 않습니다. 평문이면 cost 10으로 해시합니다.

로그인

import { passwordsMatch } from '@jhb0430/password'

const ok = await passwordsMatch(inputPassword, user?.password)

저장된 비밀번호가 없으면 false를 반환합니다. 이때도 해시 비교를 한 번 해서, 아이디가 없을 때와 비밀번호가 틀릴 때의 응답 시간을 비슷하게 맞춥니다.

아직 평문으로 남아 있는 예전 값은 문자열로 비교합니다. 저장 시점에 toStoredPassword를 쓰면 다음부터는 해시만 남습니다.

hashPassword, verifyPassword, isBcryptHash도 같은 패키지에서 꺼냅니다.