import "common_base.proto";
import "common.proto";

message CAuthentication_AccessToken_GenerateForApp_Request {
	optional string refresh_token = 1;
	optional fixed64 steamid = 2;
	optional int32 renewal_type = 3 [(.description) = "enum"];
}

message CAuthentication_AccessToken_GenerateForApp_Response {
	optional string access_token = 1;
	optional string refresh_token = 2;
}

message CAuthentication_AllowedConfirmation {
	optional int32 confirmation_type = 1 [(.description) = "enum"];
	optional string associated_message = 2;
}

message CAuthentication_BeginAuthSessionViaCredentials_Request {
	optional string device_friendly_name = 1;
	optional string account_name = 2;
	optional string encrypted_password = 3;
	optional uint64 encryption_timestamp = 4;
	optional bool remember_login = 5;
	optional int32 platform_type = 6 [(.description) = "enum"];
	optional int32 persistence = 7 [default = 1, (.description) = "enum"];
	optional string website_id = 8 [default = "Unknown"];
	optional .CAuthentication_DeviceDetails device_details = 9;
	optional string guard_data = 10;
	optional uint32 language = 11;
	optional int32 qos_level = 12 [default = 2];
}

message CAuthentication_BeginAuthSessionViaCredentials_Response {
	optional uint64 client_id = 1;
	optional bytes request_id = 2;
	optional float interval = 3;
	repeated .CAuthentication_AllowedConfirmation allowed_confirmations = 4;
	optional uint64 steamid = 5;
	optional string weak_token = 6;
	optional string agreement_session_url = 7;
	optional string extended_error_message = 8;
}

message CAuthentication_BeginAuthSessionViaQR_Request {
	optional string device_friendly_name = 1;
	optional int32 platform_type = 2 [(.description) = "enum"];
	optional .CAuthentication_DeviceDetails device_details = 3;
	optional string website_id = 4 [default = "Unknown"];
}

message CAuthentication_BeginAuthSessionViaQR_Response {
	optional uint64 client_id = 1;
	optional string challenge_url = 2;
	optional bytes request_id = 3;
	optional float interval = 4;
	repeated .CAuthentication_AllowedConfirmation allowed_confirmations = 5;
	optional int32 version = 6;
}

message CAuthentication_DeviceDetails {
	optional string device_friendly_name = 1;
	optional int32 platform_type = 2 [(.description) = "enum"];
	optional int32 os_type = 3;
	optional uint32 gaming_device_type = 4;
	optional uint32 client_count = 5;
	optional bytes machine_id = 6;
	optional int32 app_type = 7 [(.description) = "enum"];
}

message CAuthentication_GetAuthSessionInfo_Request {
	optional uint64 client_id = 1;
}

message CAuthentication_GetAuthSessionInfo_Response {
	optional string ip = 1;
	optional string geoloc = 2;
	optional string city = 3;
	optional string state = 4;
	optional string country = 5;
	optional int32 platform_type = 6 [(.description) = "enum"];
	optional string device_friendly_name = 7;
	optional int32 version = 8;
	optional int32 login_history = 9 [(.description) = "enum"];
	optional bool requestor_location_mismatch = 10;
	optional bool high_usage_login = 11;
	optional int32 requested_persistence = 12 [(.description) = "enum"];
	optional int32 device_trust = 13;
	optional int32 app_type = 14 [(.description) = "enum"];
}

message CAuthentication_GetAuthSessionRiskInfo_Request {
	optional uint64 client_id = 1;
	optional uint32 language = 2;
}

message CAuthentication_GetAuthSessionRiskInfo_Response {
	optional string location_confirmer = 1;
	optional string location_requestor = 2;
	optional string location_other = 3;
	optional int32 platform_type = 4 [(.description) = "enum"];
}

message CAuthentication_GetAuthSessionsForAccount_Request {
}

message CAuthentication_GetAuthSessionsForAccount_Response {
	repeated uint64 client_ids = 1;
}

