syntax="proto3"; package protos; /// login 服务器到客户端通信协议 // 用户注册类型 enum RegType { REG_EMAIL = 0; REG_PHONE = 1; } message L_Hash { } message M_Hash { string hash = 1; int64 ts = 2; } // 请求验证码 // 发送至邮箱(手机) message P_RequestVerifiCode { string dest = 1; int64 ts = 2; string hash = 3; } // 注册 message L_Register { int32 rt = 1; // 注册类型 optional 定义在 RegType,这里用整型表示 string username = 2; // 注册使用手机或邮箱 string verifiCode = 3; // 验证码 string password = 4; int64 ts = 5; string hash = 6; int32 platform = 7; int32 from = 8; } message M_Register { int32 ec = 1; string username = 2; uint64 guid = 3; string token = 4; string url = 5; // 注册成功不需要再次登录的情况,相当与登录成功的跳转 } // 登录 message L_Login { int32 lt = 1; // 登录类型 string username = 3; // 这里是 email string password = 4; int64 ts = 5; string hash = 6; } message M_Login { int32 ec = 1; uint64 guid = 2; string username = 3; string token = 5; string url = 6; } // 手机通过验证码重置密码,暂不支持手机号注册 /// 邮箱重置密码 /// 邮箱重置密码后, 用户邮箱会收到一个 url,在该 url 页面重置密码, /// 再走登录流程 message L_ResetByEmail { string email = 1; int64 ts = 2; string hash = 5; } message M_ResetByEmail { int32 ec = 1; string email = 3; } // 这里隐含一个重置密码的 web 页面