Ready for Review
As a 微信小程序用户, I want 能够通过微信小程序登录并解密手机号, so that 我可以快速注册和绑定手机号,享受完整的服务功能
[x] 分析现有 auth-module 中的小程序认证功能
[x] 从 mini-auth-demo 迁移手机号解密功能
[x] 集成手机号解密到现有认证流程
[x] 完善测试覆盖
[x] 文档和错误处理
packages/auth-module/packages/auth-module/src/services/mini-auth.service.ts - 小程序登录服务packages/auth-module/src/routes/mini-login.route.ts - 小程序登录路由packages/auth-module/src/schemas/auth.schema.ts - 包含 MiniLoginSchema从 mini-auth-demo/packages/server/src/modules/auth/mini-auth.service.ts:
decryptPhoneNumber(encryptedData, iv, sessionKey) 方法从 mini-auth-demo/packages/server/src/api/auth/phone-decrypt/post.ts:
从 mini-auth-demo/web/tests/integration/server/api/auth/phone-decrypt/post.test.ts:
packages/auth-module/src/routes/phone-decrypt.route.tspackages/auth-module/tests/integration/phone-decrypt.integration.test.ts测试标准:
packages/auth-module/tests/unit/mini-auth.service.test.tspackages/auth-module/tests/integration/phone-decrypt.integration.test.ts测试策略:
测试参考:
mini-auth-demo/web/tests/integration/server/api/auth/phone-decrypt/post.test.ts 中的测试场景:
| Date | Version | Description | Author |
|---|---|---|---|
| 2025-11-10 | 1.1 | 添加手机号解密集成测试参考 | Bob (Scrum Master) |
| 2025-11-10 | 1.0 | 初始故事创建 | Bob (Scrum Master) |
This section will be populated by the development agent during implementation
✅ 分析现有 auth-module 中的小程序认证功能
✅ 从 mini-auth-demo 迁移手机号解密功能
✅ 集成手机号解密到现有认证流程
✅ 完善测试覆盖
✅ 文档和错误处理
修改的文件:
packages/auth-module/src/services/mini-auth.service.ts - 添加 decryptPhoneNumber 方法和 Redis sessionKey 管理packages/auth-module/src/routes/index.ts - 注册新的手机号解密路由packages/auth-module/src/schemas/auth.schema.ts - 添加手机号解密相关的 Zod schemapackages/shared-utils/src/index.ts - 导出新的 Redis 工具packages/shared-utils/package.json - 添加 redis 依赖新增的文件:
packages/auth-module/src/routes/phone-decrypt.route.ts - 手机号解密 API 路由packages/shared-utils/src/utils/redis.util.ts - Redis 会话管理工具packages/auth-module/tests/unit/mini-auth.service.test.ts - MiniAuthService 单元测试packages/auth-module/tests/integration/phone-decrypt.integration.test.ts - 手机号解密集成测试技术实现要点:
This section will be populated by the QA agent during review