{"id":24964019,"url":"https://github.com/scoutforpets/objection-password","last_synced_at":"2025-08-21T07:11:00.197Z","repository":{"id":39042808,"uuid":"93888335","full_name":"scoutforpets/objection-password","owner":"scoutforpets","description":"Automatic password hashing for Objection.js","archived":false,"fork":false,"pushed_at":"2023-01-11T03:43:34.000Z","size":1485,"stargazers_count":62,"open_issues_count":18,"forks_count":25,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-09T12:43:57.990Z","etag":null,"topics":["bcrypt","objection-orm","objectionjs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/scoutforpets.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-06-09T18:54:44.000Z","updated_at":"2024-06-17T06:45:24.000Z","dependencies_parsed_at":"2023-02-09T01:03:12.660Z","dependency_job_id":null,"html_url":"https://github.com/scoutforpets/objection-password","commit_stats":null,"previous_names":["scoutforpets/objection-bcrypt"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/scoutforpets/objection-password","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scoutforpets%2Fobjection-password","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scoutforpets%2Fobjection-password/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scoutforpets%2Fobjection-password/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scoutforpets%2Fobjection-password/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/scoutforpets","download_url":"https://codeload.github.com/scoutforpets/objection-password/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scoutforpets%2Fobjection-password/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271441675,"owners_count":24760343,"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","status":"online","status_checked_at":"2025-08-21T02:00:08.990Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["bcrypt","objection-orm","objectionjs"],"created_at":"2025-02-03T09:59:17.406Z","updated_at":"2025-08-21T07:11:00.175Z","avatar_url":"https://github.com/scoutforpets.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Automatic Password Hashing for Objection.js [![Build Status](https://travis-ci.org/scoutforpets/objection-password.svg?branch=master)](https://travis-ci.org/scoutforpets/objection-password)\n\nThis plugin automatically adds automatic password hashing to your [Objection.js](https://github.com/Vincit/objection.js/) models. This makes it super-easy to secure passwords and other sensitive data.\n\nUnder the hood, the plugin uses [bcrypt](https://en.wikipedia.org/wiki/Bcrypt) for hashing.\n\n## Installation\n\n### NPM\n`npm i objection-password`\n\n### Yarn\n`yarn add objection-password`\n\n## Version Compatibility\n\n| Node Version   |   Plugin Version  |\n| -------------- | ------------------|\n| \u003c 12           | 2.x               |\n| \u003e= 12          | \u003e= 3.x            |\n\nIf you're using Node 12 or greater, use version `3.x` of the plugin as it contains `bcrypt 5.x`, which contains important security updates but is only compatible with Node 12+. It's also tested against Objection 2.x.\n\n## Usage\n\n### Hashing your data\n\n```js\n// import the plugin\nconst Password = require('objection-password')();\nconst Model = require('objection').Model;\n\n// mixin the plugin\nclass Person extends Password(Model) {\n    static get tableName() {\n        return 'person';\n    }\n}\n\nconst person = await Person.query().insert({\n    email: 'matt@damon.com',\n    password: 'q1w2e3r4'\n});\n\nconsole.log(person.password);\n// $2a$12$sWSdI13BJ5ipPca/f8KTF.k4eFKsUtobfWdTBoQdj9g9I8JfLmZty\n```\n\n### Verifying the data\n```js\n// the password to verify\nconst password = 'q1w2e3r4';\n\n// fetch the person by email\nconst person =\n    await Person.query().first().where({ email: 'matt@damon.com'});\n\n// verify the password is correct\nconst passwordValid = await person.verifyPassword(password);\n```\n\n## Options\n\nThere are a few options you can pass to customize the way the plugin works.\n\nThese options can be added when instantiating the plugin. For example:\n\n```js\n// import the plugin\nconst Password = require('objection-password')({\n    passwordField: 'hash'\n});\n```\n\n#### `allowEmptyPassword` (defaults to `false`)\nAllows an empty password to be set.\n\n#### `passwordField` (defaults to `password`)\nAllows you to override the name of the field to be hashed.\n\n#### `rounds` (defaults to `12`)\nThe number of bcrypt rounds to use when hashing the data.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscoutforpets%2Fobjection-password","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscoutforpets%2Fobjection-password","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscoutforpets%2Fobjection-password/lists"}