message CAuthentication_GetPasswordRSAPublicKey_Request {
	optional string account_name = 1;
}

message CAuthentication_GetPasswordRSAPublicKey_Response {
	optional string publickey_mod = 1;
	optional string publickey_exp = 2;
	optional uint64 timestamp = 3;
}

message CAuthentication_MigrateMobileSession_Request {
	optional fixed64 steamid = 1;
	optional string token = 2;
	optional string signature = 3;
}

message CAuthentication_MigrateMobileSession_Response {
	optional string refresh_token = 1;
	optional string access_token = 2;
}

message CAuthentication_NotifyRiskQuizResults_Notification {
	optional uint64 client_id = 1;
	optional .CAuthentication_NotifyRiskQuizResults_Notification_RiskQuizResults results = 2;
	optional string selected_action = 3;
	optional bool did_confirm_login = 4;
}

message CAuthentication_NotifyRiskQuizResults_Notification_RiskQuizResults {
	optional bool platform = 1;
	optional bool location = 2;
	optional bool action = 3;
}

message CAuthentication_PollAuthSessionStatus_Request {
	optional uint64 client_id = 1;
	optional bytes request_id = 2;
	optional fixed64 token_to_revoke = 3;
}

message CAuthentication_PollAuthSessionStatus_Response {
	optional uint64 new_client_id = 1;
	optional string new_challenge_url = 2;
	optional string refresh_token = 3;
	optional string access_token = 4;
	optional bool had_remote_interaction = 5;
	optional string account_name = 6;
	optional string new_guard_data = 7;
	optional string agreement_session_url = 8;
}

message CAuthentication_RefreshToken_Enumerate_Request {
	optional bool include_revoked = 1 [default = false];
}

message CAuthentication_RefreshToken_Enumerate_Response {
	repeated .CAuthentication_RefreshToken_Enumerate_Response_RefreshTokenDescription refresh_tokens = 1;
	optional fixed64 requesting_token = 2;
}

message CAuthentication_RefreshToken_Enumerate_Response_RefreshTokenDescription {
	optional fixed64 token_id = 1;
	optional string token_description = 2;
	optional uint32 time_updated = 3;
	optional int32 platform_type = 4 [(.description) = "enum"];
	optional bool logged_in = 5;
	optional uint32 os_platform = 6;
	optional uint32 auth_type = 7;
	optional uint32 gaming_device_type = 8;
	optional .CAuthentication_RefreshToken_Enumerate_Response_TokenUsageEvent first_seen = 9;
	optional .CAuthentication_RefreshToken_Enumerate_Response_TokenUsageEvent last_seen = 10;
	optional int32 os_type = 11;
	optional int32 authentication_type = 12 [(.description) = "enum"];
	optional int32 effective_token_state = 13 [(.description) = "enum"];
}

message CAuthentication_RefreshToken_Enumerate_Response_TokenUsageEvent {
	optional uint32 time = 1;
	optional .CMsgIPAddress ip = 2;
	optional string locale = 3;
	optional string country = 4;
	optional string state = 5;
	optional string city = 6;
}

message CAuthentication_RefreshToken_Revoke_Request {
	optional fixed64 token_id = 1;
	optional fixed64 steamid = 2;
	optional int32 revoke_action = 3 [default = 1, (.description) = "enum"];
	optional bytes signature = 4;
}

message CAuthentication_RefreshToken_Revoke_Response {
}

message CAuthentication_Token_Revoke_Request {
	optional string token = 1;
	optional int32 revoke_action = 2 [default = 1, (.description) = "enum"];
}

message CAuthentication_Token_Revoke_Response {
}

message CAuthentication_UpdateAuthSessionWithMobileConfirmation_Request {
	optional int32 version = 1;
	optional uint64 client_id = 2;
	optional fixed64 steamid = 3;
	optional bytes signature = 4;
	optional bool confirm = 5 [default = false];
	optional int32 persistence = 6 [default = 1, (.description) = "enum"];
}

