import "steammessages_base.proto";
import "steammessages_unified_base.steamclient.proto";

option cc_generic_services = true;

enum ETwoFactorStatusFieldFlag {
	k_ETwoFactorStatusFieldFlag_None = 0;
	k_ETwoFactorStatusFieldFlag_LastUsage = 1;
}

enum ETwoFactorUsageType {
	k_ETwoFactorUsageType_Unknown = 0;
	k_ETwoFactorUsageType_None = 1;
	k_ETwoFactorUsageType_MobileConfirmation = 2;
	k_ETwoFactorUsageType_Login = 3;
}

message CTwoFactor_Time_Request {
	optional uint64 sender_time = 1;
}

message CTwoFactor_Time_Response {
	optional uint64 server_time = 1;
	optional uint64 skew_tolerance_seconds = 2;
	optional uint64 large_time_jink = 3;
	optional uint32 probe_frequency_seconds = 4;
	optional uint32 adjusted_time_probe_frequency_seconds = 5;
	optional uint32 hint_probe_frequency_seconds = 6;
	optional uint32 sync_timeout = 7;
	optional uint32 try_again_seconds = 8;
	optional uint32 max_attempts = 9;
}

message CTwoFactor_Status_Request {
	optional fixed64 steamid = 1;
	optional .ETwoFactorStatusFieldFlag include = 2 [default = k_ETwoFactorStatusFieldFlag_None];
}

message CTwoFactor_UsageEvent {
	optional uint32 time = 1;
	optional .ETwoFactorUsageType usage_type = 2 [default = k_ETwoFactorUsageType_Unknown];
	optional int32 confirmation_type = 3;
	optional int32 confirmation_action = 4;
}

message CTwoFactor_Status_Response {
	optional uint32 state = 1;
	optional uint32 inactivation_reason = 2;
	optional uint32 authenticator_type = 3;
	optional bool authenticator_allowed = 4;
	optional uint32 steamguard_scheme = 5;
	optional string token_gid = 6;
	optional bool email_validated = 7;
	optional string device_identifier = 8;
	optional uint32 time_created = 9;
	optional uint32 revocation_attempts_remaining = 10;
	optional string classified_agent = 11;
	optional bool allow_external_authenticator = 12;
	optional uint32 time_transferred = 13;
	optional uint32 version = 14;
	optional fixed64 last_seen_auth_token_id = 15;
	repeated .CTwoFactor_UsageEvent usages = 16;
}

message CTwoFactor_AddAuthenticator_Request {
	optional fixed64 steamid = 1;
	optional uint64 authenticator_time = 2;
	optional fixed64 serial_number = 3;
	optional uint32 authenticator_type = 4;
	optional string device_identifier = 5;
	repeated string http_headers = 7;
	optional uint32 version = 8 [default = 1];
}

message CTwoFactor_AddAuthenticator_Response {
	optional bytes shared_secret = 1;
	optional fixed64 serial_number = 2;
	optional string revocation_code = 3;
	optional string uri = 4;
	optional uint64 server_time = 5;
	optional string account_name = 6;
	optional string token_gid = 7;
	optional bytes identity_secret = 8;
	optional bytes secret_1 = 9;
	optional int32 status = 10;
	optional string phone_number_hint = 11;
	optional int32 confirm_type = 12;
}

message CTwoFactor_FinalizeAddAuthenticator_Request {
	optional fixed64 steamid = 1;
	optional string authenticator_code = 2;
	optional uint64 authenticator_time = 3;
	optional string activation_code = 4;
	repeated string http_headers = 5;
	optional bool validate_sms_code = 6;
}

message CTwoFactor_FinalizeAddAuthenticator_Response {
	optional bool success = 1;
	optional uint64 server_time = 3;
	optional int32 status = 4;
}

message CTwoFactor_UpdateTokenVersion_Request {
	optional fixed64 steamid = 1;
	optional uint32 version = 2;
	optional bytes signature = 3;
}

message CTwoFactor_UpdateTokenVersion_Response {
}

message CTwoFactor_RemoveAuthenticator_Request {
	optional string revocation_code = 2;
	optional uint32 revocation_reason = 5;
	optional uint32 steamguard_scheme = 6;
	optional bool remove_all_steamguard_cookies = 7;
}

message CTwoFactor_RemoveAuthenticator_Response {
	optional bool success = 1;
	optional uint64 server_time = 3;
	optional uint32 revocation_attempts_remaining = 5;
}

message CTwoFactor_RemoveAuthenticatorViaChallengeStart_Request {
}

message CTwoFactor_RemoveAuthenticatorViaChallengeStart_Response {
	optional bool success = 1;
}

message CTwoFactor_RemoveAuthenticatorViaChallengeContinue_Request {
	optional string sms_code = 1;
	optional bool generate_new_token = 2;
	optional uint32 version = 3 [default = 1];
}

message CRemoveAuthenticatorViaChallengeContinue_Replacement_Token {
	optional bytes shared_secret = 1;
	optional fixed64 serial_number = 2;
	optional string revocation_code = 3;
	optional string uri = 4;
	optional uint64 server_time = 5;
	optional string account_name = 6;
	optional string token_gid = 7;
	optional bytes identity_secret = 8;
	optional bytes secret_1 = 9;
	optional int32 status = 10;
	optional uint32 steamguard_scheme = 11;
	optional fixed64 steamid = 12;
}

message CTwoFactor_RemoveAuthenticatorViaChallengeContinue_Response {
	optional bool success = 1;
	optional .CRemoveAuthenticatorViaChallengeContinue_Replacement_Token replacement_token = 2;
}

service TwoFactor {
	rpc QueryTime (.CTwoFactor_Time_Request) returns (.CTwoFactor_Time_Response);
	rpc QueryStatus (.CTwoFactor_Status_Request) returns (.CTwoFactor_Status_Response);
	rpc AddAuthenticator (.CTwoFactor_AddAuthenticator_Request) returns (.CTwoFactor_AddAuthenticator_Response);
	rpc FinalizeAddAuthenticator (.CTwoFactor_FinalizeAddAuthenticator_Request) returns (.CTwoFactor_FinalizeAddAuthenticator_Response);
	rpc UpdateTokenVersion (.CTwoFactor_UpdateTokenVersion_Request) returns (.CTwoFactor_UpdateTokenVersion_Response);
	rpc RemoveAuthenticator (.CTwoFactor_RemoveAuthenticator_Request) returns (.CTwoFactor_RemoveAuthenticator_Response);
	rpc RemoveAuthenticatorViaChallengeStart (.CTwoFactor_RemoveAuthenticatorViaChallengeStart_Request) returns (.CTwoFactor_RemoveAuthenticatorViaChallengeStart_Response);
	rpc RemoveAuthenticatorViaChallengeContinue (.CTwoFactor_RemoveAuthenticatorViaChallengeContinue_Request) returns (.CTwoFactor_RemoveAuthenticatorViaChallengeContinue_Response);
}
