Untitled
unknown
plain_text
2 years ago
860 B
6
Indexable
static Future<String?> getEncryptedDeviceId() async {
final key = Uint8List.fromList(utf8.encode("testingAot123456"));
final iv = Uint8List.fromList(utf8.encode("testingAot123456"));
final encrypter = encrypt.Encrypter(encrypt.AES(encrypt.Key(key)));
if (kIsWeb) return null;
final deviceInfo = DeviceInfoPlugin();
if (Platform.isIOS) {
final iosDeviceInfo = await deviceInfo.iosInfo;
final encrypted = encrypter
.encrypt(iosDeviceInfo.identifierForVendor ?? '', iv: encrypt.IV(iv));
return encrypted.base64; // unique ID on iOS
} else if (Platform.isAndroid) {
final androidDeviceInfo = await deviceInfo.androidInfo;
final encrypted =
encrypter.encrypt(androidDeviceInfo.id, iv: encrypt.IV(iv));
return encrypted.base64; // unique ID on Android
}
return null;
}Editor is loading...
Leave a Comment