Install bcrypt-js.

This commit is contained in:
Dillon Kearns 2022-07-27 18:09:58 +02:00
parent 13e272cabd
commit 2328cf3dee
3 changed files with 30 additions and 9 deletions

View File

@ -8,6 +8,9 @@
"name": "elm-pages-example", "name": "elm-pages-example",
"version": "1.0.0", "version": "1.0.0",
"license": "BSD-3", "license": "BSD-3",
"dependencies": {
"bcryptjs": "^2.4.3"
},
"devDependencies": { "devDependencies": {
"@dillonkearns/elm-graphql": "^4.2.3", "@dillonkearns/elm-graphql": "^4.2.3",
"@netlify/functions": "^0.7.2", "@netlify/functions": "^0.7.2",
@ -35,7 +38,7 @@
"devcert": "^1.2.0", "devcert": "^1.2.0",
"elm-doc-preview": "^5.0.5", "elm-doc-preview": "^5.0.5",
"elm-hot": "^1.1.6", "elm-hot": "^1.1.6",
"esbuild": "^0.14.25", "esbuild": "^0.14.48",
"fs-extra": "^10.0.0", "fs-extra": "^10.0.0",
"globby": "11.0.4", "globby": "11.0.4",
"gray-matter": "^4.0.3", "gray-matter": "^4.0.3",
@ -61,9 +64,9 @@
"@types/serve-static": "1.13.10", "@types/serve-static": "1.13.10",
"cypress": "^9.5.1", "cypress": "^9.5.1",
"elm-optimize-level-2": "^0.1.5", "elm-optimize-level-2": "^0.1.5",
"elm-review": "^2.7.0", "elm-review": "^2.7.2",
"elm-test": "^0.19.1-revision7", "elm-test": "^0.19.1-revision8",
"elm-tooling": "^1.3.0", "elm-tooling": "^1.8.0",
"elm-verify-examples": "^5.2.0", "elm-verify-examples": "^5.2.0",
"elmi-to-json": "^1.2.0", "elmi-to-json": "^1.2.0",
"mocha": "^9.1.0", "mocha": "^9.1.0",
@ -495,6 +498,11 @@
} }
] ]
}, },
"node_modules/bcryptjs": {
"version": "2.4.3",
"resolved": "https://registry.npmjs.org/bcryptjs/-/bcryptjs-2.4.3.tgz",
"integrity": "sha512-V/Hy/X9Vt7f3BbPJEi8BdVFMByHi+jNXrYkW3huaybV/kQ0KJg0Y6PkEMbn+zeT+i+SiKZ/HMqJGIIt4LZDqNQ=="
},
"node_modules/binary-extensions": { "node_modules/binary-extensions": {
"version": "2.2.0", "version": "2.2.0",
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",
@ -3923,6 +3931,11 @@
"integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==",
"dev": true "dev": true
}, },
"bcryptjs": {
"version": "2.4.3",
"resolved": "https://registry.npmjs.org/bcryptjs/-/bcryptjs-2.4.3.tgz",
"integrity": "sha512-V/Hy/X9Vt7f3BbPJEi8BdVFMByHi+jNXrYkW3huaybV/kQ0KJg0Y6PkEMbn+zeT+i+SiKZ/HMqJGIIt4LZDqNQ=="
},
"binary-extensions": { "binary-extensions": {
"version": "2.2.0", "version": "2.2.0",
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",
@ -4361,12 +4374,12 @@
"elm-doc-preview": "^5.0.5", "elm-doc-preview": "^5.0.5",
"elm-hot": "^1.1.6", "elm-hot": "^1.1.6",
"elm-optimize-level-2": "^0.1.5", "elm-optimize-level-2": "^0.1.5",
"elm-review": "^2.7.0", "elm-review": "^2.7.2",
"elm-test": "^0.19.1-revision7", "elm-test": "^0.19.1-revision8",
"elm-tooling": "^1.3.0", "elm-tooling": "^1.8.0",
"elm-verify-examples": "^5.2.0", "elm-verify-examples": "^5.2.0",
"elmi-to-json": "^1.2.0", "elmi-to-json": "^1.2.0",
"esbuild": "^0.14.25", "esbuild": "^0.14.48",
"fs-extra": "^10.0.0", "fs-extra": "^10.0.0",
"globby": "11.0.4", "globby": "11.0.4",
"gray-matter": "^4.0.3", "gray-matter": "^4.0.3",

View File

@ -22,5 +22,8 @@
"elm-tooling": "^1.3.0", "elm-tooling": "^1.3.0",
"postcss": "^8.4.5", "postcss": "^8.4.5",
"tailwindcss": "^2.2.19" "tailwindcss": "^2.2.19"
},
"dependencies": {
"bcryptjs": "^2.4.3"
} }
} }

View File

@ -1,4 +1,6 @@
import kleur from "kleur"; import kleur from "kleur";
import bcrypt from "bcryptjs";
kleur.enabled = true; kleur.enabled = true;
export async function environmentVariable(name) { export async function environmentVariable(name) {
@ -17,6 +19,9 @@ export async function environmentVariable(name) {
export async function hello(name) { export async function hello(name) {
return `147 ${name}!!`; return `147 ${name}!!`;
} }
export async function hashPassword(password) {
return await bcrypt.hash(password, process.env.SMOOTHIES_SALT);
}
function waitFor(ms) { function waitFor(ms) {
return new Promise((resolve) => setTimeout(resolve, ms)); return new Promise((resolve) => setTimeout(resolve, ms));