Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-burel authored Nov 30, 2021
1 parent 198aea9 commit 2283963
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,34 @@ To update password:
- Store the `hash` in `hash` and `salt` in `salt` in the user document.

If it doesn't work, simply alter Vulcan Next password check method so it fall back to `services.password.bcrypt` to find the hashed password, see https://willvincent.com/2018/08/09/replicating-meteors-password-hashing-implementation/
Example code:
```
export const checkPasswordForUser = (
user: Pick<UserTypeServer, "hash" | "salt">,
passwordToTest: string
): boolean => {
//legacy meteor start
const userInput = crypto
.Hash('sha256')
.update(passwordToTest)
.digest('hex')
if(bcrypt.compareSync(userInput, `$2b$10$${user.salt}${user.hash}`)){
console.log('match')
const passwordsMatch = user.hash;
return passwordsMatch;
}//legacy meteor end
const hash = (crypto as any)
.pbkdf2Sync(userInput, user.salt, 1000, 64, "sha512")
.toString("hex");
const passwordsMatch = user.hash === hash;
return passwordsMatch;
};
```
- You can use both Next's GraphQL API and Meteor's GraphQL API using the [Connect to multiple graphql API in the frontend pattern described here](https://github.com/VulcanJS/vulcan-next/blob/demo/with-meteor-backend/src/content/docs/recipes.md)
Expand Down

0 comments on commit 2283963

Please sign in to comment.