recaptchaenterprise.proto 15 KB

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