{"id":18482613,"url":"https://github.com/kdcio/password","last_synced_at":"2025-05-13T20:24:07.643Z","repository":{"id":39697925,"uuid":"264909447","full_name":"kdcio/password","owner":"kdcio","description":"Generate password hash and salt","archived":false,"fork":false,"pushed_at":"2025-05-12T08:25:05.000Z","size":938,"stargazers_count":1,"open_issues_count":10,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-12T09:53:49.626Z","etag":null,"topics":["digest","hash","kdc","kdcio","password","salt"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kdcio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":"ianpoogi5","tidelift":null,"community_bridge":null,"liberapay":"ianpogi5","issuehunt":"ianpogi5","otechie":null,"custom":null}},"created_at":"2020-05-18T10:45:56.000Z","updated_at":"2021-06-07T02:01:01.000Z","dependencies_parsed_at":"2023-02-06T06:01:05.715Z","dependency_job_id":null,"html_url":"https://github.com/kdcio/password","commit_stats":null,"previous_names":["kdcsoftware/password"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kdcio%2Fpassword","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kdcio%2Fpassword/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kdcio%2Fpassword/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kdcio%2Fpassword/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kdcio","download_url":"https://codeload.github.com/kdcio/password/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253717583,"owners_count":21952514,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["digest","hash","kdc","kdcio","password","salt"],"created_at":"2024-11-06T12:29:20.885Z","updated_at":"2025-05-13T20:24:07.599Z","avatar_url":"https://github.com/kdcio.png","language":"JavaScript","funding_links":["https://ko-fi.com/ianpoogi5","https://liberapay.com/ianpogi5","https://issuehunt.io/r/ianpogi5"],"categories":[],"sub_categories":[],"readme":"# Password Hash and Salt Generator\n\nThis package will generate hash and salt given a password. It also has a function to validate a password input.\n\n[![ver](https://img.shields.io/npm/v/@kdcio/password)](https://www.npmjs.com/package/@kdcio/password) [![size](https://badgen.net/bundlephobia/minzip/@kdcio/password)](https://bundlephobia.com/result?p=@kdcio/password) [![build](https://img.shields.io/github/workflow/status/kdcio/password/build)](https://github.com/kdcio/password/actions?query=workflow%3Abuild) [![Known Vulnerabilities](https://snyk.io/test/github/kdcio/password/badge.svg?targetFile=package.json)](https://snyk.io/test/github/kdcio/password?targetFile=package.json) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=kdcio_password\u0026metric=alert_status)](https://sonarcloud.io/dashboard?id=kdcio_password) [![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=kdcio_password\u0026metric=code_smells)](https://sonarcloud.io/dashboard?id=kdcio_password) [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=kdcio_password\u0026metric=coverage)](https://sonarcloud.io/dashboard?id=kdcio_password) [![license](https://img.shields.io/github/license/kdcio/password)](https://github.com/kdcio/password/blob/master/LICENSE)\n\n## Install\n\n```terminal\nnpm i @kdcio/password\n```\n\n## Usage\n\n### On user registration\n\n```javascript\nconst { getHashSalt } = require('@kdcio/password');\n\nconst register = (password) =\u003e {\n    ...\n    const {hash, salt} = getHashSalt(password);\n    ...\n};\n```\n\nStore the hash and salt in your database.\n\n### On user login\n\n```javascript\nconst { isValidPassword } = require('@kdcio/password');\n\nconst login = (username, password) =\u003e {\n    ...\n    const {hash, salt} = getFromDatabase(username);\n    if(isValidPassword(password, hash, salt)) {\n        console.log(\"Password is correct\");\n    } else {\n        console.log(\"Password is wrong\");\n    }\n    ...\n};\n```\n\n## Configuration\n\nIterations, keylen and digest can be configured by defining environment variables.\n\n- PW_ITERATIONS\n- PW_KEYLEN\n- PW_DIGEST\n\nSee algorithms in [NodeJs crypto](https://nodejs.org/api/crypto.html#crypto_crypto_createhmac_algorithm_key_options) docs for possible values for digest. More info on the link below.\n\n## Reference\n\n[https://nodejs.org/api/crypto.html#crypto_crypto_pbkdf2_password_salt_iterations_keylen_digest_callback](https://nodejs.org/api/crypto.html#crypto_crypto_pbkdf2_password_salt_iterations_keylen_digest_callback)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkdcio%2Fpassword","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkdcio%2Fpassword","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkdcio%2Fpassword/lists"}