message CAuthentication_UpdateAuthSessionWithMobileConfirmation_Response {
}

message CAuthentication_UpdateAuthSessionWithSteamGuardCode_Request {
	optional uint64 client_id = 1;
	optional fixed64 steamid = 2;
	optional string code = 3;
	optional int32 code_type = 4 [(.description) = "enum"];
}

message CAuthentication_UpdateAuthSessionWithSteamGuardCode_Response {
	optional string agreement_session_url = 7;
}

service Authentication {
	// ePrivilege=0, eWebAPIKeyRequirement=1
	rpc BeginAuthSessionViaCredentials (.CAuthentication_BeginAuthSessionViaCredentials_Request) returns (.CAuthentication_BeginAuthSessionViaCredentials_Response);
	// ePrivilege=0, eWebAPIKeyRequirement=1
	rpc BeginAuthSessionViaQR (.CAuthentication_BeginAuthSessionViaQR_Request) returns (.CAuthentication_BeginAuthSessionViaQR_Response);
	// ePrivilege=1
	rpc EnumerateTokens (.CAuthentication_RefreshToken_Enumerate_Request) returns (.CAuthentication_RefreshToken_Enumerate_Response);
	// ePrivilege=1, eWebAPIKeyRequirement=1
	rpc GenerateAccessTokenForApp (.CAuthentication_AccessToken_GenerateForApp_Request) returns (.CAuthentication_AccessToken_GenerateForApp_Response);
	// ePrivilege=1
	rpc GetAuthSessionInfo (.CAuthentication_GetAuthSessionInfo_Request) returns (.CAuthentication_GetAuthSessionInfo_Response);
	// ePrivilege=1
	rpc GetAuthSessionRiskInfo (.CAuthentication_GetAuthSessionRiskInfo_Request) returns (.CAuthentication_GetAuthSessionRiskInfo_Response);
	// bConstMethod=true, ePrivilege=1
	rpc GetAuthSessionsForAccount (.CAuthentication_GetAuthSessionsForAccount_Request) returns (.CAuthentication_GetAuthSessionsForAccount_Response);
	// bConstMethod=true, ePrivilege=0, eWebAPIKeyRequirement=1
	rpc GetPasswordRSAPublicKey (.CAuthentication_GetPasswordRSAPublicKey_Request) returns (.CAuthentication_GetPasswordRSAPublicKey_Response);
	// ePrivilege=0, eWebAPIKeyRequirement=1
	rpc MigrateMobileSession (.CAuthentication_MigrateMobileSession_Request) returns (.CAuthentication_MigrateMobileSession_Response);
	// ePrivilege=1
	rpc NotifyRiskQuizResults (.CAuthentication_NotifyRiskQuizResults_Notification) returns (.NoResponse);
	// ePrivilege=0, eWebAPIKeyRequirement=1
	rpc PollAuthSessionStatus (.CAuthentication_PollAuthSessionStatus_Request) returns (.CAuthentication_PollAuthSessionStatus_Response);
	// ePrivilege=2, eWebAPIKeyRequirement=1
	rpc RevokeRefreshToken (.CAuthentication_RefreshToken_Revoke_Request) returns (.CAuthentication_RefreshToken_Revoke_Response);
	// ePrivilege=0, eWebAPIKeyRequirement=1
	rpc RevokeToken (.CAuthentication_Token_Revoke_Request) returns (.CAuthentication_Token_Revoke_Response);
	// ePrivilege=1
	rpc UpdateAuthSessionWithMobileConfirmation (.CAuthentication_UpdateAuthSessionWithMobileConfirmation_Request) returns (.CAuthentication_UpdateAuthSessionWithMobileConfirmation_Response);
	// ePrivilege=0, eWebAPIKeyRequirement=1
	rpc UpdateAuthSessionWithSteamGuardCode (.CAuthentication_UpdateAuthSessionWithSteamGuardCode_Request) returns (.CAuthentication_UpdateAuthSessionWithSteamGuardCode_Response);
}

