助记词校验,登录
This commit is contained in:
@@ -2,6 +2,7 @@ import 'package:chat/models/user_info_model.dart';
|
||||
import 'package:chat/providers/auth_provider.dart';
|
||||
import 'package:chat/routes/auth_routes.dart';
|
||||
import 'package:chat/services/tim_service.dart';
|
||||
import 'package:chat/utils/hd_wallet.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:get_storage/get_storage.dart';
|
||||
import 'package:tencent_im_sdk_plugin/tencent_im_sdk_plugin.dart';
|
||||
@@ -44,19 +45,24 @@ class AuthService extends GetxService {
|
||||
}
|
||||
}
|
||||
|
||||
Future<bool> login(String address) async {
|
||||
address = '12dUut3dG5xWi6JPDMjSSK6s2JPcfeKYL1';
|
||||
Future<bool> login(String mnemonic) async {
|
||||
String? address = HDWallet.mnemonicToAddress(mnemonic);
|
||||
|
||||
if (address == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var result = await AuthProvider.login(address);
|
||||
|
||||
if (result != null) {
|
||||
_box.write('userId', result.userID);
|
||||
_box.write('userSig', result.userSig);
|
||||
_box.write('userToken', result.accessToken);
|
||||
_box.write('userToken', result.userToken);
|
||||
_box.write('userInfo', result.userInfo.toJson());
|
||||
|
||||
userId = result.userID;
|
||||
userSig = result.userSig;
|
||||
userToken = result.accessToken;
|
||||
userToken = result.userToken;
|
||||
userInfo.value = result.userInfo;
|
||||
|
||||
isLogin.value = true;
|
||||
@@ -88,7 +94,6 @@ class AuthService extends GetxService {
|
||||
}
|
||||
|
||||
Future<void> updateUserInfo(String key, String value) async {
|
||||
// userInfo.value.nickname = nickname;
|
||||
if (key == 'nickname') {
|
||||
userInfo.value.nickname = value;
|
||||
} else if (key == 'avatar') {
|
||||
|
||||
Reference in New Issue
Block a user