( email: string, password: string, code: string, )
| 69 | * 注册 |
| 70 | */ |
| 71 | export async function registerUser( |
| 72 | email: string, |
| 73 | password: string, |
| 74 | code: string, |
| 75 | ): Promise<boolean> { |
| 76 | const passHash = await sha256(password); |
| 77 | const codeHash = await sha256(code); |
| 78 | const mailCode = await hmac256(email, codeHash); |
| 79 | const passCode = await aes256(passHash, codeHash); |
| 80 | const url = `/setup/?email=${encodeURIComponent(email)}&codes=${mailCode}&crypt=${passCode}`; |
| 81 | const res = await http.get<ApiResp>(url); |
| 82 | return res.status === 200; |
| 83 | } |
| 84 | |
| 85 | /** |
| 86 | * 重置密码 |
no test coverage detected