recaptchaenterprise.proto 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460
  1. // Copyright 2020 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. syntax = "proto3";
  15. package google.cloud.recaptchaenterprise.v1;
  16. import "google/api/annotations.proto";
  17. import "google/api/client.proto";
  18. import "google/api/field_behavior.proto";
  19. import "google/api/resource.proto";
  20. import "google/protobuf/empty.proto";
  21. import "google/protobuf/field_mask.proto";
  22. import "google/protobuf/timestamp.proto";
  23. option csharp_namespace = "Google.Cloud.RecaptchaEnterprise.V1";
  24. option go_package = "google.golang.org/genproto/googleapis/cloud/recaptchaenterprise/v1;recaptchaenterprise";
  25. option java_multiple_files = true;
  26. option java_outer_classname = "RecaptchaEnterpriseProto";
  27. option java_package = "com.google.recaptchaenterprise.v1";
  28. option objc_class_prefix = "GCRE";
  29. option php_namespace = "Google\\Cloud\\RecaptchaEnterprise\\V1";
  30. option ruby_package = "Google::Cloud::RecaptchaEnterprise::V1";
  31. // Service to determine the likelihood an event is legitimate.
  32. service RecaptchaEnterpriseService {
  33. option (google.api.default_host) = "recaptchaenterprise.googleapis.com";
  34. option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform";
  35. // Creates an Assessment of the likelihood an event is legitimate.
  36. rpc CreateAssessment(CreateAssessmentRequest) returns (Assessment) {
  37. option (google.api.http) = {
  38. post: "/v1/{parent=projects/*}/assessments"
  39. body: "assessment"
  40. };
  41. option (google.api.method_signature) = "parent,assessment";
  42. }
  43. // Annotates a previously created Assessment to provide additional information
  44. // on whether the event turned out to be authentic or fradulent.
  45. rpc AnnotateAssessment(AnnotateAssessmentRequest) returns (AnnotateAssessmentResponse) {
  46. option (google.api.http) = {
  47. post: "/v1/{name=projects/*/assessments/*}:annotate"
  48. body: "*"
  49. };
  50. option (google.api.method_signature) = "name,annotation";
  51. }
  52. // Creates a new reCAPTCHA Enterprise key.
  53. rpc CreateKey(CreateKeyRequest) returns (Key) {
  54. option (google.api.http) = {
  55. post: "/v1/{parent=projects/*}/keys"
  56. body: "key"
  57. };
  58. }
  59. // Returns the list of all keys that belong to a project.
  60. rpc ListKeys(ListKeysRequest) returns (ListKeysResponse) {
  61. option (google.api.http) = {
  62. get: "/v1/{parent=projects/*}/keys"
  63. };
  64. }
  65. // Returns the specified key.
  66. rpc GetKey(GetKeyRequest) returns (Key) {
  67. option (google.api.http) = {
  68. get: "/v1/{name=projects/*/keys/*}"
  69. };
  70. }
  71. // Updates the specified key.
  72. rpc UpdateKey(UpdateKeyRequest) returns (Key) {
  73. option (google.api.http) = {
  74. patch: "/v1/{key.name=projects/*/keys/*}"
  75. body: "key"
  76. };
  77. }
  78. // Deletes the specified key.
  79. rpc DeleteKey(DeleteKeyRequest) returns (google.protobuf.Empty) {
  80. option (google.api.http) = {
  81. delete: "/v1/{name=projects/*/keys/*}"
  82. };
  83. }
  84. }
  85. // The create assessment request message.
  86. message CreateAssessmentRequest {
  87. // Required. The name of the project in which the assessment will be created,
  88. // in the format "projects/{project}".
  89. string parent = 1 [
  90. (google.api.field_behavior) = REQUIRED,
  91. (google.api.resource_reference) = {
  92. type: "cloudresourcemanager.googleapis.com/Project"
  93. }
  94. ];
  95. // Required. The assessment details.
  96. Assessment assessment = 2 [(google.api.field_behavior) = REQUIRED];
  97. }
  98. // The request message to annotate an Assessment.
  99. message AnnotateAssessmentRequest {
  100. // Enum that reprensents the types of annotations.
  101. enum Annotation {
  102. // Default unspecified type.
  103. ANNOTATION_UNSPECIFIED = 0;
  104. // Provides information that the event turned out to be legitimate.
  105. LEGITIMATE = 1;
  106. // Provides information that the event turned out to be fraudulent.
  107. FRAUDULENT = 2;
  108. // Provides information that the event was related to a login event in which
  109. // the user typed the correct password.
  110. PASSWORD_CORRECT = 3;
  111. // Provides information that the event was related to a login event in which
  112. // the user typed the incorrect password.
  113. PASSWORD_INCORRECT = 4;
  114. }
  115. // Required. The resource name of the Assessment, in the format
  116. // "projects/{project}/assessments/{assessment}".
  117. string name = 1 [
  118. (google.api.field_behavior) = REQUIRED,
  119. (google.api.resource_reference) = {
  120. type: "recaptchaenterprise.googleapis.com/Assessment"
  121. }
  122. ];
  123. // Required. The annotation that will be assigned to the Event.
  124. Annotation annotation = 2 [(google.api.field_behavior) = REQUIRED];
  125. }
  126. // Empty response for AnnotateAssessment.
  127. message AnnotateAssessmentResponse {
  128. }
  129. // A recaptcha assessment resource.
  130. message Assessment {
  131. option (google.api.resource) = {
  132. type: "recaptchaenterprise.googleapis.com/Assessment"
  133. pattern: "projects/{project}/assessments/{assessment}"
  134. };
  135. // Output only. The resource name for the Assessment in the format
  136. // "projects/{project}/assessments/{assessment}".
  137. string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
  138. // The event being assessed.
  139. Event event = 2;
  140. // Output only. The risk analysis result for the event being assessed.
  141. RiskAnalysis risk_analysis = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
  142. // Output only. Properties of the provided event token.
  143. TokenProperties token_properties = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
  144. }
  145. message Event {
  146. // Optional. The user response token provided by the reCAPTCHA client-side integration
  147. // on your site.
  148. string token = 1 [(google.api.field_behavior) = OPTIONAL];
  149. // Optional. The site key that was used to invoke reCAPTCHA on your site and generate
  150. // the token.
  151. string site_key = 2 [(google.api.field_behavior) = OPTIONAL];
  152. // Optional. The user agent present in the request from the user's device related to
  153. // this event.
  154. string user_agent = 3 [(google.api.field_behavior) = OPTIONAL];
  155. // Optional. The IP address in the request from the user's device related to this event.
  156. string user_ip_address = 4 [(google.api.field_behavior) = OPTIONAL];
  157. // Optional. The expected action for this type of event. This should be the same action
  158. // provided at token generation time on client-side platforms already
  159. // integrated with recaptcha enterprise.
  160. string expected_action = 5 [(google.api.field_behavior) = OPTIONAL];
  161. }
  162. // Risk analysis result for an event.
  163. message RiskAnalysis {
  164. // LINT.IfChange(classification_reason)
  165. // Reasons contributing to the risk analysis verdict.
  166. enum ClassificationReason {
  167. // Default unspecified type.
  168. CLASSIFICATION_REASON_UNSPECIFIED = 0;
  169. // Interactions matched the behavior of an automated agent.
  170. AUTOMATION = 1;
  171. // The event originated from an illegitimate environment.
  172. UNEXPECTED_ENVIRONMENT = 2;
  173. // Traffic volume from the event source is higher than normal.
  174. TOO_MUCH_TRAFFIC = 3;
  175. // Interactions with the site were significantly different than expected
  176. // patterns.
  177. UNEXPECTED_USAGE_PATTERNS = 4;
  178. // Too little traffic has been received from this site thus far to generate
  179. // quality risk analysis.
  180. LOW_CONFIDENCE_SCORE = 5;
  181. }
  182. // Legitimate event score from 0.0 to 1.0.
  183. // (1.0 means very likely legitimate traffic while 0.0 means very likely
  184. // non-legitimate traffic).
  185. float score = 1;
  186. // Reasons contributing to the risk analysis verdict.
  187. repeated ClassificationReason reasons = 2;
  188. }
  189. message TokenProperties {
  190. // LINT.IfChange
  191. // Enum that represents the types of invalid token reasons.
  192. enum InvalidReason {
  193. // Default unspecified type.
  194. INVALID_REASON_UNSPECIFIED = 0;
  195. // If the failure reason was not accounted for.
  196. UNKNOWN_INVALID_REASON = 1;
  197. // The provided user verification token was malformed.
  198. MALFORMED = 2;
  199. // The user verification token had expired.
  200. EXPIRED = 3;
  201. // The user verification had already been seen.
  202. DUPE = 4;
  203. // The user verification token was not present.
  204. MISSING = 5;
  205. }
  206. // Whether the provided user response token is valid. When valid = false, the
  207. // reason could be specified in invalid_reason or it could also be due to
  208. // a user failing to solve a challenge or a sitekey mismatch (i.e the sitekey
  209. // used to generate the token was different than the one specified in the
  210. // assessment).
  211. bool valid = 1;
  212. // Reason associated with the response when valid = false.
  213. InvalidReason invalid_reason = 2;
  214. // The timestamp corresponding to the generation of the token.
  215. google.protobuf.Timestamp create_time = 3;
  216. // The hostname of the page on which the token was generated.
  217. string hostname = 4;
  218. // Action name provided at token generation.
  219. string action = 5;
  220. }
  221. // The create key request message.
  222. message CreateKeyRequest {
  223. // Required. The name of the project in which the key will be created, in the
  224. // format "projects/{project}".
  225. string parent = 1 [
  226. (google.api.field_behavior) = REQUIRED,
  227. (google.api.resource_reference) = {
  228. type: "cloudresourcemanager.googleapis.com/Project"
  229. }
  230. ];
  231. // Required. Information to create a reCAPTCHA Enterprise key.
  232. Key key = 2 [(google.api.field_behavior) = REQUIRED];
  233. }
  234. // The list keys request message.
  235. message ListKeysRequest {
  236. // Required. The name of the project that contains the keys that will be
  237. // listed, in the format "projects/{project}".
  238. string parent = 1 [
  239. (google.api.field_behavior) = REQUIRED,
  240. (google.api.resource_reference) = {
  241. type: "cloudresourcemanager.googleapis.com/Project"
  242. }
  243. ];
  244. // Optional. The maximum number of keys to return. Default is 10. Max limit is
  245. // 1000.
  246. int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];
  247. // Optional. The next_page_token value returned from a previous.
  248. // ListKeysRequest, if any.
  249. string page_token = 3 [(google.api.field_behavior) = OPTIONAL];
  250. }
  251. // Response to request to list keys in a project.
  252. message ListKeysResponse {
  253. // Key details.
  254. repeated Key keys = 1;
  255. // Token to retrieve the next page of results. It is set to empty if no keys
  256. // remain in results.
  257. string next_page_token = 2;
  258. }
  259. // The get key request message.
  260. message GetKeyRequest {
  261. // Required. The name of the requested key, in the format
  262. // "projects/{project}/keys/{key}".
  263. string name = 1 [
  264. (google.api.field_behavior) = REQUIRED,
  265. (google.api.resource_reference) = {
  266. type: "recaptchaenterprise.googleapis.com/Key"
  267. }
  268. ];
  269. }
  270. // The update key request message.
  271. message UpdateKeyRequest {
  272. // Required. The key to update.
  273. Key key = 1 [(google.api.field_behavior) = REQUIRED];
  274. // Optional. The mask to control which field of the key get updated. If the mask is not
  275. // present, all fields will be updated.
  276. google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = OPTIONAL];
  277. }
  278. // The delete key request message.
  279. message DeleteKeyRequest {
  280. // Required. The name of the key to be deleted, in the format
  281. // "projects/{project}/keys/{key}".
  282. string name = 1 [
  283. (google.api.field_behavior) = REQUIRED,
  284. (google.api.resource_reference) = {
  285. type: "recaptchaenterprise.googleapis.com/Key"
  286. }
  287. ];
  288. }
  289. // A key used to identify and configure applications (web and/or mobile) that
  290. // use reCAPTCHA Enterprise.
  291. message Key {
  292. option (google.api.resource) = {
  293. type: "recaptchaenterprise.googleapis.com/Key"
  294. pattern: "projects/{project}/keys/{key}"
  295. };
  296. // The resource name for the Key in the format
  297. // "projects/{project}/keys/{key}".
  298. string name = 1;
  299. // Human-readable display name of this key. Modifiable by user.
  300. string display_name = 2;
  301. // Platform specific settings for this key. The key can only be used on one
  302. // platform, the one it has settings for.
  303. oneof platform_settings {
  304. // Settings for keys that can be used by websites.
  305. WebKeySettings web_settings = 3;
  306. // Settings for keys that can be used by Android apps.
  307. AndroidKeySettings android_settings = 4;
  308. // Settings for keys that can be used by iOS apps.
  309. IOSKeySettings ios_settings = 5;
  310. }
  311. // Optional. See <a href="https://cloud.google.com/recaptcha-enterprise/docs/labels">
  312. // Creating and managing labels</a>.
  313. map<string, string> labels = 6 [(google.api.field_behavior) = OPTIONAL];
  314. // The timestamp corresponding to the creation of this Key.
  315. google.protobuf.Timestamp create_time = 7;
  316. }
  317. // Settings specific to keys that can be used by websites.
  318. message WebKeySettings {
  319. // Enum that represents the integration types for web keys.
  320. enum IntegrationType {
  321. // Default type that indicates this enum hasn't been specified. This is not
  322. // a valid IntegrationType, one of the other types must be specified
  323. // instead.
  324. INTEGRATION_TYPE_UNSPECIFIED = 0;
  325. // Only used to produce scores. It doesn't display the "I'm not a robot"
  326. // checkbox and never shows captcha challenges.
  327. SCORE = 1;
  328. // Displays the "I'm not a robot" checkbox and may show captcha challenges
  329. // after it is checked.
  330. CHECKBOX = 2;
  331. // Doesn't display the "I'm not a robot" checkbox, but may show captcha
  332. // challenges after risk analysis.
  333. INVISIBLE = 3;
  334. }
  335. // Enum that represents the possible challenge frequency and difficulty
  336. // configurations for a web key.
  337. enum ChallengeSecurityPreference {
  338. // Default type that indicates this enum hasn't been specified.
  339. CHALLENGE_SECURITY_PREFERENCE_UNSPECIFIED = 0;
  340. // Key tends to show fewer and easier challenges.
  341. USABILITY = 1;
  342. // Key tends to show balanced (in amount and difficulty) challenges.
  343. BALANCE = 2;
  344. // Key tends to show more and harder challenges.
  345. SECURITY = 3;
  346. }
  347. // If set to true, it means allowed_domains will not be enforced.
  348. bool allow_all_domains = 3;
  349. // Domains or subdomains of websites allowed to use the key. All subdomains
  350. // of an allowed domain are automatically allowed. A valid domain requires a
  351. // host and must not include any path, port, query or fragment.
  352. // Examples: 'example.com' or 'subdomain.example.com'
  353. repeated string allowed_domains = 1;
  354. // Required. Whether this key can be used on AMP (Accelerated Mobile Pages) websites.
  355. bool allow_amp_traffic = 2 [(google.api.field_behavior) = REQUIRED];
  356. // Required. Describes how this key is integrated with the website.
  357. IntegrationType integration_type = 4 [(google.api.field_behavior) = REQUIRED];
  358. // Settings for the frequency and difficulty at which this key triggers
  359. // captcha challenges. This should only be specified for IntegrationTypes
  360. // CHECKBOX and INVISIBLE.
  361. ChallengeSecurityPreference challenge_security_preference = 5;
  362. }
  363. // Settings specific to keys that can be used by Android apps.
  364. message AndroidKeySettings {
  365. // Android package names of apps allowed to use the key.
  366. // Example: 'com.companyname.appname'
  367. repeated string allowed_package_names = 1;
  368. }
  369. // Settings specific to keys that can be used by iOS apps.
  370. message IOSKeySettings {
  371. // iOS bundle ids of apps allowed to use the key.
  372. // Example: 'com.companyname.productname.appname'
  373. repeated string allowed_bundle_ids = 1;
  374. }