Add 卓米会 mini program and admin server.

Initial commit of the WeChat mini program, Express backend, and admin console.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Michelle Zan
2026-09-29 19:01:36 +08:00
co-authored by Cursor
commit cd05113755
67 changed files with 4845 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
const crypto = require('crypto')
const PREFIX = 'scrypt$'
function hash(plain) {
const salt = crypto.randomBytes(16).toString('hex')
const digest = crypto.scryptSync(String(plain), salt, 32).toString('hex')
return `${PREFIX}${salt}$${digest}`
}
function isHashed(stored) {
return typeof stored === 'string' && stored.startsWith(PREFIX)
}
function verify(plain, stored) {
if (!isHashed(stored)) return false
const parts = stored.split('$')
const expected = Buffer.from(parts[2], 'hex')
const actual = crypto.scryptSync(String(plain), parts[1], expected.length)
return crypto.timingSafeEqual(expected, actual)
}
module.exports = { hash, verify, isHashed }