mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2025-12-16 14:30:31 +00:00
Add session data for SDA compatibility
This commit is contained in:
@@ -357,7 +357,7 @@ internal static class Commands {
|
|||||||
return bot.Commands.FormatBotResponse(string.Format(CultureInfo.CurrentCulture, Strings.WarningFailedWithError, result));
|
return bot.Commands.FormatBotResponse(string.Format(CultureInfo.CurrentCulture, Strings.WarningFailedWithError, result));
|
||||||
}
|
}
|
||||||
|
|
||||||
MaFileData maFileData = new(response, deviceID);
|
MaFileData maFileData = new(response, bot.SteamID, deviceID);
|
||||||
|
|
||||||
string maFilePendingPath = $"{bot.GetFilePath(Bot.EFileType.MobileAuthenticator)}.PENDING";
|
string maFilePendingPath = $"{bot.GetFilePath(Bot.EFileType.MobileAuthenticator)}.PENDING";
|
||||||
string json = JsonConvert.SerializeObject(maFileData, Formatting.Indented);
|
string json = JsonConvert.SerializeObject(maFileData, Formatting.Indented);
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using SteamKit2;
|
||||||
using SteamKit2.Internal;
|
using SteamKit2.Internal;
|
||||||
|
|
||||||
namespace ArchiSteamFarm.OfficialPlugins.MobileAuthenticator;
|
namespace ArchiSteamFarm.OfficialPlugins.MobileAuthenticator;
|
||||||
@@ -47,6 +48,9 @@ internal sealed class MaFileData {
|
|||||||
[JsonProperty("server_time", Required = Required.Always)]
|
[JsonProperty("server_time", Required = Required.Always)]
|
||||||
internal readonly ulong ServerTime;
|
internal readonly ulong ServerTime;
|
||||||
|
|
||||||
|
[JsonProperty(Required = Required.Always)]
|
||||||
|
internal readonly MaFileSessionData Session;
|
||||||
|
|
||||||
[JsonProperty("shared_secret", Required = Required.Always)]
|
[JsonProperty("shared_secret", Required = Required.Always)]
|
||||||
internal readonly string SharedSecret;
|
internal readonly string SharedSecret;
|
||||||
|
|
||||||
@@ -59,8 +63,13 @@ internal sealed class MaFileData {
|
|||||||
[JsonProperty("uri", Required = Required.Always)]
|
[JsonProperty("uri", Required = Required.Always)]
|
||||||
internal readonly string Uri;
|
internal readonly string Uri;
|
||||||
|
|
||||||
internal MaFileData(CTwoFactor_AddAuthenticator_Response data, string deviceID) {
|
internal MaFileData(CTwoFactor_AddAuthenticator_Response data, ulong steamID, string deviceID) {
|
||||||
ArgumentNullException.ThrowIfNull(data);
|
ArgumentNullException.ThrowIfNull(data);
|
||||||
|
|
||||||
|
if ((steamID == 0) || !new SteamID(steamID).IsIndividualAccount) {
|
||||||
|
throw new ArgumentOutOfRangeException(nameof(steamID));
|
||||||
|
}
|
||||||
|
|
||||||
ArgumentException.ThrowIfNullOrEmpty(deviceID);
|
ArgumentException.ThrowIfNullOrEmpty(deviceID);
|
||||||
|
|
||||||
AccountName = data.account_name;
|
AccountName = data.account_name;
|
||||||
@@ -70,6 +79,7 @@ internal sealed class MaFileData {
|
|||||||
Secret1 = Convert.ToBase64String(data.secret_1);
|
Secret1 = Convert.ToBase64String(data.secret_1);
|
||||||
SerialNumber = data.serial_number;
|
SerialNumber = data.serial_number;
|
||||||
ServerTime = data.server_time;
|
ServerTime = data.server_time;
|
||||||
|
Session = new MaFileSessionData(steamID);
|
||||||
SharedSecret = Convert.ToBase64String(data.shared_secret);
|
SharedSecret = Convert.ToBase64String(data.shared_secret);
|
||||||
Status = data.status;
|
Status = data.status;
|
||||||
TokenGid = data.token_gid;
|
TokenGid = data.token_gid;
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
// _ _ _ ____ _ _____
|
||||||
|
// / \ _ __ ___ | |__ (_)/ ___| | |_ ___ __ _ _ __ ___ | ___|__ _ _ __ _ __ ___
|
||||||
|
// / _ \ | '__|/ __|| '_ \ | |\___ \ | __|/ _ \ / _` || '_ ` _ \ | |_ / _` || '__|| '_ ` _ \
|
||||||
|
// / ___ \ | | | (__ | | | || | ___) || |_| __/| (_| || | | | | || _|| (_| || | | | | | | |
|
||||||
|
// /_/ \_\|_| \___||_| |_||_||____/ \__|\___| \__,_||_| |_| |_||_| \__,_||_| |_| |_| |_|
|
||||||
|
// |
|
||||||
|
// Copyright 2015-2023 Łukasz "JustArchi" Domeradzki
|
||||||
|
// Contact: JustArchi@JustArchi.net
|
||||||
|
// |
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
// |
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
// |
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using SteamKit2;
|
||||||
|
|
||||||
|
namespace ArchiSteamFarm.OfficialPlugins.MobileAuthenticator;
|
||||||
|
|
||||||
|
internal sealed class MaFileSessionData {
|
||||||
|
[JsonProperty(Required = Required.Always)]
|
||||||
|
internal readonly ulong SteamID;
|
||||||
|
|
||||||
|
internal MaFileSessionData(ulong steamID) {
|
||||||
|
if ((steamID == 0) || !new SteamID(steamID).IsIndividualAccount) {
|
||||||
|
throw new ArgumentOutOfRangeException(nameof(steamID));
|
||||||
|
}
|
||||||
|
|
||||||
|
SteamID = steamID;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user