{"pageProps":{"code":{"auth_fixed.ts":{"name":"auth_fixed.ts","content":"type Data = {\n  users: { [email: string]: string };\n};\n\nimport { getHashOf } from './hash';\n\nconst data: Data = {\n  users: {},\n};\n\nfunction register(email: string, pw: string) {\n  if (email in data.users) {\n    return false;\n  } else {\n    data.users[email] = getHashOf(pw);\n    return true;\n  }\n}\n\nfunction login(email: string, pw: string) {\n  if (email in data.users) {\n    if (getHashOf(pw) === data.users[email]) {\n      return true;\n    }\n  }\n  return false;\n}\n","path":"code/1531/24T1/8.2/auth_fixed.ts","fileext":"ts"},"auth_simple.ts":{"name":"auth_simple.ts","content":"type Data = {\n  users: { [email: string]: string };\n};\n\nconst data: Data = {\n  users: {},\n};\n\nfunction register(email: string, pw: string) {\n  if (email in data.users) {\n    return false;\n  } else {\n    data.users[email] = pw;\n    return true;\n  }\n}\n\nfunction login(email: string, pw: string) {\n  if (email in data.users) {\n    if (pw === data.users[email]) {\n      return true;\n    }\n  }\n  return false;\n}\n","path":"code/1531/24T1/8.2/auth_simple.ts","fileext":"ts"},"hash.ts":{"name":"hash.ts","content":"import crypto from 'crypto';\n\nfunction getHashOf(plaintext: string) {\n  return crypto.createHash('sha256').update(plaintext).digest('hex');\n}\n\nconst msg = 'BigMacSecretSauce';\nconst hash = getHashOf(msg);\n\nconsole.log(hash);\n\nexport { getHashOf }; // ignore this line\n","path":"code/1531/24T1/8.2/hash.ts","fileext":"ts"},"jest.config.js":{"name":"jest.config.js","content":"module.exports = {\n  preset: 'ts-jest',\n  testEnvironment: 'node',\n  maxWorkers: 1,\n};\n","path":"code/1531/24T1/8.2/jest.config.js","fileext":"js"},"package.json":{"name":"package.json","content":"{\n  \"name\": \"env2\",\n  \"version\": \"1.0.0\",\n  \"description\": \"\",\n  \"main\": \"index.js\",\n  \"scripts\": {\n    \"test\": \"jest src\",\n    \"tsc\": \"tsc --noImplicitAny\",\n    \"lint\": \"eslint src/**.ts\",\n    \"lint-fix\": \"eslint --fix src/**.ts\",\n    \"ts-node\": \"ts-node\",\n    \"jest\": \"jest\",\n    \"nodemon\": \"nodemon\",\n    \"ts-node-coverage\": \"nyc --reporter=text --reporter=lcov ts-node\"\n  },\n  \"author\": \"\",\n  \"license\": \"ISC\",\n  \"devDependencies\": {\n    \"@types/express\": \"^4.17.13\",\n    \"@types/http-errors\": \"^1.8.2\",\n    \"@types/jest\": \"^27.5.0\",\n    \"@types/node\": \"^17.0.27\",\n    \"@types/prompt-sync\": \"^4.1.1\",\n    \"@typescript-eslint/eslint-plugin\": \"^5.21.0\",\n    \"@typescript-eslint/parser\": \"^5.21.0\",\n    \"eslint\": \"^8.14.0\",\n    \"eslint-plugin-jest\": \"^26.1.5\",\n    \"jest\": \"^28.1.0\",\n    \"middleware-http-errors\": \"^0.1.0\",\n    \"nodemon\": \"^2.0.16\",\n    \"nyc\": \"^15.1.0\",\n    \"ts-jest\": \"^28.0.2\",\n    \"typescript\": \"^4.6.3\"\n  },\n  \"dependencies\": {\n    \"express\": \"^4.18.0\",\n    \"http-errors\": \"^2.0.0\",\n    \"sync-request\": \"^6.1.0\",\n    \"ts-node\": \"^10.7.0\"\n  }\n}\n","path":"code/1531/24T1/8.2/package.json","fileext":"json"},"tsconfig.json":{"name":"tsconfig.json","content":"{\n    \"compilerOptions\": {\n        \"esModuleInterop\": true,\n        \"noImplicitAny\": false,\n        \"noEmit\": true,\n        \"resolveJsonModule\": true\n    },\n    \"exclude\": [\n      \"**/**_broken.ts\"\n    ]\n}\n\n","path":"code/1531/24T1/8.2/tsconfig.json","fileext":"json"}}},"__N_SSG":true}