Skip to content

Commit 5d78d5d

Browse files
authored
feat(phone): manually add IPhoneService/AccountPhoneStatus (#449)
related: #392
1 parent c0e15b7 commit 5d78d5d

3 files changed

Lines changed: 33 additions & 0 deletions

File tree

steamguard/protobufs/service_phone.proto

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,21 @@ message CPhone_VerifyAccountPhoneWithCode_Request {
4141
message CPhone_VerifyAccountPhoneWithCode_Response {
4242
}
4343

44+
// Completely undocumented
45+
message CPhone_AccountPhoneStatus_Request {
46+
}
47+
48+
// Completely undocumented, my best guess
49+
message CPhone_AccountPhoneStatus_Response {
50+
optional bool has_phone = 1;
51+
// has another field, but I don't know what it is
52+
}
53+
4454
service Phone {
4555
rpc ConfirmAddPhoneToAccount (.CPhone_ConfirmAddPhoneToAccount_Request) returns (.CPhone_AddPhoneToAccount_Response);
4656
rpc IsAccountWaitingForEmailConfirmation (.CPhone_IsAccountWaitingForEmailConfirmation_Request) returns (.CPhone_IsAccountWaitingForEmailConfirmation_Response);
4757
rpc SendPhoneVerificationCode (.CPhone_SendPhoneVerificationCode_Request) returns (.CPhone_SendPhoneVerificationCode_Response);
4858
rpc SetAccountPhoneNumber (.CPhone_SetAccountPhoneNumber_Request) returns (.CPhone_SetAccountPhoneNumber_Response);
4959
rpc VerifyAccountPhoneWithCode (.CPhone_VerifyAccountPhoneWithCode_Request) returns (.CPhone_VerifyAccountPhoneWithCode_Response);
60+
rpc AccountPhoneStatus (.CPhone_AccountPhoneStatus_Request) returns (.CPhone_AccountPhoneStatus_Response);
5061
}

steamguard/src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ impl SteamGuardAccount {
8181
Ok(serde_json::from_reader(r)?)
8282
}
8383

84+
pub fn from_file(path: &str) -> anyhow::Result<Self> {
85+
let file = std::fs::File::open(path)?;
86+
Self::from_reader(file)
87+
}
88+
8489
pub fn set_tokens(&mut self, tokens: Tokens) {
8590
self.tokens = Some(tokens);
8691
}

steamguard/src/steamapi/phone.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,22 @@ where
106106
)?;
107107
Ok(resp)
108108
}
109+
110+
/// Reverse engineered from steam mobile app.
111+
pub fn account_phone_status(
112+
&self,
113+
req: CPhone_AccountPhoneStatus_Request,
114+
access_token: &Jwt,
115+
) -> Result<ApiResponse<CPhone_AccountPhoneStatus_Response>, TransportError> {
116+
let req = ApiRequest::new(SERVICE_NAME, "AccountPhoneStatus", 1u32, req)
117+
.with_access_token(access_token);
118+
let resp = self
119+
.transport
120+
.send_request::<CPhone_AccountPhoneStatus_Request, CPhone_AccountPhoneStatus_Response>(
121+
req,
122+
)?;
123+
Ok(resp)
124+
}
109125
}
110126

111127
macro_rules! impl_buildable_req {
@@ -127,3 +143,4 @@ impl_buildable_req!(CPhone_SendPhoneVerificationCode_Request, true);
127143
impl_buildable_req!(CPhone_IsAccountWaitingForEmailConfirmation_Request, true);
128144
impl_buildable_req!(CPhone_ConfirmAddPhoneToAccount_Request, true);
129145
impl_buildable_req!(CPhone_VerifyAccountPhoneWithCode_Request, true);
146+
impl_buildable_req!(CPhone_AccountPhoneStatus_Request, true);

0 commit comments

Comments
 (0)