From 0df934ca6980faa0ea57139ebf462b40c96d9e02 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 12 Oct 2022 17:03:33 -0700 Subject: [PATCH] feat: add RetrieveLegacySecretKey method (#411) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: add RetrieveLegacySecretKey method feat: add annotation reasons REFUND, REFUND_FRAUD, TRANSACTION_ACCEPTED, TRANSACTION_DECLINED and SOCIAL_SPAM PiperOrigin-RevId: 480357575 Source-Link: https://github.com/googleapis/googleapis/commit/cbd4501e0c0f53ef459f4c54d8cc7bbf6586be55 Source-Link: https://github.com/googleapis/googleapis-gen/commit/7155b97d98361f3fc44cc8cb53667498736a9bde Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNzE1NWI5N2Q5ODM2MWYzZmM0NGNjOGNiNTM2Njc0OTg3MzZhOWJkZSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .../v1/recaptchaenterprise.proto | 258 +- .../protos/protos.d.ts | 452 ++- .../protos/protos.js | 2798 ++++++++++------- .../protos/protos.json | 111 +- ..._enterprise_service.annotate_assessment.js | 13 +- ....list_related_account_group_memberships.js | 12 +- ...ise_service.list_related_account_groups.js | 15 +- ...rise_service.retrieve_legacy_secret_key.js | 62 + ...earch_related_account_group_memberships.js | 17 +- ...recaptcha_enterprise_service.update_key.js | 4 +- ...a.google.cloud.recaptchaenterprise.v1.json | 48 +- .../src/v1/gapic_metadata.json | 10 + .../v1/recaptcha_enterprise_service_client.ts | 256 +- ...tcha_enterprise_service_client_config.json | 4 + .../gapic_recaptcha_enterprise_service_v1.ts | 149 + 15 files changed, 2683 insertions(+), 1526 deletions(-) create mode 100644 packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.retrieve_legacy_secret_key.js diff --git a/packages/google-cloud-recaptchaenterprise/protos/google/cloud/recaptchaenterprise/v1/recaptchaenterprise.proto b/packages/google-cloud-recaptchaenterprise/protos/google/cloud/recaptchaenterprise/v1/recaptchaenterprise.proto index 7165d1bcc00..9376f342ce5 100644 --- a/packages/google-cloud-recaptchaenterprise/protos/google/cloud/recaptchaenterprise/v1/recaptchaenterprise.proto +++ b/packages/google-cloud-recaptchaenterprise/protos/google/cloud/recaptchaenterprise/v1/recaptchaenterprise.proto @@ -36,8 +36,7 @@ option ruby_package = "Google::Cloud::RecaptchaEnterprise::V1"; // Service to determine the likelihood an event is legitimate. service RecaptchaEnterpriseService { option (google.api.default_host) = "recaptchaenterprise.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; // Creates an Assessment of the likelihood an event is legitimate. rpc CreateAssessment(CreateAssessmentRequest) returns (Assessment) { @@ -50,8 +49,7 @@ service RecaptchaEnterpriseService { // Annotates a previously created Assessment to provide additional information // on whether the event turned out to be authentic or fraudulent. - rpc AnnotateAssessment(AnnotateAssessmentRequest) - returns (AnnotateAssessmentResponse) { + rpc AnnotateAssessment(AnnotateAssessmentRequest) returns (AnnotateAssessmentResponse) { option (google.api.http) = { post: "/v1/{name=projects/*/assessments/*}:annotate" body: "*" @@ -74,6 +72,16 @@ service RecaptchaEnterpriseService { }; } + // Returns the secret key related to the specified public key. + // You must use the legacy secret key only in a 3rd party integration with + // legacy reCAPTCHA. + rpc RetrieveLegacySecretKey(RetrieveLegacySecretKeyRequest) returns (RetrieveLegacySecretKeyResponse) { + option (google.api.http) = { + get: "/v1/{key=projects/*/keys/*}:retrieveLegacySecretKey" + }; + option (google.api.method_signature) = "key"; + } + // Returns the specified key. rpc GetKey(GetKeyRequest) returns (Key) { option (google.api.http) = { @@ -119,18 +127,15 @@ service RecaptchaEnterpriseService { } // List groups of related accounts. - rpc ListRelatedAccountGroups(ListRelatedAccountGroupsRequest) - returns (ListRelatedAccountGroupsResponse) { + rpc ListRelatedAccountGroups(ListRelatedAccountGroupsRequest) returns (ListRelatedAccountGroupsResponse) { option (google.api.http) = { get: "/v1/{parent=projects/*}/relatedaccountgroups" }; option (google.api.method_signature) = "parent"; } - // Get the memberships in a group of related accounts. - rpc ListRelatedAccountGroupMemberships( - ListRelatedAccountGroupMembershipsRequest) - returns (ListRelatedAccountGroupMembershipsResponse) { + // Get memberships in a group of related accounts. + rpc ListRelatedAccountGroupMemberships(ListRelatedAccountGroupMembershipsRequest) returns (ListRelatedAccountGroupMembershipsResponse) { option (google.api.http) = { get: "/v1/{parent=projects/*/relatedaccountgroups/*}/memberships" }; @@ -138,9 +143,7 @@ service RecaptchaEnterpriseService { } // Search group memberships related to a given account. - rpc SearchRelatedAccountGroupMemberships( - SearchRelatedAccountGroupMembershipsRequest) - returns (SearchRelatedAccountGroupMembershipsResponse) { + rpc SearchRelatedAccountGroupMemberships(SearchRelatedAccountGroupMembershipsRequest) returns (SearchRelatedAccountGroupMembershipsResponse) { option (google.api.http) = { post: "/v1/{project=projects/*}/relatedaccountgroupmemberships:search" body: "*" @@ -193,21 +196,38 @@ message AnnotateAssessmentRequest { // Default unspecified reason. REASON_UNSPECIFIED = 0; - // Indicates a chargeback issued for the transaction with no other details. - // When possible, specify the type by using CHARGEBACK_FRAUD or + // Indicates that the transaction had a chargeback issued with no other + // details. When possible, specify the type by using CHARGEBACK_FRAUD or // CHARGEBACK_DISPUTE instead. CHARGEBACK = 1; - // Indicates a chargeback related to an alleged unauthorized transaction - // from the cardholder's perspective (for example, the card number was - // stolen). + // Indicates that the transaction had a chargeback issued related to an + // alleged unauthorized transaction from the cardholder's perspective (for + // example, the card number was stolen). CHARGEBACK_FRAUD = 8; - // Indicates a chargeback related to the cardholder having provided their - // card details but allegedly not being satisfied with the purchase - // (for example, misrepresentation, attempted cancellation). + // Indicates that the transaction had a chargeback issued related to the + // cardholder having provided their card details but allegedly not being + // satisfied with the purchase (for example, misrepresentation, attempted + // cancellation). CHARGEBACK_DISPUTE = 9; + // Indicates that the completed payment transaction was refunded by the + // seller. + REFUND = 10; + + // Indicates that the completed payment transaction was determined to be + // fraudulent by the seller, and was cancelled and refunded as a result. + REFUND_FRAUD = 11; + + // Indicates that the payment transaction was accepted, and the user was + // charged. + TRANSACTION_ACCEPTED = 12; + + // Indicates that the payment transaction was declined, for example due to + // invalid card details. + TRANSACTION_DECLINED = 13; + // Indicates the transaction associated with the assessment is suspected of // being fraudulent based on the payment method, billing details, shipping // address or other transaction information. @@ -230,6 +250,10 @@ message AnnotateAssessmentRequest { // Indicates the user provided an incorrect password. INCORRECT_PASSWORD = 6; + + // Indicates that the user sent unwanted and abusive messages to other users + // of the platform, such as spam, scams, phishing, or social engineering. + SOCIAL_SPAM = 14; } // Required. The resource name of the Assessment, in the format @@ -241,17 +265,16 @@ message AnnotateAssessmentRequest { } ]; - // Optional. The annotation that will be assigned to the Event. This field can - // be left empty to provide reasons that apply to an event without concluding - // whether the event is legitimate or fraudulent. + // Optional. The annotation that will be assigned to the Event. This field can be left + // empty to provide reasons that apply to an event without concluding whether + // the event is legitimate or fraudulent. Annotation annotation = 2 [(google.api.field_behavior) = OPTIONAL]; - // Optional. Optional reasons for the annotation that will be assigned to the - // Event. + // Optional. Optional reasons for the annotation that will be assigned to the Event. repeated Reason reasons = 3 [(google.api.field_behavior) = OPTIONAL]; - // Optional. Optional unique stable hashed user identifier to apply to the - // assessment. This is an alternative to setting the hashed_account_id in + // Optional. Unique stable hashed user identifier to apply to the assessment. + // This is an alternative to setting the hashed_account_id in // CreateAssessment, for example when the account identifier is not yet known // in the initial request. It is recommended that the identifier is hashed // using hmac-sha256 with stable secret. @@ -259,7 +282,31 @@ message AnnotateAssessmentRequest { } // Empty response for AnnotateAssessment. -message AnnotateAssessmentResponse {} +message AnnotateAssessmentResponse { + +} + +// Private password leak verification info. +message PrivatePasswordLeakVerification { + // Optional. Exactly 26-bit prefix of the SHA-256 hash of the canonicalized username. It + // is used to look up password leaks associated with that hash prefix. + bytes lookup_hash_prefix = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Encrypted Scrypt hash of the canonicalized username+password. It is + // re-encrypted by the server and returned through + // `reencrypted_user_credentials_hash`. + bytes encrypted_user_credentials_hash = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. List of prefixes of the encrypted potential password leaks that matched the + // given parameters. They must be compared with the client-side decryption + // prefix of `reencrypted_user_credentials_hash` + repeated bytes encrypted_leak_match_prefixes = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Corresponds to the re-encryption of the `encrypted_user_credentials_hash` + // field. It is used to match potential password leaks within + // `encrypted_leak_match_prefixes`. + bytes reencrypted_user_credentials_hash = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; +} // A recaptcha assessment resource. message Assessment { @@ -279,41 +326,40 @@ message Assessment { RiskAnalysis risk_analysis = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. Properties of the provided event token. - TokenProperties token_properties = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; + TokenProperties token_properties = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - // Assessment returned by Account Defender when a hashed_account_id is + // Assessment returned by account defender when a hashed_account_id is // provided. AccountDefenderAssessment account_defender_assessment = 6; - // Password leak verification info. + // The private password leak verification field contains the parameters that + // are used to to check for leaks privately without sharing user credentials. PrivatePasswordLeakVerification private_password_leak_verification = 8; } message Event { - // Optional. The user response token provided by the reCAPTCHA client-side - // integration on your site. + // Optional. The user response token provided by the reCAPTCHA client-side integration + // on your site. string token = 1 [(google.api.field_behavior) = OPTIONAL]; - // Optional. The site key that was used to invoke reCAPTCHA on your site and - // generate the token. + // Optional. The site key that was used to invoke reCAPTCHA on your site and generate + // the token. string site_key = 2 [(google.api.field_behavior) = OPTIONAL]; - // Optional. The user agent present in the request from the user's device - // related to this event. + // Optional. The user agent present in the request from the user's device related to + // this event. string user_agent = 3 [(google.api.field_behavior) = OPTIONAL]; - // Optional. The IP address in the request from the user's device related to - // this event. + // Optional. The IP address in the request from the user's device related to this event. string user_ip_address = 4 [(google.api.field_behavior) = OPTIONAL]; - // Optional. The expected action for this type of event. This should be the - // same action provided at token generation time on client-side platforms - // already integrated with recaptcha enterprise. + // Optional. The expected action for this type of event. This should be the same action + // provided at token generation time on client-side platforms already + // integrated with recaptcha enterprise. string expected_action = 5 [(google.api.field_behavior) = OPTIONAL]; - // Optional. Optional unique stable hashed user identifier for the request. - // The identifier should ideally be hashed using sha256 with stable secret. + // Optional. Unique stable hashed user identifier for the request. The identifier must + // be hashed using hmac-sha256 with stable secret. bytes hashed_account_id = 6 [(google.api.field_behavior) = OPTIONAL]; } @@ -390,16 +436,16 @@ message TokenProperties { // The timestamp corresponding to the generation of the token. google.protobuf.Timestamp create_time = 3; - // The hostname of the page on which the token was generated. + // The hostname of the page on which the token was generated (Web keys only). string hostname = 4; // Action name provided at token generation. string action = 5; } -// Account Defender risk assessment. +// Account defender risk assessment. message AccountDefenderAssessment { - // Labels returned by Account Defender for this request. + // Labels returned by account defender for this request. enum AccountDefenderLabel { // Default unspecified type. ACCOUNT_DEFENDER_LABEL_UNSPECIFIED = 0; @@ -407,17 +453,17 @@ message AccountDefenderAssessment { // The request matches a known good profile for the user. PROFILE_MATCH = 1; - // The request is potentially a suspicious login event and should be further - // verified either via multi-factor authentication or another system. + // The request is potentially a suspicious login event and must be further + // verified either through multi-factor authentication or another system. SUSPICIOUS_LOGIN_ACTIVITY = 2; // The request matched a profile that previously had suspicious account - // creation behavior. This could mean this is a fake account. + // creation behavior. This can mean that this is a fake account. SUSPICIOUS_ACCOUNT_CREATION = 3; // The account in the request has a high number of related accounts. It does - // not necessarily imply that the account is bad but could require - // investigating. + // not necessarily imply that the account is bad but can require further + // investigation. RELATED_ACCOUNTS_NUMBER_HIGH = 4; } @@ -425,31 +471,6 @@ message AccountDefenderAssessment { repeated AccountDefenderLabel labels = 1; } -// Private password leak verification info. -message PrivatePasswordLeakVerification { - // Exactly 26-bit prefix of the SHA-256 hash of the canonicalized username. It - // is used to look up password leaks associated with that hash prefix. - bytes lookup_hash_prefix = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Encrypted Scrypt hash of the canonicalized username+password. It is - // re-encrypted by the server and returned through - // `reencrypted_user_credentials_hash`. - bytes encrypted_user_credentials_hash = 2 - [(google.api.field_behavior) = OPTIONAL]; - - // List of prefixes of the encrypted potential password leaks that matched the - // given parameters. They should be compared with the client-side decryption - // prefix of `reencrypted_user_credentials_hash` - repeated bytes encrypted_leak_match_prefixes = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Corresponds to the re-encryption of the `encrypted_user_credentials_hash` - // field. Used to match potential password leaks within - // `encrypted_leak_match_prefixes`. - bytes reencrypted_user_credentials_hash = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - // The create key request message. message CreateKeyRequest { // Required. The name of the project in which the key will be created, in the @@ -495,6 +516,18 @@ message ListKeysResponse { string next_page_token = 2; } +// The retrieve legacy secret key request message. +message RetrieveLegacySecretKeyRequest { + // Required. The public key name linked to the requested secret key in the format + // "projects/{project}/keys/{key}". + string key = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "recaptchaenterprise.googleapis.com/Key" + } + ]; +} + // The get key request message. message GetKeyRequest { // Required. The name of the requested key, in the format @@ -512,10 +545,9 @@ message UpdateKeyRequest { // Required. The key to update. Key key = 1 [(google.api.field_behavior) = REQUIRED]; - // Optional. The mask to control which fields of the key get updated. If the - // mask is not present, all fields will be updated. - google.protobuf.FieldMask update_mask = 2 - [(google.api.field_behavior) = OPTIONAL]; + // Optional. The mask to control which fields of the key get updated. If the mask is not + // present, all fields will be updated. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = OPTIONAL]; } // The delete key request message. @@ -578,6 +610,16 @@ message Metrics { repeated ChallengeMetrics challenge_metrics = 3; } +// Secret key is used only in legacy reCAPTCHA. It must be used in a 3rd party +// integration with legacy reCAPTCHA. +message RetrieveLegacySecretKeyResponse { + // The secret key (also known as shared secret) authorizes communication + // between your application backend and the reCAPTCHA Enterprise server to + // create an assessment. + // The secret key needs to be kept safe for security purposes. + string legacy_secret_key = 1; +} + // A key used to identify and configure applications (web and/or mobile) that // use reCAPTCHA Enterprise. message Key { @@ -593,8 +635,8 @@ message Key { // Human-readable display name of this key. Modifiable by user. string display_name = 2; - // Platform specific settings for this key. The key can only be used on one - // platform, the one it has settings for. + // Platform specific settings for this key. The key can only be used on a + // platform for which the settings are enabled. oneof platform_settings { // Settings for keys that can be used by websites. WebKeySettings web_settings = 3; @@ -777,14 +819,14 @@ message ListRelatedAccountGroupMembershipsRequest { } ]; - // Optional. The maximum number of accounts to return. The service may return - // fewer than this value. If unspecified, at most 50 accounts will be - // returned. The maximum value is 1000; values above 1000 will be coerced to - // 1000. + // Optional. The maximum number of accounts to return. The service might return fewer + // than this value. + // If unspecified, at most 50 accounts are returned. + // The maximum value is 1000; values above 1000 are coerced to 1000. int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - // Optional. A page token, received from a previous - // `ListRelatedAccountGroupMemberships` call. + // Optional. A page token, received from a previous `ListRelatedAccountGroupMemberships` + // call. // // When paginating, all other parameters provided to // `ListRelatedAccountGroupMemberships` must match the call that provided the @@ -804,8 +846,8 @@ message ListRelatedAccountGroupMembershipsResponse { // The request message to list related account groups. message ListRelatedAccountGroupsRequest { - // Required. The name of the project to list related account groups from, in - // the format "projects/{project}". + // Required. The name of the project to list related account groups from, in the format + // "projects/{project}". string parent = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -813,13 +855,14 @@ message ListRelatedAccountGroupsRequest { } ]; - // Optional. The maximum number of groups to return. The service may return - // fewer than this value. If unspecified, at most 50 groups will be returned. - // The maximum value is 1000; values above 1000 will be coerced to 1000. + // Optional. The maximum number of groups to return. The service might return fewer than + // this value. + // If unspecified, at most 50 groups are returned. + // The maximum value is 1000; values above 1000 are coerced to 1000. int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - // Optional. A page token, received from a previous `ListRelatedAccountGroups` - // call. Provide this to retrieve the subsequent page. + // Optional. A page token, received from a previous `ListRelatedAccountGroups` call. + // Provide this to retrieve the subsequent page. // // When paginating, all other parameters provided to // `ListRelatedAccountGroups` must match the call that provided the page @@ -839,8 +882,8 @@ message ListRelatedAccountGroupsResponse { // The request message to search related account group memberships. message SearchRelatedAccountGroupMembershipsRequest { - // Required. The name of the project to search related account group - // memberships from, in the format "projects/{project}". + // Required. The name of the project to search related account group memberships from. + // Specify the project name in the following format: "projects/{project}". string project = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -848,14 +891,15 @@ message SearchRelatedAccountGroupMembershipsRequest { } ]; - // Optional. The unique stable hashed user identifier we should search - // connections to. The identifier should correspond to a `hashed_account_id` - // provided in a previous CreateAssessment or AnnotateAssessment call. + // Optional. The unique stable hashed user identifier we should search connections to. + // The identifier should correspond to a `hashed_account_id` provided in a + // previous `CreateAssessment` or `AnnotateAssessment` call. bytes hashed_account_id = 2 [(google.api.field_behavior) = OPTIONAL]; - // Optional. The maximum number of groups to return. The service may return - // fewer than this value. If unspecified, at most 50 groups will be returned. - // The maximum value is 1000; values above 1000 will be coerced to 1000. + // Optional. The maximum number of groups to return. The service might return fewer than + // this value. + // If unspecified, at most 50 groups are returned. + // The maximum value is 1000; values above 1000 are coerced to 1000. int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL]; // Optional. A page token, received from a previous @@ -896,7 +940,7 @@ message RelatedAccountGroupMembership { // The unique stable hashed user identifier of the member. The identifier // corresponds to a `hashed_account_id` provided in a previous - // CreateAssessment or AnnotateAssessment call. + // `CreateAssessment` or `AnnotateAssessment` call. bytes hashed_account_id = 2; } diff --git a/packages/google-cloud-recaptchaenterprise/protos/protos.d.ts b/packages/google-cloud-recaptchaenterprise/protos/protos.d.ts index 405be8a8ac4..a19b96effa5 100644 --- a/packages/google-cloud-recaptchaenterprise/protos/protos.d.ts +++ b/packages/google-cloud-recaptchaenterprise/protos/protos.d.ts @@ -102,6 +102,20 @@ export namespace google { */ public listKeys(request: google.cloud.recaptchaenterprise.v1.IListKeysRequest): Promise; + /** + * Calls RetrieveLegacySecretKey. + * @param request RetrieveLegacySecretKeyRequest message or plain object + * @param callback Node-style callback called with the error, if any, and RetrieveLegacySecretKeyResponse + */ + public retrieveLegacySecretKey(request: google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyRequest, callback: google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.RetrieveLegacySecretKeyCallback): void; + + /** + * Calls RetrieveLegacySecretKey. + * @param request RetrieveLegacySecretKeyRequest message or plain object + * @returns Promise + */ + public retrieveLegacySecretKey(request: google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyRequest): Promise; + /** * Calls GetKey. * @param request GetKeyRequest message or plain object @@ -245,6 +259,13 @@ export namespace google { */ type ListKeysCallback = (error: (Error|null), response?: google.cloud.recaptchaenterprise.v1.ListKeysResponse) => void; + /** + * Callback as used by {@link google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService|retrieveLegacySecretKey}. + * @param error Error, if any + * @param [response] RetrieveLegacySecretKeyResponse + */ + type RetrieveLegacySecretKeyCallback = (error: (Error|null), response?: google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse) => void; + /** * Callback as used by {@link google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService|getKey}. * @param error Error, if any @@ -537,12 +558,17 @@ export namespace google { CHARGEBACK = 1, CHARGEBACK_FRAUD = 8, CHARGEBACK_DISPUTE = 9, + REFUND = 10, + REFUND_FRAUD = 11, + TRANSACTION_ACCEPTED = 12, + TRANSACTION_DECLINED = 13, PAYMENT_HEURISTICS = 2, INITIATED_TWO_FACTOR = 7, PASSED_TWO_FACTOR = 3, FAILED_TWO_FACTOR = 4, CORRECT_PASSWORD = 5, - INCORRECT_PASSWORD = 6 + INCORRECT_PASSWORD = 6, + SOCIAL_SPAM = 14 } } @@ -637,6 +663,121 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } + /** Properties of a PrivatePasswordLeakVerification. */ + interface IPrivatePasswordLeakVerification { + + /** PrivatePasswordLeakVerification lookupHashPrefix */ + lookupHashPrefix?: (Uint8Array|string|null); + + /** PrivatePasswordLeakVerification encryptedUserCredentialsHash */ + encryptedUserCredentialsHash?: (Uint8Array|string|null); + + /** PrivatePasswordLeakVerification encryptedLeakMatchPrefixes */ + encryptedLeakMatchPrefixes?: (Uint8Array[]|null); + + /** PrivatePasswordLeakVerification reencryptedUserCredentialsHash */ + reencryptedUserCredentialsHash?: (Uint8Array|string|null); + } + + /** Represents a PrivatePasswordLeakVerification. */ + class PrivatePasswordLeakVerification implements IPrivatePasswordLeakVerification { + + /** + * Constructs a new PrivatePasswordLeakVerification. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1.IPrivatePasswordLeakVerification); + + /** PrivatePasswordLeakVerification lookupHashPrefix. */ + public lookupHashPrefix: (Uint8Array|string); + + /** PrivatePasswordLeakVerification encryptedUserCredentialsHash. */ + public encryptedUserCredentialsHash: (Uint8Array|string); + + /** PrivatePasswordLeakVerification encryptedLeakMatchPrefixes. */ + public encryptedLeakMatchPrefixes: Uint8Array[]; + + /** PrivatePasswordLeakVerification reencryptedUserCredentialsHash. */ + public reencryptedUserCredentialsHash: (Uint8Array|string); + + /** + * Creates a new PrivatePasswordLeakVerification instance using the specified properties. + * @param [properties] Properties to set + * @returns PrivatePasswordLeakVerification instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1.IPrivatePasswordLeakVerification): google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification; + + /** + * Encodes the specified PrivatePasswordLeakVerification message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification.verify|verify} messages. + * @param message PrivatePasswordLeakVerification message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1.IPrivatePasswordLeakVerification, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PrivatePasswordLeakVerification message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification.verify|verify} messages. + * @param message PrivatePasswordLeakVerification message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.IPrivatePasswordLeakVerification, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PrivatePasswordLeakVerification message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PrivatePasswordLeakVerification + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification; + + /** + * Decodes a PrivatePasswordLeakVerification message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PrivatePasswordLeakVerification + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification; + + /** + * Verifies a PrivatePasswordLeakVerification message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PrivatePasswordLeakVerification message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PrivatePasswordLeakVerification + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification; + + /** + * Creates a plain object from a PrivatePasswordLeakVerification message. Also converts values to other types if specified. + * @param message PrivatePasswordLeakVerification + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PrivatePasswordLeakVerification to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PrivatePasswordLeakVerification + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + /** Properties of an Assessment. */ interface IAssessment { @@ -1251,121 +1392,6 @@ export namespace google { } } - /** Properties of a PrivatePasswordLeakVerification. */ - interface IPrivatePasswordLeakVerification { - - /** PrivatePasswordLeakVerification lookupHashPrefix */ - lookupHashPrefix?: (Uint8Array|string|null); - - /** PrivatePasswordLeakVerification encryptedUserCredentialsHash */ - encryptedUserCredentialsHash?: (Uint8Array|string|null); - - /** PrivatePasswordLeakVerification encryptedLeakMatchPrefixes */ - encryptedLeakMatchPrefixes?: (Uint8Array[]|null); - - /** PrivatePasswordLeakVerification reencryptedUserCredentialsHash */ - reencryptedUserCredentialsHash?: (Uint8Array|string|null); - } - - /** Represents a PrivatePasswordLeakVerification. */ - class PrivatePasswordLeakVerification implements IPrivatePasswordLeakVerification { - - /** - * Constructs a new PrivatePasswordLeakVerification. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.recaptchaenterprise.v1.IPrivatePasswordLeakVerification); - - /** PrivatePasswordLeakVerification lookupHashPrefix. */ - public lookupHashPrefix: (Uint8Array|string); - - /** PrivatePasswordLeakVerification encryptedUserCredentialsHash. */ - public encryptedUserCredentialsHash: (Uint8Array|string); - - /** PrivatePasswordLeakVerification encryptedLeakMatchPrefixes. */ - public encryptedLeakMatchPrefixes: Uint8Array[]; - - /** PrivatePasswordLeakVerification reencryptedUserCredentialsHash. */ - public reencryptedUserCredentialsHash: (Uint8Array|string); - - /** - * Creates a new PrivatePasswordLeakVerification instance using the specified properties. - * @param [properties] Properties to set - * @returns PrivatePasswordLeakVerification instance - */ - public static create(properties?: google.cloud.recaptchaenterprise.v1.IPrivatePasswordLeakVerification): google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification; - - /** - * Encodes the specified PrivatePasswordLeakVerification message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification.verify|verify} messages. - * @param message PrivatePasswordLeakVerification message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.recaptchaenterprise.v1.IPrivatePasswordLeakVerification, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified PrivatePasswordLeakVerification message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification.verify|verify} messages. - * @param message PrivatePasswordLeakVerification message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.IPrivatePasswordLeakVerification, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a PrivatePasswordLeakVerification message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns PrivatePasswordLeakVerification - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification; - - /** - * Decodes a PrivatePasswordLeakVerification message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns PrivatePasswordLeakVerification - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification; - - /** - * Verifies a PrivatePasswordLeakVerification message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a PrivatePasswordLeakVerification message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns PrivatePasswordLeakVerification - */ - public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification; - - /** - * Creates a plain object from a PrivatePasswordLeakVerification message. Also converts values to other types if specified. - * @param message PrivatePasswordLeakVerification - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this PrivatePasswordLeakVerification to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for PrivatePasswordLeakVerification - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - /** Properties of a CreateKeyRequest. */ interface ICreateKeyRequest { @@ -1681,6 +1707,103 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } + /** Properties of a RetrieveLegacySecretKeyRequest. */ + interface IRetrieveLegacySecretKeyRequest { + + /** RetrieveLegacySecretKeyRequest key */ + key?: (string|null); + } + + /** Represents a RetrieveLegacySecretKeyRequest. */ + class RetrieveLegacySecretKeyRequest implements IRetrieveLegacySecretKeyRequest { + + /** + * Constructs a new RetrieveLegacySecretKeyRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyRequest); + + /** RetrieveLegacySecretKeyRequest key. */ + public key: string; + + /** + * Creates a new RetrieveLegacySecretKeyRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns RetrieveLegacySecretKeyRequest instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyRequest): google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest; + + /** + * Encodes the specified RetrieveLegacySecretKeyRequest message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest.verify|verify} messages. + * @param message RetrieveLegacySecretKeyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RetrieveLegacySecretKeyRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest.verify|verify} messages. + * @param message RetrieveLegacySecretKeyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RetrieveLegacySecretKeyRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RetrieveLegacySecretKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest; + + /** + * Decodes a RetrieveLegacySecretKeyRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RetrieveLegacySecretKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest; + + /** + * Verifies a RetrieveLegacySecretKeyRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RetrieveLegacySecretKeyRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RetrieveLegacySecretKeyRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest; + + /** + * Creates a plain object from a RetrieveLegacySecretKeyRequest message. Also converts values to other types if specified. + * @param message RetrieveLegacySecretKeyRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RetrieveLegacySecretKeyRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RetrieveLegacySecretKeyRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + /** Properties of a GetKeyRequest. */ interface IGetKeyRequest { @@ -2287,6 +2410,103 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } + /** Properties of a RetrieveLegacySecretKeyResponse. */ + interface IRetrieveLegacySecretKeyResponse { + + /** RetrieveLegacySecretKeyResponse legacySecretKey */ + legacySecretKey?: (string|null); + } + + /** Represents a RetrieveLegacySecretKeyResponse. */ + class RetrieveLegacySecretKeyResponse implements IRetrieveLegacySecretKeyResponse { + + /** + * Constructs a new RetrieveLegacySecretKeyResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyResponse); + + /** RetrieveLegacySecretKeyResponse legacySecretKey. */ + public legacySecretKey: string; + + /** + * Creates a new RetrieveLegacySecretKeyResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns RetrieveLegacySecretKeyResponse instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyResponse): google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse; + + /** + * Encodes the specified RetrieveLegacySecretKeyResponse message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse.verify|verify} messages. + * @param message RetrieveLegacySecretKeyResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RetrieveLegacySecretKeyResponse message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse.verify|verify} messages. + * @param message RetrieveLegacySecretKeyResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RetrieveLegacySecretKeyResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RetrieveLegacySecretKeyResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse; + + /** + * Decodes a RetrieveLegacySecretKeyResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RetrieveLegacySecretKeyResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse; + + /** + * Verifies a RetrieveLegacySecretKeyResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RetrieveLegacySecretKeyResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RetrieveLegacySecretKeyResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse; + + /** + * Creates a plain object from a RetrieveLegacySecretKeyResponse message. Also converts values to other types if specified. + * @param message RetrieveLegacySecretKeyResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RetrieveLegacySecretKeyResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RetrieveLegacySecretKeyResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + /** Properties of a Key. */ interface IKey { diff --git a/packages/google-cloud-recaptchaenterprise/protos/protos.js b/packages/google-cloud-recaptchaenterprise/protos/protos.js index bbe54b1e333..ab3c204895c 100644 --- a/packages/google-cloud-recaptchaenterprise/protos/protos.js +++ b/packages/google-cloud-recaptchaenterprise/protos/protos.js @@ -230,6 +230,39 @@ * @variation 2 */ + /** + * Callback as used by {@link google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService|retrieveLegacySecretKey}. + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @typedef RetrieveLegacySecretKeyCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse} [response] RetrieveLegacySecretKeyResponse + */ + + /** + * Calls RetrieveLegacySecretKey. + * @function retrieveLegacySecretKey + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @instance + * @param {google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyRequest} request RetrieveLegacySecretKeyRequest message or plain object + * @param {google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.RetrieveLegacySecretKeyCallback} callback Node-style callback called with the error, if any, and RetrieveLegacySecretKeyResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(RecaptchaEnterpriseService.prototype.retrieveLegacySecretKey = function retrieveLegacySecretKey(request, callback) { + return this.rpcCall(retrieveLegacySecretKey, $root.google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest, $root.google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse, request, callback); + }, "name", { value: "RetrieveLegacySecretKey" }); + + /** + * Calls RetrieveLegacySecretKey. + * @function retrieveLegacySecretKey + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @instance + * @param {google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyRequest} request RetrieveLegacySecretKeyRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + /** * Callback as used by {@link google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService|getKey}. * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService @@ -942,12 +975,17 @@ case 1: case 8: case 9: + case 10: + case 11: + case 12: + case 13: case 2: case 7: case 3: case 4: case 5: case 6: + case 14: break; } } @@ -1016,6 +1054,22 @@ case 9: message.reasons[i] = 9; break; + case "REFUND": + case 10: + message.reasons[i] = 10; + break; + case "REFUND_FRAUD": + case 11: + message.reasons[i] = 11; + break; + case "TRANSACTION_ACCEPTED": + case 12: + message.reasons[i] = 12; + break; + case "TRANSACTION_DECLINED": + case 13: + message.reasons[i] = 13; + break; case "PAYMENT_HEURISTICS": case 2: message.reasons[i] = 2; @@ -1040,6 +1094,10 @@ case 6: message.reasons[i] = 6; break; + case "SOCIAL_SPAM": + case 14: + message.reasons[i] = 14; + break; } } if (object.hashedAccountId != null) @@ -1144,12 +1202,17 @@ * @property {number} CHARGEBACK=1 CHARGEBACK value * @property {number} CHARGEBACK_FRAUD=8 CHARGEBACK_FRAUD value * @property {number} CHARGEBACK_DISPUTE=9 CHARGEBACK_DISPUTE value + * @property {number} REFUND=10 REFUND value + * @property {number} REFUND_FRAUD=11 REFUND_FRAUD value + * @property {number} TRANSACTION_ACCEPTED=12 TRANSACTION_ACCEPTED value + * @property {number} TRANSACTION_DECLINED=13 TRANSACTION_DECLINED value * @property {number} PAYMENT_HEURISTICS=2 PAYMENT_HEURISTICS value * @property {number} INITIATED_TWO_FACTOR=7 INITIATED_TWO_FACTOR value * @property {number} PASSED_TWO_FACTOR=3 PASSED_TWO_FACTOR value * @property {number} FAILED_TWO_FACTOR=4 FAILED_TWO_FACTOR value * @property {number} CORRECT_PASSWORD=5 CORRECT_PASSWORD value * @property {number} INCORRECT_PASSWORD=6 INCORRECT_PASSWORD value + * @property {number} SOCIAL_SPAM=14 SOCIAL_SPAM value */ AnnotateAssessmentRequest.Reason = (function() { var valuesById = {}, values = Object.create(valuesById); @@ -1157,12 +1220,17 @@ values[valuesById[1] = "CHARGEBACK"] = 1; values[valuesById[8] = "CHARGEBACK_FRAUD"] = 8; values[valuesById[9] = "CHARGEBACK_DISPUTE"] = 9; + values[valuesById[10] = "REFUND"] = 10; + values[valuesById[11] = "REFUND_FRAUD"] = 11; + values[valuesById[12] = "TRANSACTION_ACCEPTED"] = 12; + values[valuesById[13] = "TRANSACTION_DECLINED"] = 13; values[valuesById[2] = "PAYMENT_HEURISTICS"] = 2; values[valuesById[7] = "INITIATED_TWO_FACTOR"] = 7; values[valuesById[3] = "PASSED_TWO_FACTOR"] = 3; values[valuesById[4] = "FAILED_TWO_FACTOR"] = 4; values[valuesById[5] = "CORRECT_PASSWORD"] = 5; values[valuesById[6] = "INCORRECT_PASSWORD"] = 6; + values[valuesById[14] = "SOCIAL_SPAM"] = 14; return values; })(); @@ -1344,29 +1412,28 @@ return AnnotateAssessmentResponse; })(); - v1.Assessment = (function() { + v1.PrivatePasswordLeakVerification = (function() { /** - * Properties of an Assessment. + * Properties of a PrivatePasswordLeakVerification. * @memberof google.cloud.recaptchaenterprise.v1 - * @interface IAssessment - * @property {string|null} [name] Assessment name - * @property {google.cloud.recaptchaenterprise.v1.IEvent|null} [event] Assessment event - * @property {google.cloud.recaptchaenterprise.v1.IRiskAnalysis|null} [riskAnalysis] Assessment riskAnalysis - * @property {google.cloud.recaptchaenterprise.v1.ITokenProperties|null} [tokenProperties] Assessment tokenProperties - * @property {google.cloud.recaptchaenterprise.v1.IAccountDefenderAssessment|null} [accountDefenderAssessment] Assessment accountDefenderAssessment - * @property {google.cloud.recaptchaenterprise.v1.IPrivatePasswordLeakVerification|null} [privatePasswordLeakVerification] Assessment privatePasswordLeakVerification + * @interface IPrivatePasswordLeakVerification + * @property {Uint8Array|null} [lookupHashPrefix] PrivatePasswordLeakVerification lookupHashPrefix + * @property {Uint8Array|null} [encryptedUserCredentialsHash] PrivatePasswordLeakVerification encryptedUserCredentialsHash + * @property {Array.|null} [encryptedLeakMatchPrefixes] PrivatePasswordLeakVerification encryptedLeakMatchPrefixes + * @property {Uint8Array|null} [reencryptedUserCredentialsHash] PrivatePasswordLeakVerification reencryptedUserCredentialsHash */ /** - * Constructs a new Assessment. + * Constructs a new PrivatePasswordLeakVerification. * @memberof google.cloud.recaptchaenterprise.v1 - * @classdesc Represents an Assessment. - * @implements IAssessment + * @classdesc Represents a PrivatePasswordLeakVerification. + * @implements IPrivatePasswordLeakVerification * @constructor - * @param {google.cloud.recaptchaenterprise.v1.IAssessment=} [properties] Properties to set + * @param {google.cloud.recaptchaenterprise.v1.IPrivatePasswordLeakVerification=} [properties] Properties to set */ - function Assessment(properties) { + function PrivatePasswordLeakVerification(properties) { + this.encryptedLeakMatchPrefixes = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -1374,145 +1441,120 @@ } /** - * Assessment name. - * @member {string} name - * @memberof google.cloud.recaptchaenterprise.v1.Assessment - * @instance - */ - Assessment.prototype.name = ""; - - /** - * Assessment event. - * @member {google.cloud.recaptchaenterprise.v1.IEvent|null|undefined} event - * @memberof google.cloud.recaptchaenterprise.v1.Assessment - * @instance - */ - Assessment.prototype.event = null; - - /** - * Assessment riskAnalysis. - * @member {google.cloud.recaptchaenterprise.v1.IRiskAnalysis|null|undefined} riskAnalysis - * @memberof google.cloud.recaptchaenterprise.v1.Assessment + * PrivatePasswordLeakVerification lookupHashPrefix. + * @member {Uint8Array} lookupHashPrefix + * @memberof google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification * @instance */ - Assessment.prototype.riskAnalysis = null; + PrivatePasswordLeakVerification.prototype.lookupHashPrefix = $util.newBuffer([]); /** - * Assessment tokenProperties. - * @member {google.cloud.recaptchaenterprise.v1.ITokenProperties|null|undefined} tokenProperties - * @memberof google.cloud.recaptchaenterprise.v1.Assessment + * PrivatePasswordLeakVerification encryptedUserCredentialsHash. + * @member {Uint8Array} encryptedUserCredentialsHash + * @memberof google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification * @instance */ - Assessment.prototype.tokenProperties = null; + PrivatePasswordLeakVerification.prototype.encryptedUserCredentialsHash = $util.newBuffer([]); /** - * Assessment accountDefenderAssessment. - * @member {google.cloud.recaptchaenterprise.v1.IAccountDefenderAssessment|null|undefined} accountDefenderAssessment - * @memberof google.cloud.recaptchaenterprise.v1.Assessment + * PrivatePasswordLeakVerification encryptedLeakMatchPrefixes. + * @member {Array.} encryptedLeakMatchPrefixes + * @memberof google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification * @instance */ - Assessment.prototype.accountDefenderAssessment = null; + PrivatePasswordLeakVerification.prototype.encryptedLeakMatchPrefixes = $util.emptyArray; /** - * Assessment privatePasswordLeakVerification. - * @member {google.cloud.recaptchaenterprise.v1.IPrivatePasswordLeakVerification|null|undefined} privatePasswordLeakVerification - * @memberof google.cloud.recaptchaenterprise.v1.Assessment + * PrivatePasswordLeakVerification reencryptedUserCredentialsHash. + * @member {Uint8Array} reencryptedUserCredentialsHash + * @memberof google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification * @instance */ - Assessment.prototype.privatePasswordLeakVerification = null; + PrivatePasswordLeakVerification.prototype.reencryptedUserCredentialsHash = $util.newBuffer([]); /** - * Creates a new Assessment instance using the specified properties. + * Creates a new PrivatePasswordLeakVerification instance using the specified properties. * @function create - * @memberof google.cloud.recaptchaenterprise.v1.Assessment + * @memberof google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification * @static - * @param {google.cloud.recaptchaenterprise.v1.IAssessment=} [properties] Properties to set - * @returns {google.cloud.recaptchaenterprise.v1.Assessment} Assessment instance + * @param {google.cloud.recaptchaenterprise.v1.IPrivatePasswordLeakVerification=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification} PrivatePasswordLeakVerification instance */ - Assessment.create = function create(properties) { - return new Assessment(properties); + PrivatePasswordLeakVerification.create = function create(properties) { + return new PrivatePasswordLeakVerification(properties); }; /** - * Encodes the specified Assessment message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.Assessment.verify|verify} messages. + * Encodes the specified PrivatePasswordLeakVerification message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification.verify|verify} messages. * @function encode - * @memberof google.cloud.recaptchaenterprise.v1.Assessment + * @memberof google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification * @static - * @param {google.cloud.recaptchaenterprise.v1.IAssessment} message Assessment message or plain object to encode + * @param {google.cloud.recaptchaenterprise.v1.IPrivatePasswordLeakVerification} message PrivatePasswordLeakVerification message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Assessment.encode = function encode(message, writer) { + PrivatePasswordLeakVerification.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.event != null && Object.hasOwnProperty.call(message, "event")) - $root.google.cloud.recaptchaenterprise.v1.Event.encode(message.event, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.riskAnalysis != null && Object.hasOwnProperty.call(message, "riskAnalysis")) - $root.google.cloud.recaptchaenterprise.v1.RiskAnalysis.encode(message.riskAnalysis, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.tokenProperties != null && Object.hasOwnProperty.call(message, "tokenProperties")) - $root.google.cloud.recaptchaenterprise.v1.TokenProperties.encode(message.tokenProperties, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.accountDefenderAssessment != null && Object.hasOwnProperty.call(message, "accountDefenderAssessment")) - $root.google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment.encode(message.accountDefenderAssessment, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.privatePasswordLeakVerification != null && Object.hasOwnProperty.call(message, "privatePasswordLeakVerification")) - $root.google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification.encode(message.privatePasswordLeakVerification, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.lookupHashPrefix != null && Object.hasOwnProperty.call(message, "lookupHashPrefix")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.lookupHashPrefix); + if (message.encryptedUserCredentialsHash != null && Object.hasOwnProperty.call(message, "encryptedUserCredentialsHash")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.encryptedUserCredentialsHash); + if (message.encryptedLeakMatchPrefixes != null && message.encryptedLeakMatchPrefixes.length) + for (var i = 0; i < message.encryptedLeakMatchPrefixes.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.encryptedLeakMatchPrefixes[i]); + if (message.reencryptedUserCredentialsHash != null && Object.hasOwnProperty.call(message, "reencryptedUserCredentialsHash")) + writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.reencryptedUserCredentialsHash); return writer; }; /** - * Encodes the specified Assessment message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.Assessment.verify|verify} messages. + * Encodes the specified PrivatePasswordLeakVerification message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.recaptchaenterprise.v1.Assessment + * @memberof google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification * @static - * @param {google.cloud.recaptchaenterprise.v1.IAssessment} message Assessment message or plain object to encode + * @param {google.cloud.recaptchaenterprise.v1.IPrivatePasswordLeakVerification} message PrivatePasswordLeakVerification message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Assessment.encodeDelimited = function encodeDelimited(message, writer) { + PrivatePasswordLeakVerification.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an Assessment message from the specified reader or buffer. + * Decodes a PrivatePasswordLeakVerification message from the specified reader or buffer. * @function decode - * @memberof google.cloud.recaptchaenterprise.v1.Assessment + * @memberof google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.recaptchaenterprise.v1.Assessment} Assessment + * @returns {google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification} PrivatePasswordLeakVerification * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Assessment.decode = function decode(reader, length) { + PrivatePasswordLeakVerification.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.Assessment(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - message.name = reader.string(); + message.lookupHashPrefix = reader.bytes(); break; } case 2: { - message.event = $root.google.cloud.recaptchaenterprise.v1.Event.decode(reader, reader.uint32()); + message.encryptedUserCredentialsHash = reader.bytes(); break; } case 3: { - message.riskAnalysis = $root.google.cloud.recaptchaenterprise.v1.RiskAnalysis.decode(reader, reader.uint32()); + if (!(message.encryptedLeakMatchPrefixes && message.encryptedLeakMatchPrefixes.length)) + message.encryptedLeakMatchPrefixes = []; + message.encryptedLeakMatchPrefixes.push(reader.bytes()); break; } case 4: { - message.tokenProperties = $root.google.cloud.recaptchaenterprise.v1.TokenProperties.decode(reader, reader.uint32()); - break; - } - case 6: { - message.accountDefenderAssessment = $root.google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment.decode(reader, reader.uint32()); - break; - } - case 8: { - message.privatePasswordLeakVerification = $root.google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification.decode(reader, reader.uint32()); + message.reencryptedUserCredentialsHash = reader.bytes(); break; } default: @@ -1524,193 +1566,195 @@ }; /** - * Decodes an Assessment message from the specified reader or buffer, length delimited. + * Decodes a PrivatePasswordLeakVerification message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.recaptchaenterprise.v1.Assessment + * @memberof google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.recaptchaenterprise.v1.Assessment} Assessment + * @returns {google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification} PrivatePasswordLeakVerification * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Assessment.decodeDelimited = function decodeDelimited(reader) { + PrivatePasswordLeakVerification.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an Assessment message. + * Verifies a PrivatePasswordLeakVerification message. * @function verify - * @memberof google.cloud.recaptchaenterprise.v1.Assessment + * @memberof google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Assessment.verify = function verify(message) { + PrivatePasswordLeakVerification.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.event != null && message.hasOwnProperty("event")) { - var error = $root.google.cloud.recaptchaenterprise.v1.Event.verify(message.event); - if (error) - return "event." + error; - } - if (message.riskAnalysis != null && message.hasOwnProperty("riskAnalysis")) { - var error = $root.google.cloud.recaptchaenterprise.v1.RiskAnalysis.verify(message.riskAnalysis); - if (error) - return "riskAnalysis." + error; - } - if (message.tokenProperties != null && message.hasOwnProperty("tokenProperties")) { - var error = $root.google.cloud.recaptchaenterprise.v1.TokenProperties.verify(message.tokenProperties); - if (error) - return "tokenProperties." + error; - } - if (message.accountDefenderAssessment != null && message.hasOwnProperty("accountDefenderAssessment")) { - var error = $root.google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment.verify(message.accountDefenderAssessment); - if (error) - return "accountDefenderAssessment." + error; - } - if (message.privatePasswordLeakVerification != null && message.hasOwnProperty("privatePasswordLeakVerification")) { - var error = $root.google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification.verify(message.privatePasswordLeakVerification); - if (error) - return "privatePasswordLeakVerification." + error; + if (message.lookupHashPrefix != null && message.hasOwnProperty("lookupHashPrefix")) + if (!(message.lookupHashPrefix && typeof message.lookupHashPrefix.length === "number" || $util.isString(message.lookupHashPrefix))) + return "lookupHashPrefix: buffer expected"; + if (message.encryptedUserCredentialsHash != null && message.hasOwnProperty("encryptedUserCredentialsHash")) + if (!(message.encryptedUserCredentialsHash && typeof message.encryptedUserCredentialsHash.length === "number" || $util.isString(message.encryptedUserCredentialsHash))) + return "encryptedUserCredentialsHash: buffer expected"; + if (message.encryptedLeakMatchPrefixes != null && message.hasOwnProperty("encryptedLeakMatchPrefixes")) { + if (!Array.isArray(message.encryptedLeakMatchPrefixes)) + return "encryptedLeakMatchPrefixes: array expected"; + for (var i = 0; i < message.encryptedLeakMatchPrefixes.length; ++i) + if (!(message.encryptedLeakMatchPrefixes[i] && typeof message.encryptedLeakMatchPrefixes[i].length === "number" || $util.isString(message.encryptedLeakMatchPrefixes[i]))) + return "encryptedLeakMatchPrefixes: buffer[] expected"; } + if (message.reencryptedUserCredentialsHash != null && message.hasOwnProperty("reencryptedUserCredentialsHash")) + if (!(message.reencryptedUserCredentialsHash && typeof message.reencryptedUserCredentialsHash.length === "number" || $util.isString(message.reencryptedUserCredentialsHash))) + return "reencryptedUserCredentialsHash: buffer expected"; return null; }; /** - * Creates an Assessment message from a plain object. Also converts values to their respective internal types. + * Creates a PrivatePasswordLeakVerification message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.recaptchaenterprise.v1.Assessment + * @memberof google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification * @static * @param {Object.} object Plain object - * @returns {google.cloud.recaptchaenterprise.v1.Assessment} Assessment + * @returns {google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification} PrivatePasswordLeakVerification */ - Assessment.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.recaptchaenterprise.v1.Assessment) + PrivatePasswordLeakVerification.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification) return object; - var message = new $root.google.cloud.recaptchaenterprise.v1.Assessment(); - if (object.name != null) - message.name = String(object.name); - if (object.event != null) { - if (typeof object.event !== "object") - throw TypeError(".google.cloud.recaptchaenterprise.v1.Assessment.event: object expected"); - message.event = $root.google.cloud.recaptchaenterprise.v1.Event.fromObject(object.event); - } - if (object.riskAnalysis != null) { - if (typeof object.riskAnalysis !== "object") - throw TypeError(".google.cloud.recaptchaenterprise.v1.Assessment.riskAnalysis: object expected"); - message.riskAnalysis = $root.google.cloud.recaptchaenterprise.v1.RiskAnalysis.fromObject(object.riskAnalysis); - } - if (object.tokenProperties != null) { - if (typeof object.tokenProperties !== "object") - throw TypeError(".google.cloud.recaptchaenterprise.v1.Assessment.tokenProperties: object expected"); - message.tokenProperties = $root.google.cloud.recaptchaenterprise.v1.TokenProperties.fromObject(object.tokenProperties); - } - if (object.accountDefenderAssessment != null) { - if (typeof object.accountDefenderAssessment !== "object") - throw TypeError(".google.cloud.recaptchaenterprise.v1.Assessment.accountDefenderAssessment: object expected"); - message.accountDefenderAssessment = $root.google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment.fromObject(object.accountDefenderAssessment); - } - if (object.privatePasswordLeakVerification != null) { - if (typeof object.privatePasswordLeakVerification !== "object") - throw TypeError(".google.cloud.recaptchaenterprise.v1.Assessment.privatePasswordLeakVerification: object expected"); - message.privatePasswordLeakVerification = $root.google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification.fromObject(object.privatePasswordLeakVerification); + var message = new $root.google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification(); + if (object.lookupHashPrefix != null) + if (typeof object.lookupHashPrefix === "string") + $util.base64.decode(object.lookupHashPrefix, message.lookupHashPrefix = $util.newBuffer($util.base64.length(object.lookupHashPrefix)), 0); + else if (object.lookupHashPrefix.length >= 0) + message.lookupHashPrefix = object.lookupHashPrefix; + if (object.encryptedUserCredentialsHash != null) + if (typeof object.encryptedUserCredentialsHash === "string") + $util.base64.decode(object.encryptedUserCredentialsHash, message.encryptedUserCredentialsHash = $util.newBuffer($util.base64.length(object.encryptedUserCredentialsHash)), 0); + else if (object.encryptedUserCredentialsHash.length >= 0) + message.encryptedUserCredentialsHash = object.encryptedUserCredentialsHash; + if (object.encryptedLeakMatchPrefixes) { + if (!Array.isArray(object.encryptedLeakMatchPrefixes)) + throw TypeError(".google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification.encryptedLeakMatchPrefixes: array expected"); + message.encryptedLeakMatchPrefixes = []; + for (var i = 0; i < object.encryptedLeakMatchPrefixes.length; ++i) + if (typeof object.encryptedLeakMatchPrefixes[i] === "string") + $util.base64.decode(object.encryptedLeakMatchPrefixes[i], message.encryptedLeakMatchPrefixes[i] = $util.newBuffer($util.base64.length(object.encryptedLeakMatchPrefixes[i])), 0); + else if (object.encryptedLeakMatchPrefixes[i].length >= 0) + message.encryptedLeakMatchPrefixes[i] = object.encryptedLeakMatchPrefixes[i]; } + if (object.reencryptedUserCredentialsHash != null) + if (typeof object.reencryptedUserCredentialsHash === "string") + $util.base64.decode(object.reencryptedUserCredentialsHash, message.reencryptedUserCredentialsHash = $util.newBuffer($util.base64.length(object.reencryptedUserCredentialsHash)), 0); + else if (object.reencryptedUserCredentialsHash.length >= 0) + message.reencryptedUserCredentialsHash = object.reencryptedUserCredentialsHash; return message; }; /** - * Creates a plain object from an Assessment message. Also converts values to other types if specified. + * Creates a plain object from a PrivatePasswordLeakVerification message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.recaptchaenterprise.v1.Assessment + * @memberof google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification * @static - * @param {google.cloud.recaptchaenterprise.v1.Assessment} message Assessment + * @param {google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification} message PrivatePasswordLeakVerification * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Assessment.toObject = function toObject(message, options) { + PrivatePasswordLeakVerification.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) + object.encryptedLeakMatchPrefixes = []; if (options.defaults) { - object.name = ""; - object.event = null; - object.riskAnalysis = null; - object.tokenProperties = null; - object.accountDefenderAssessment = null; - object.privatePasswordLeakVerification = null; + if (options.bytes === String) + object.lookupHashPrefix = ""; + else { + object.lookupHashPrefix = []; + if (options.bytes !== Array) + object.lookupHashPrefix = $util.newBuffer(object.lookupHashPrefix); + } + if (options.bytes === String) + object.encryptedUserCredentialsHash = ""; + else { + object.encryptedUserCredentialsHash = []; + if (options.bytes !== Array) + object.encryptedUserCredentialsHash = $util.newBuffer(object.encryptedUserCredentialsHash); + } + if (options.bytes === String) + object.reencryptedUserCredentialsHash = ""; + else { + object.reencryptedUserCredentialsHash = []; + if (options.bytes !== Array) + object.reencryptedUserCredentialsHash = $util.newBuffer(object.reencryptedUserCredentialsHash); + } } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.event != null && message.hasOwnProperty("event")) - object.event = $root.google.cloud.recaptchaenterprise.v1.Event.toObject(message.event, options); - if (message.riskAnalysis != null && message.hasOwnProperty("riskAnalysis")) - object.riskAnalysis = $root.google.cloud.recaptchaenterprise.v1.RiskAnalysis.toObject(message.riskAnalysis, options); - if (message.tokenProperties != null && message.hasOwnProperty("tokenProperties")) - object.tokenProperties = $root.google.cloud.recaptchaenterprise.v1.TokenProperties.toObject(message.tokenProperties, options); - if (message.accountDefenderAssessment != null && message.hasOwnProperty("accountDefenderAssessment")) - object.accountDefenderAssessment = $root.google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment.toObject(message.accountDefenderAssessment, options); - if (message.privatePasswordLeakVerification != null && message.hasOwnProperty("privatePasswordLeakVerification")) - object.privatePasswordLeakVerification = $root.google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification.toObject(message.privatePasswordLeakVerification, options); + if (message.lookupHashPrefix != null && message.hasOwnProperty("lookupHashPrefix")) + object.lookupHashPrefix = options.bytes === String ? $util.base64.encode(message.lookupHashPrefix, 0, message.lookupHashPrefix.length) : options.bytes === Array ? Array.prototype.slice.call(message.lookupHashPrefix) : message.lookupHashPrefix; + if (message.encryptedUserCredentialsHash != null && message.hasOwnProperty("encryptedUserCredentialsHash")) + object.encryptedUserCredentialsHash = options.bytes === String ? $util.base64.encode(message.encryptedUserCredentialsHash, 0, message.encryptedUserCredentialsHash.length) : options.bytes === Array ? Array.prototype.slice.call(message.encryptedUserCredentialsHash) : message.encryptedUserCredentialsHash; + if (message.encryptedLeakMatchPrefixes && message.encryptedLeakMatchPrefixes.length) { + object.encryptedLeakMatchPrefixes = []; + for (var j = 0; j < message.encryptedLeakMatchPrefixes.length; ++j) + object.encryptedLeakMatchPrefixes[j] = options.bytes === String ? $util.base64.encode(message.encryptedLeakMatchPrefixes[j], 0, message.encryptedLeakMatchPrefixes[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.encryptedLeakMatchPrefixes[j]) : message.encryptedLeakMatchPrefixes[j]; + } + if (message.reencryptedUserCredentialsHash != null && message.hasOwnProperty("reencryptedUserCredentialsHash")) + object.reencryptedUserCredentialsHash = options.bytes === String ? $util.base64.encode(message.reencryptedUserCredentialsHash, 0, message.reencryptedUserCredentialsHash.length) : options.bytes === Array ? Array.prototype.slice.call(message.reencryptedUserCredentialsHash) : message.reencryptedUserCredentialsHash; return object; }; /** - * Converts this Assessment to JSON. + * Converts this PrivatePasswordLeakVerification to JSON. * @function toJSON - * @memberof google.cloud.recaptchaenterprise.v1.Assessment + * @memberof google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification * @instance * @returns {Object.} JSON object */ - Assessment.prototype.toJSON = function toJSON() { + PrivatePasswordLeakVerification.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for Assessment + * Gets the default type url for PrivatePasswordLeakVerification * @function getTypeUrl - * @memberof google.cloud.recaptchaenterprise.v1.Assessment + * @memberof google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - Assessment.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + PrivatePasswordLeakVerification.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1.Assessment"; + return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification"; }; - return Assessment; + return PrivatePasswordLeakVerification; })(); - v1.Event = (function() { + v1.Assessment = (function() { /** - * Properties of an Event. + * Properties of an Assessment. * @memberof google.cloud.recaptchaenterprise.v1 - * @interface IEvent - * @property {string|null} [token] Event token - * @property {string|null} [siteKey] Event siteKey - * @property {string|null} [userAgent] Event userAgent - * @property {string|null} [userIpAddress] Event userIpAddress - * @property {string|null} [expectedAction] Event expectedAction - * @property {Uint8Array|null} [hashedAccountId] Event hashedAccountId + * @interface IAssessment + * @property {string|null} [name] Assessment name + * @property {google.cloud.recaptchaenterprise.v1.IEvent|null} [event] Assessment event + * @property {google.cloud.recaptchaenterprise.v1.IRiskAnalysis|null} [riskAnalysis] Assessment riskAnalysis + * @property {google.cloud.recaptchaenterprise.v1.ITokenProperties|null} [tokenProperties] Assessment tokenProperties + * @property {google.cloud.recaptchaenterprise.v1.IAccountDefenderAssessment|null} [accountDefenderAssessment] Assessment accountDefenderAssessment + * @property {google.cloud.recaptchaenterprise.v1.IPrivatePasswordLeakVerification|null} [privatePasswordLeakVerification] Assessment privatePasswordLeakVerification */ /** - * Constructs a new Event. + * Constructs a new Assessment. * @memberof google.cloud.recaptchaenterprise.v1 - * @classdesc Represents an Event. - * @implements IEvent + * @classdesc Represents an Assessment. + * @implements IAssessment * @constructor - * @param {google.cloud.recaptchaenterprise.v1.IEvent=} [properties] Properties to set + * @param {google.cloud.recaptchaenterprise.v1.IAssessment=} [properties] Properties to set */ - function Event(properties) { + function Assessment(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -1718,145 +1762,145 @@ } /** - * Event token. - * @member {string} token - * @memberof google.cloud.recaptchaenterprise.v1.Event + * Assessment name. + * @member {string} name + * @memberof google.cloud.recaptchaenterprise.v1.Assessment * @instance */ - Event.prototype.token = ""; + Assessment.prototype.name = ""; /** - * Event siteKey. - * @member {string} siteKey - * @memberof google.cloud.recaptchaenterprise.v1.Event + * Assessment event. + * @member {google.cloud.recaptchaenterprise.v1.IEvent|null|undefined} event + * @memberof google.cloud.recaptchaenterprise.v1.Assessment * @instance */ - Event.prototype.siteKey = ""; + Assessment.prototype.event = null; /** - * Event userAgent. - * @member {string} userAgent - * @memberof google.cloud.recaptchaenterprise.v1.Event + * Assessment riskAnalysis. + * @member {google.cloud.recaptchaenterprise.v1.IRiskAnalysis|null|undefined} riskAnalysis + * @memberof google.cloud.recaptchaenterprise.v1.Assessment * @instance */ - Event.prototype.userAgent = ""; + Assessment.prototype.riskAnalysis = null; /** - * Event userIpAddress. - * @member {string} userIpAddress - * @memberof google.cloud.recaptchaenterprise.v1.Event + * Assessment tokenProperties. + * @member {google.cloud.recaptchaenterprise.v1.ITokenProperties|null|undefined} tokenProperties + * @memberof google.cloud.recaptchaenterprise.v1.Assessment * @instance */ - Event.prototype.userIpAddress = ""; + Assessment.prototype.tokenProperties = null; /** - * Event expectedAction. - * @member {string} expectedAction - * @memberof google.cloud.recaptchaenterprise.v1.Event + * Assessment accountDefenderAssessment. + * @member {google.cloud.recaptchaenterprise.v1.IAccountDefenderAssessment|null|undefined} accountDefenderAssessment + * @memberof google.cloud.recaptchaenterprise.v1.Assessment * @instance */ - Event.prototype.expectedAction = ""; + Assessment.prototype.accountDefenderAssessment = null; /** - * Event hashedAccountId. - * @member {Uint8Array} hashedAccountId - * @memberof google.cloud.recaptchaenterprise.v1.Event + * Assessment privatePasswordLeakVerification. + * @member {google.cloud.recaptchaenterprise.v1.IPrivatePasswordLeakVerification|null|undefined} privatePasswordLeakVerification + * @memberof google.cloud.recaptchaenterprise.v1.Assessment * @instance */ - Event.prototype.hashedAccountId = $util.newBuffer([]); + Assessment.prototype.privatePasswordLeakVerification = null; /** - * Creates a new Event instance using the specified properties. + * Creates a new Assessment instance using the specified properties. * @function create - * @memberof google.cloud.recaptchaenterprise.v1.Event + * @memberof google.cloud.recaptchaenterprise.v1.Assessment * @static - * @param {google.cloud.recaptchaenterprise.v1.IEvent=} [properties] Properties to set - * @returns {google.cloud.recaptchaenterprise.v1.Event} Event instance + * @param {google.cloud.recaptchaenterprise.v1.IAssessment=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.Assessment} Assessment instance */ - Event.create = function create(properties) { - return new Event(properties); + Assessment.create = function create(properties) { + return new Assessment(properties); }; /** - * Encodes the specified Event message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.Event.verify|verify} messages. + * Encodes the specified Assessment message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.Assessment.verify|verify} messages. * @function encode - * @memberof google.cloud.recaptchaenterprise.v1.Event + * @memberof google.cloud.recaptchaenterprise.v1.Assessment * @static - * @param {google.cloud.recaptchaenterprise.v1.IEvent} message Event message or plain object to encode + * @param {google.cloud.recaptchaenterprise.v1.IAssessment} message Assessment message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Event.encode = function encode(message, writer) { + Assessment.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.token != null && Object.hasOwnProperty.call(message, "token")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.token); - if (message.siteKey != null && Object.hasOwnProperty.call(message, "siteKey")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.siteKey); - if (message.userAgent != null && Object.hasOwnProperty.call(message, "userAgent")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.userAgent); - if (message.userIpAddress != null && Object.hasOwnProperty.call(message, "userIpAddress")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.userIpAddress); - if (message.expectedAction != null && Object.hasOwnProperty.call(message, "expectedAction")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.expectedAction); - if (message.hashedAccountId != null && Object.hasOwnProperty.call(message, "hashedAccountId")) - writer.uint32(/* id 6, wireType 2 =*/50).bytes(message.hashedAccountId); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.event != null && Object.hasOwnProperty.call(message, "event")) + $root.google.cloud.recaptchaenterprise.v1.Event.encode(message.event, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.riskAnalysis != null && Object.hasOwnProperty.call(message, "riskAnalysis")) + $root.google.cloud.recaptchaenterprise.v1.RiskAnalysis.encode(message.riskAnalysis, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.tokenProperties != null && Object.hasOwnProperty.call(message, "tokenProperties")) + $root.google.cloud.recaptchaenterprise.v1.TokenProperties.encode(message.tokenProperties, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.accountDefenderAssessment != null && Object.hasOwnProperty.call(message, "accountDefenderAssessment")) + $root.google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment.encode(message.accountDefenderAssessment, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.privatePasswordLeakVerification != null && Object.hasOwnProperty.call(message, "privatePasswordLeakVerification")) + $root.google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification.encode(message.privatePasswordLeakVerification, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); return writer; }; /** - * Encodes the specified Event message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.Event.verify|verify} messages. + * Encodes the specified Assessment message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.Assessment.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.recaptchaenterprise.v1.Event + * @memberof google.cloud.recaptchaenterprise.v1.Assessment * @static - * @param {google.cloud.recaptchaenterprise.v1.IEvent} message Event message or plain object to encode + * @param {google.cloud.recaptchaenterprise.v1.IAssessment} message Assessment message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Event.encodeDelimited = function encodeDelimited(message, writer) { + Assessment.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an Event message from the specified reader or buffer. + * Decodes an Assessment message from the specified reader or buffer. * @function decode - * @memberof google.cloud.recaptchaenterprise.v1.Event + * @memberof google.cloud.recaptchaenterprise.v1.Assessment * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.recaptchaenterprise.v1.Event} Event + * @returns {google.cloud.recaptchaenterprise.v1.Assessment} Assessment * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Event.decode = function decode(reader, length) { + Assessment.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.Event(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.Assessment(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - message.token = reader.string(); + message.name = reader.string(); break; } case 2: { - message.siteKey = reader.string(); + message.event = $root.google.cloud.recaptchaenterprise.v1.Event.decode(reader, reader.uint32()); break; } case 3: { - message.userAgent = reader.string(); + message.riskAnalysis = $root.google.cloud.recaptchaenterprise.v1.RiskAnalysis.decode(reader, reader.uint32()); break; } case 4: { - message.userIpAddress = reader.string(); + message.tokenProperties = $root.google.cloud.recaptchaenterprise.v1.TokenProperties.decode(reader, reader.uint32()); break; } - case 5: { - message.expectedAction = reader.string(); + case 6: { + message.accountDefenderAssessment = $root.google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment.decode(reader, reader.uint32()); break; } - case 6: { - message.hashedAccountId = reader.bytes(); + case 8: { + message.privatePasswordLeakVerification = $root.google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification.decode(reader, reader.uint32()); break; } default: @@ -1868,174 +1912,193 @@ }; /** - * Decodes an Event message from the specified reader or buffer, length delimited. + * Decodes an Assessment message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.recaptchaenterprise.v1.Event + * @memberof google.cloud.recaptchaenterprise.v1.Assessment * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.recaptchaenterprise.v1.Event} Event + * @returns {google.cloud.recaptchaenterprise.v1.Assessment} Assessment * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Event.decodeDelimited = function decodeDelimited(reader) { + Assessment.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an Event message. + * Verifies an Assessment message. * @function verify - * @memberof google.cloud.recaptchaenterprise.v1.Event + * @memberof google.cloud.recaptchaenterprise.v1.Assessment * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Event.verify = function verify(message) { + Assessment.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.token != null && message.hasOwnProperty("token")) - if (!$util.isString(message.token)) - return "token: string expected"; - if (message.siteKey != null && message.hasOwnProperty("siteKey")) - if (!$util.isString(message.siteKey)) - return "siteKey: string expected"; - if (message.userAgent != null && message.hasOwnProperty("userAgent")) - if (!$util.isString(message.userAgent)) - return "userAgent: string expected"; - if (message.userIpAddress != null && message.hasOwnProperty("userIpAddress")) - if (!$util.isString(message.userIpAddress)) - return "userIpAddress: string expected"; - if (message.expectedAction != null && message.hasOwnProperty("expectedAction")) - if (!$util.isString(message.expectedAction)) - return "expectedAction: string expected"; - if (message.hashedAccountId != null && message.hasOwnProperty("hashedAccountId")) - if (!(message.hashedAccountId && typeof message.hashedAccountId.length === "number" || $util.isString(message.hashedAccountId))) - return "hashedAccountId: buffer expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.event != null && message.hasOwnProperty("event")) { + var error = $root.google.cloud.recaptchaenterprise.v1.Event.verify(message.event); + if (error) + return "event." + error; + } + if (message.riskAnalysis != null && message.hasOwnProperty("riskAnalysis")) { + var error = $root.google.cloud.recaptchaenterprise.v1.RiskAnalysis.verify(message.riskAnalysis); + if (error) + return "riskAnalysis." + error; + } + if (message.tokenProperties != null && message.hasOwnProperty("tokenProperties")) { + var error = $root.google.cloud.recaptchaenterprise.v1.TokenProperties.verify(message.tokenProperties); + if (error) + return "tokenProperties." + error; + } + if (message.accountDefenderAssessment != null && message.hasOwnProperty("accountDefenderAssessment")) { + var error = $root.google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment.verify(message.accountDefenderAssessment); + if (error) + return "accountDefenderAssessment." + error; + } + if (message.privatePasswordLeakVerification != null && message.hasOwnProperty("privatePasswordLeakVerification")) { + var error = $root.google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification.verify(message.privatePasswordLeakVerification); + if (error) + return "privatePasswordLeakVerification." + error; + } return null; }; /** - * Creates an Event message from a plain object. Also converts values to their respective internal types. + * Creates an Assessment message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.recaptchaenterprise.v1.Event + * @memberof google.cloud.recaptchaenterprise.v1.Assessment * @static * @param {Object.} object Plain object - * @returns {google.cloud.recaptchaenterprise.v1.Event} Event + * @returns {google.cloud.recaptchaenterprise.v1.Assessment} Assessment */ - Event.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.recaptchaenterprise.v1.Event) + Assessment.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.Assessment) return object; - var message = new $root.google.cloud.recaptchaenterprise.v1.Event(); - if (object.token != null) - message.token = String(object.token); - if (object.siteKey != null) - message.siteKey = String(object.siteKey); - if (object.userAgent != null) - message.userAgent = String(object.userAgent); - if (object.userIpAddress != null) - message.userIpAddress = String(object.userIpAddress); - if (object.expectedAction != null) - message.expectedAction = String(object.expectedAction); - if (object.hashedAccountId != null) - if (typeof object.hashedAccountId === "string") - $util.base64.decode(object.hashedAccountId, message.hashedAccountId = $util.newBuffer($util.base64.length(object.hashedAccountId)), 0); - else if (object.hashedAccountId.length >= 0) - message.hashedAccountId = object.hashedAccountId; + var message = new $root.google.cloud.recaptchaenterprise.v1.Assessment(); + if (object.name != null) + message.name = String(object.name); + if (object.event != null) { + if (typeof object.event !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1.Assessment.event: object expected"); + message.event = $root.google.cloud.recaptchaenterprise.v1.Event.fromObject(object.event); + } + if (object.riskAnalysis != null) { + if (typeof object.riskAnalysis !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1.Assessment.riskAnalysis: object expected"); + message.riskAnalysis = $root.google.cloud.recaptchaenterprise.v1.RiskAnalysis.fromObject(object.riskAnalysis); + } + if (object.tokenProperties != null) { + if (typeof object.tokenProperties !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1.Assessment.tokenProperties: object expected"); + message.tokenProperties = $root.google.cloud.recaptchaenterprise.v1.TokenProperties.fromObject(object.tokenProperties); + } + if (object.accountDefenderAssessment != null) { + if (typeof object.accountDefenderAssessment !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1.Assessment.accountDefenderAssessment: object expected"); + message.accountDefenderAssessment = $root.google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment.fromObject(object.accountDefenderAssessment); + } + if (object.privatePasswordLeakVerification != null) { + if (typeof object.privatePasswordLeakVerification !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1.Assessment.privatePasswordLeakVerification: object expected"); + message.privatePasswordLeakVerification = $root.google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification.fromObject(object.privatePasswordLeakVerification); + } return message; }; /** - * Creates a plain object from an Event message. Also converts values to other types if specified. + * Creates a plain object from an Assessment message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.recaptchaenterprise.v1.Event + * @memberof google.cloud.recaptchaenterprise.v1.Assessment * @static - * @param {google.cloud.recaptchaenterprise.v1.Event} message Event + * @param {google.cloud.recaptchaenterprise.v1.Assessment} message Assessment * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Event.toObject = function toObject(message, options) { + Assessment.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.token = ""; - object.siteKey = ""; - object.userAgent = ""; - object.userIpAddress = ""; - object.expectedAction = ""; - if (options.bytes === String) - object.hashedAccountId = ""; - else { - object.hashedAccountId = []; - if (options.bytes !== Array) - object.hashedAccountId = $util.newBuffer(object.hashedAccountId); - } + object.name = ""; + object.event = null; + object.riskAnalysis = null; + object.tokenProperties = null; + object.accountDefenderAssessment = null; + object.privatePasswordLeakVerification = null; } - if (message.token != null && message.hasOwnProperty("token")) - object.token = message.token; - if (message.siteKey != null && message.hasOwnProperty("siteKey")) - object.siteKey = message.siteKey; - if (message.userAgent != null && message.hasOwnProperty("userAgent")) - object.userAgent = message.userAgent; - if (message.userIpAddress != null && message.hasOwnProperty("userIpAddress")) - object.userIpAddress = message.userIpAddress; - if (message.expectedAction != null && message.hasOwnProperty("expectedAction")) - object.expectedAction = message.expectedAction; - if (message.hashedAccountId != null && message.hasOwnProperty("hashedAccountId")) - object.hashedAccountId = options.bytes === String ? $util.base64.encode(message.hashedAccountId, 0, message.hashedAccountId.length) : options.bytes === Array ? Array.prototype.slice.call(message.hashedAccountId) : message.hashedAccountId; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.event != null && message.hasOwnProperty("event")) + object.event = $root.google.cloud.recaptchaenterprise.v1.Event.toObject(message.event, options); + if (message.riskAnalysis != null && message.hasOwnProperty("riskAnalysis")) + object.riskAnalysis = $root.google.cloud.recaptchaenterprise.v1.RiskAnalysis.toObject(message.riskAnalysis, options); + if (message.tokenProperties != null && message.hasOwnProperty("tokenProperties")) + object.tokenProperties = $root.google.cloud.recaptchaenterprise.v1.TokenProperties.toObject(message.tokenProperties, options); + if (message.accountDefenderAssessment != null && message.hasOwnProperty("accountDefenderAssessment")) + object.accountDefenderAssessment = $root.google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment.toObject(message.accountDefenderAssessment, options); + if (message.privatePasswordLeakVerification != null && message.hasOwnProperty("privatePasswordLeakVerification")) + object.privatePasswordLeakVerification = $root.google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification.toObject(message.privatePasswordLeakVerification, options); return object; }; /** - * Converts this Event to JSON. + * Converts this Assessment to JSON. * @function toJSON - * @memberof google.cloud.recaptchaenterprise.v1.Event + * @memberof google.cloud.recaptchaenterprise.v1.Assessment * @instance * @returns {Object.} JSON object */ - Event.prototype.toJSON = function toJSON() { + Assessment.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for Event + * Gets the default type url for Assessment * @function getTypeUrl - * @memberof google.cloud.recaptchaenterprise.v1.Event + * @memberof google.cloud.recaptchaenterprise.v1.Assessment * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - Event.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + Assessment.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1.Event"; + return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1.Assessment"; }; - return Event; + return Assessment; })(); - v1.RiskAnalysis = (function() { + v1.Event = (function() { /** - * Properties of a RiskAnalysis. + * Properties of an Event. * @memberof google.cloud.recaptchaenterprise.v1 - * @interface IRiskAnalysis - * @property {number|null} [score] RiskAnalysis score - * @property {Array.|null} [reasons] RiskAnalysis reasons + * @interface IEvent + * @property {string|null} [token] Event token + * @property {string|null} [siteKey] Event siteKey + * @property {string|null} [userAgent] Event userAgent + * @property {string|null} [userIpAddress] Event userIpAddress + * @property {string|null} [expectedAction] Event expectedAction + * @property {Uint8Array|null} [hashedAccountId] Event hashedAccountId */ /** - * Constructs a new RiskAnalysis. + * Constructs a new Event. * @memberof google.cloud.recaptchaenterprise.v1 - * @classdesc Represents a RiskAnalysis. - * @implements IRiskAnalysis + * @classdesc Represents an Event. + * @implements IEvent * @constructor - * @param {google.cloud.recaptchaenterprise.v1.IRiskAnalysis=} [properties] Properties to set + * @param {google.cloud.recaptchaenterprise.v1.IEvent=} [properties] Properties to set */ - function RiskAnalysis(properties) { - this.reasons = []; + function Event(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -2043,100 +2106,145 @@ } /** - * RiskAnalysis score. - * @member {number} score - * @memberof google.cloud.recaptchaenterprise.v1.RiskAnalysis + * Event token. + * @member {string} token + * @memberof google.cloud.recaptchaenterprise.v1.Event * @instance */ - RiskAnalysis.prototype.score = 0; + Event.prototype.token = ""; /** - * RiskAnalysis reasons. - * @member {Array.} reasons - * @memberof google.cloud.recaptchaenterprise.v1.RiskAnalysis + * Event siteKey. + * @member {string} siteKey + * @memberof google.cloud.recaptchaenterprise.v1.Event * @instance */ - RiskAnalysis.prototype.reasons = $util.emptyArray; + Event.prototype.siteKey = ""; /** - * Creates a new RiskAnalysis instance using the specified properties. - * @function create - * @memberof google.cloud.recaptchaenterprise.v1.RiskAnalysis - * @static - * @param {google.cloud.recaptchaenterprise.v1.IRiskAnalysis=} [properties] Properties to set - * @returns {google.cloud.recaptchaenterprise.v1.RiskAnalysis} RiskAnalysis instance + * Event userAgent. + * @member {string} userAgent + * @memberof google.cloud.recaptchaenterprise.v1.Event + * @instance */ - RiskAnalysis.create = function create(properties) { - return new RiskAnalysis(properties); - }; + Event.prototype.userAgent = ""; /** - * Encodes the specified RiskAnalysis message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.RiskAnalysis.verify|verify} messages. - * @function encode - * @memberof google.cloud.recaptchaenterprise.v1.RiskAnalysis - * @static - * @param {google.cloud.recaptchaenterprise.v1.IRiskAnalysis} message RiskAnalysis message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RiskAnalysis.encode = function encode(message, writer) { + * Event userIpAddress. + * @member {string} userIpAddress + * @memberof google.cloud.recaptchaenterprise.v1.Event + * @instance + */ + Event.prototype.userIpAddress = ""; + + /** + * Event expectedAction. + * @member {string} expectedAction + * @memberof google.cloud.recaptchaenterprise.v1.Event + * @instance + */ + Event.prototype.expectedAction = ""; + + /** + * Event hashedAccountId. + * @member {Uint8Array} hashedAccountId + * @memberof google.cloud.recaptchaenterprise.v1.Event + * @instance + */ + Event.prototype.hashedAccountId = $util.newBuffer([]); + + /** + * Creates a new Event instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.Event + * @static + * @param {google.cloud.recaptchaenterprise.v1.IEvent=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.Event} Event instance + */ + Event.create = function create(properties) { + return new Event(properties); + }; + + /** + * Encodes the specified Event message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.Event.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1.Event + * @static + * @param {google.cloud.recaptchaenterprise.v1.IEvent} message Event message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Event.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.score != null && Object.hasOwnProperty.call(message, "score")) - writer.uint32(/* id 1, wireType 5 =*/13).float(message.score); - if (message.reasons != null && message.reasons.length) { - writer.uint32(/* id 2, wireType 2 =*/18).fork(); - for (var i = 0; i < message.reasons.length; ++i) - writer.int32(message.reasons[i]); - writer.ldelim(); - } + if (message.token != null && Object.hasOwnProperty.call(message, "token")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.token); + if (message.siteKey != null && Object.hasOwnProperty.call(message, "siteKey")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.siteKey); + if (message.userAgent != null && Object.hasOwnProperty.call(message, "userAgent")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.userAgent); + if (message.userIpAddress != null && Object.hasOwnProperty.call(message, "userIpAddress")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.userIpAddress); + if (message.expectedAction != null && Object.hasOwnProperty.call(message, "expectedAction")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.expectedAction); + if (message.hashedAccountId != null && Object.hasOwnProperty.call(message, "hashedAccountId")) + writer.uint32(/* id 6, wireType 2 =*/50).bytes(message.hashedAccountId); return writer; }; /** - * Encodes the specified RiskAnalysis message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.RiskAnalysis.verify|verify} messages. + * Encodes the specified Event message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.Event.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.recaptchaenterprise.v1.RiskAnalysis + * @memberof google.cloud.recaptchaenterprise.v1.Event * @static - * @param {google.cloud.recaptchaenterprise.v1.IRiskAnalysis} message RiskAnalysis message or plain object to encode + * @param {google.cloud.recaptchaenterprise.v1.IEvent} message Event message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RiskAnalysis.encodeDelimited = function encodeDelimited(message, writer) { + Event.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a RiskAnalysis message from the specified reader or buffer. + * Decodes an Event message from the specified reader or buffer. * @function decode - * @memberof google.cloud.recaptchaenterprise.v1.RiskAnalysis + * @memberof google.cloud.recaptchaenterprise.v1.Event * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.recaptchaenterprise.v1.RiskAnalysis} RiskAnalysis + * @returns {google.cloud.recaptchaenterprise.v1.Event} Event * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RiskAnalysis.decode = function decode(reader, length) { + Event.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.RiskAnalysis(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.Event(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - message.score = reader.float(); + message.token = reader.string(); break; } case 2: { - if (!(message.reasons && message.reasons.length)) - message.reasons = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.reasons.push(reader.int32()); - } else - message.reasons.push(reader.int32()); + message.siteKey = reader.string(); + break; + } + case 3: { + message.userAgent = reader.string(); + break; + } + case 4: { + message.userIpAddress = reader.string(); + break; + } + case 5: { + message.expectedAction = reader.string(); + break; + } + case 6: { + message.hashedAccountId = reader.bytes(); break; } default: @@ -2148,204 +2256,174 @@ }; /** - * Decodes a RiskAnalysis message from the specified reader or buffer, length delimited. + * Decodes an Event message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.recaptchaenterprise.v1.RiskAnalysis + * @memberof google.cloud.recaptchaenterprise.v1.Event * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.recaptchaenterprise.v1.RiskAnalysis} RiskAnalysis + * @returns {google.cloud.recaptchaenterprise.v1.Event} Event * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RiskAnalysis.decodeDelimited = function decodeDelimited(reader) { + Event.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a RiskAnalysis message. + * Verifies an Event message. * @function verify - * @memberof google.cloud.recaptchaenterprise.v1.RiskAnalysis + * @memberof google.cloud.recaptchaenterprise.v1.Event * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - RiskAnalysis.verify = function verify(message) { + Event.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.score != null && message.hasOwnProperty("score")) - if (typeof message.score !== "number") - return "score: number expected"; - if (message.reasons != null && message.hasOwnProperty("reasons")) { - if (!Array.isArray(message.reasons)) - return "reasons: array expected"; - for (var i = 0; i < message.reasons.length; ++i) - switch (message.reasons[i]) { - default: - return "reasons: enum value[] expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; - } - } + if (message.token != null && message.hasOwnProperty("token")) + if (!$util.isString(message.token)) + return "token: string expected"; + if (message.siteKey != null && message.hasOwnProperty("siteKey")) + if (!$util.isString(message.siteKey)) + return "siteKey: string expected"; + if (message.userAgent != null && message.hasOwnProperty("userAgent")) + if (!$util.isString(message.userAgent)) + return "userAgent: string expected"; + if (message.userIpAddress != null && message.hasOwnProperty("userIpAddress")) + if (!$util.isString(message.userIpAddress)) + return "userIpAddress: string expected"; + if (message.expectedAction != null && message.hasOwnProperty("expectedAction")) + if (!$util.isString(message.expectedAction)) + return "expectedAction: string expected"; + if (message.hashedAccountId != null && message.hasOwnProperty("hashedAccountId")) + if (!(message.hashedAccountId && typeof message.hashedAccountId.length === "number" || $util.isString(message.hashedAccountId))) + return "hashedAccountId: buffer expected"; return null; }; /** - * Creates a RiskAnalysis message from a plain object. Also converts values to their respective internal types. + * Creates an Event message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.recaptchaenterprise.v1.RiskAnalysis + * @memberof google.cloud.recaptchaenterprise.v1.Event * @static * @param {Object.} object Plain object - * @returns {google.cloud.recaptchaenterprise.v1.RiskAnalysis} RiskAnalysis + * @returns {google.cloud.recaptchaenterprise.v1.Event} Event */ - RiskAnalysis.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.recaptchaenterprise.v1.RiskAnalysis) + Event.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.Event) return object; - var message = new $root.google.cloud.recaptchaenterprise.v1.RiskAnalysis(); - if (object.score != null) - message.score = Number(object.score); - if (object.reasons) { - if (!Array.isArray(object.reasons)) - throw TypeError(".google.cloud.recaptchaenterprise.v1.RiskAnalysis.reasons: array expected"); - message.reasons = []; - for (var i = 0; i < object.reasons.length; ++i) - switch (object.reasons[i]) { - default: - case "CLASSIFICATION_REASON_UNSPECIFIED": - case 0: - message.reasons[i] = 0; - break; - case "AUTOMATION": - case 1: - message.reasons[i] = 1; - break; - case "UNEXPECTED_ENVIRONMENT": - case 2: - message.reasons[i] = 2; - break; - case "TOO_MUCH_TRAFFIC": - case 3: - message.reasons[i] = 3; - break; - case "UNEXPECTED_USAGE_PATTERNS": - case 4: - message.reasons[i] = 4; - break; - case "LOW_CONFIDENCE_SCORE": - case 5: - message.reasons[i] = 5; - break; - } - } + var message = new $root.google.cloud.recaptchaenterprise.v1.Event(); + if (object.token != null) + message.token = String(object.token); + if (object.siteKey != null) + message.siteKey = String(object.siteKey); + if (object.userAgent != null) + message.userAgent = String(object.userAgent); + if (object.userIpAddress != null) + message.userIpAddress = String(object.userIpAddress); + if (object.expectedAction != null) + message.expectedAction = String(object.expectedAction); + if (object.hashedAccountId != null) + if (typeof object.hashedAccountId === "string") + $util.base64.decode(object.hashedAccountId, message.hashedAccountId = $util.newBuffer($util.base64.length(object.hashedAccountId)), 0); + else if (object.hashedAccountId.length >= 0) + message.hashedAccountId = object.hashedAccountId; return message; }; /** - * Creates a plain object from a RiskAnalysis message. Also converts values to other types if specified. + * Creates a plain object from an Event message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.recaptchaenterprise.v1.RiskAnalysis + * @memberof google.cloud.recaptchaenterprise.v1.Event * @static - * @param {google.cloud.recaptchaenterprise.v1.RiskAnalysis} message RiskAnalysis + * @param {google.cloud.recaptchaenterprise.v1.Event} message Event * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - RiskAnalysis.toObject = function toObject(message, options) { + Event.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.reasons = []; - if (options.defaults) - object.score = 0; - if (message.score != null && message.hasOwnProperty("score")) - object.score = options.json && !isFinite(message.score) ? String(message.score) : message.score; - if (message.reasons && message.reasons.length) { - object.reasons = []; - for (var j = 0; j < message.reasons.length; ++j) - object.reasons[j] = options.enums === String ? $root.google.cloud.recaptchaenterprise.v1.RiskAnalysis.ClassificationReason[message.reasons[j]] : message.reasons[j]; + if (options.defaults) { + object.token = ""; + object.siteKey = ""; + object.userAgent = ""; + object.userIpAddress = ""; + object.expectedAction = ""; + if (options.bytes === String) + object.hashedAccountId = ""; + else { + object.hashedAccountId = []; + if (options.bytes !== Array) + object.hashedAccountId = $util.newBuffer(object.hashedAccountId); + } } - return object; - }; + if (message.token != null && message.hasOwnProperty("token")) + object.token = message.token; + if (message.siteKey != null && message.hasOwnProperty("siteKey")) + object.siteKey = message.siteKey; + if (message.userAgent != null && message.hasOwnProperty("userAgent")) + object.userAgent = message.userAgent; + if (message.userIpAddress != null && message.hasOwnProperty("userIpAddress")) + object.userIpAddress = message.userIpAddress; + if (message.expectedAction != null && message.hasOwnProperty("expectedAction")) + object.expectedAction = message.expectedAction; + if (message.hashedAccountId != null && message.hasOwnProperty("hashedAccountId")) + object.hashedAccountId = options.bytes === String ? $util.base64.encode(message.hashedAccountId, 0, message.hashedAccountId.length) : options.bytes === Array ? Array.prototype.slice.call(message.hashedAccountId) : message.hashedAccountId; + return object; + }; /** - * Converts this RiskAnalysis to JSON. + * Converts this Event to JSON. * @function toJSON - * @memberof google.cloud.recaptchaenterprise.v1.RiskAnalysis + * @memberof google.cloud.recaptchaenterprise.v1.Event * @instance * @returns {Object.} JSON object */ - RiskAnalysis.prototype.toJSON = function toJSON() { + Event.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for RiskAnalysis + * Gets the default type url for Event * @function getTypeUrl - * @memberof google.cloud.recaptchaenterprise.v1.RiskAnalysis + * @memberof google.cloud.recaptchaenterprise.v1.Event * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - RiskAnalysis.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + Event.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1.RiskAnalysis"; + return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1.Event"; }; - /** - * ClassificationReason enum. - * @name google.cloud.recaptchaenterprise.v1.RiskAnalysis.ClassificationReason - * @enum {number} - * @property {number} CLASSIFICATION_REASON_UNSPECIFIED=0 CLASSIFICATION_REASON_UNSPECIFIED value - * @property {number} AUTOMATION=1 AUTOMATION value - * @property {number} UNEXPECTED_ENVIRONMENT=2 UNEXPECTED_ENVIRONMENT value - * @property {number} TOO_MUCH_TRAFFIC=3 TOO_MUCH_TRAFFIC value - * @property {number} UNEXPECTED_USAGE_PATTERNS=4 UNEXPECTED_USAGE_PATTERNS value - * @property {number} LOW_CONFIDENCE_SCORE=5 LOW_CONFIDENCE_SCORE value - */ - RiskAnalysis.ClassificationReason = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "CLASSIFICATION_REASON_UNSPECIFIED"] = 0; - values[valuesById[1] = "AUTOMATION"] = 1; - values[valuesById[2] = "UNEXPECTED_ENVIRONMENT"] = 2; - values[valuesById[3] = "TOO_MUCH_TRAFFIC"] = 3; - values[valuesById[4] = "UNEXPECTED_USAGE_PATTERNS"] = 4; - values[valuesById[5] = "LOW_CONFIDENCE_SCORE"] = 5; - return values; - })(); - - return RiskAnalysis; + return Event; })(); - v1.TokenProperties = (function() { + v1.RiskAnalysis = (function() { /** - * Properties of a TokenProperties. + * Properties of a RiskAnalysis. * @memberof google.cloud.recaptchaenterprise.v1 - * @interface ITokenProperties - * @property {boolean|null} [valid] TokenProperties valid - * @property {google.cloud.recaptchaenterprise.v1.TokenProperties.InvalidReason|null} [invalidReason] TokenProperties invalidReason - * @property {google.protobuf.ITimestamp|null} [createTime] TokenProperties createTime - * @property {string|null} [hostname] TokenProperties hostname - * @property {string|null} [action] TokenProperties action + * @interface IRiskAnalysis + * @property {number|null} [score] RiskAnalysis score + * @property {Array.|null} [reasons] RiskAnalysis reasons */ /** - * Constructs a new TokenProperties. + * Constructs a new RiskAnalysis. * @memberof google.cloud.recaptchaenterprise.v1 - * @classdesc Represents a TokenProperties. - * @implements ITokenProperties + * @classdesc Represents a RiskAnalysis. + * @implements IRiskAnalysis * @constructor - * @param {google.cloud.recaptchaenterprise.v1.ITokenProperties=} [properties] Properties to set + * @param {google.cloud.recaptchaenterprise.v1.IRiskAnalysis=} [properties] Properties to set */ - function TokenProperties(properties) { + function RiskAnalysis(properties) { + this.reasons = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -2353,131 +2431,100 @@ } /** - * TokenProperties valid. - * @member {boolean} valid - * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties - * @instance - */ - TokenProperties.prototype.valid = false; - - /** - * TokenProperties invalidReason. - * @member {google.cloud.recaptchaenterprise.v1.TokenProperties.InvalidReason} invalidReason - * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties - * @instance - */ - TokenProperties.prototype.invalidReason = 0; - - /** - * TokenProperties createTime. - * @member {google.protobuf.ITimestamp|null|undefined} createTime - * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties - * @instance - */ - TokenProperties.prototype.createTime = null; - - /** - * TokenProperties hostname. - * @member {string} hostname - * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties + * RiskAnalysis score. + * @member {number} score + * @memberof google.cloud.recaptchaenterprise.v1.RiskAnalysis * @instance */ - TokenProperties.prototype.hostname = ""; + RiskAnalysis.prototype.score = 0; /** - * TokenProperties action. - * @member {string} action - * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties + * RiskAnalysis reasons. + * @member {Array.} reasons + * @memberof google.cloud.recaptchaenterprise.v1.RiskAnalysis * @instance */ - TokenProperties.prototype.action = ""; + RiskAnalysis.prototype.reasons = $util.emptyArray; /** - * Creates a new TokenProperties instance using the specified properties. + * Creates a new RiskAnalysis instance using the specified properties. * @function create - * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties + * @memberof google.cloud.recaptchaenterprise.v1.RiskAnalysis * @static - * @param {google.cloud.recaptchaenterprise.v1.ITokenProperties=} [properties] Properties to set - * @returns {google.cloud.recaptchaenterprise.v1.TokenProperties} TokenProperties instance + * @param {google.cloud.recaptchaenterprise.v1.IRiskAnalysis=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.RiskAnalysis} RiskAnalysis instance */ - TokenProperties.create = function create(properties) { - return new TokenProperties(properties); + RiskAnalysis.create = function create(properties) { + return new RiskAnalysis(properties); }; /** - * Encodes the specified TokenProperties message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.TokenProperties.verify|verify} messages. + * Encodes the specified RiskAnalysis message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.RiskAnalysis.verify|verify} messages. * @function encode - * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties + * @memberof google.cloud.recaptchaenterprise.v1.RiskAnalysis * @static - * @param {google.cloud.recaptchaenterprise.v1.ITokenProperties} message TokenProperties message or plain object to encode + * @param {google.cloud.recaptchaenterprise.v1.IRiskAnalysis} message RiskAnalysis message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - TokenProperties.encode = function encode(message, writer) { + RiskAnalysis.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.valid != null && Object.hasOwnProperty.call(message, "valid")) - writer.uint32(/* id 1, wireType 0 =*/8).bool(message.valid); - if (message.invalidReason != null && Object.hasOwnProperty.call(message, "invalidReason")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.invalidReason); - if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) - $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.hostname != null && Object.hasOwnProperty.call(message, "hostname")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.hostname); - if (message.action != null && Object.hasOwnProperty.call(message, "action")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.action); + if (message.score != null && Object.hasOwnProperty.call(message, "score")) + writer.uint32(/* id 1, wireType 5 =*/13).float(message.score); + if (message.reasons != null && message.reasons.length) { + writer.uint32(/* id 2, wireType 2 =*/18).fork(); + for (var i = 0; i < message.reasons.length; ++i) + writer.int32(message.reasons[i]); + writer.ldelim(); + } return writer; }; /** - * Encodes the specified TokenProperties message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.TokenProperties.verify|verify} messages. + * Encodes the specified RiskAnalysis message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.RiskAnalysis.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties + * @memberof google.cloud.recaptchaenterprise.v1.RiskAnalysis * @static - * @param {google.cloud.recaptchaenterprise.v1.ITokenProperties} message TokenProperties message or plain object to encode + * @param {google.cloud.recaptchaenterprise.v1.IRiskAnalysis} message RiskAnalysis message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - TokenProperties.encodeDelimited = function encodeDelimited(message, writer) { + RiskAnalysis.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a TokenProperties message from the specified reader or buffer. + * Decodes a RiskAnalysis message from the specified reader or buffer. * @function decode - * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties + * @memberof google.cloud.recaptchaenterprise.v1.RiskAnalysis * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.recaptchaenterprise.v1.TokenProperties} TokenProperties + * @returns {google.cloud.recaptchaenterprise.v1.RiskAnalysis} RiskAnalysis * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - TokenProperties.decode = function decode(reader, length) { + RiskAnalysis.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.TokenProperties(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.RiskAnalysis(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - message.valid = reader.bool(); + message.score = reader.float(); break; } case 2: { - message.invalidReason = reader.int32(); - break; - } - case 3: { - message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 4: { - message.hostname = reader.string(); - break; - } - case 5: { - message.action = reader.string(); + if (!(message.reasons && message.reasons.length)) + message.reasons = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.reasons.push(reader.int32()); + } else + message.reasons.push(reader.int32()); break; } default: @@ -2489,223 +2536,204 @@ }; /** - * Decodes a TokenProperties message from the specified reader or buffer, length delimited. + * Decodes a RiskAnalysis message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties + * @memberof google.cloud.recaptchaenterprise.v1.RiskAnalysis * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.recaptchaenterprise.v1.TokenProperties} TokenProperties + * @returns {google.cloud.recaptchaenterprise.v1.RiskAnalysis} RiskAnalysis * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - TokenProperties.decodeDelimited = function decodeDelimited(reader) { + RiskAnalysis.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a TokenProperties message. + * Verifies a RiskAnalysis message. * @function verify - * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties + * @memberof google.cloud.recaptchaenterprise.v1.RiskAnalysis * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - TokenProperties.verify = function verify(message) { + RiskAnalysis.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.valid != null && message.hasOwnProperty("valid")) - if (typeof message.valid !== "boolean") - return "valid: boolean expected"; - if (message.invalidReason != null && message.hasOwnProperty("invalidReason")) - switch (message.invalidReason) { - default: - return "invalidReason: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - break; - } - if (message.createTime != null && message.hasOwnProperty("createTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.createTime); - if (error) - return "createTime." + error; + if (message.score != null && message.hasOwnProperty("score")) + if (typeof message.score !== "number") + return "score: number expected"; + if (message.reasons != null && message.hasOwnProperty("reasons")) { + if (!Array.isArray(message.reasons)) + return "reasons: array expected"; + for (var i = 0; i < message.reasons.length; ++i) + switch (message.reasons[i]) { + default: + return "reasons: enum value[] expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } } - if (message.hostname != null && message.hasOwnProperty("hostname")) - if (!$util.isString(message.hostname)) - return "hostname: string expected"; - if (message.action != null && message.hasOwnProperty("action")) - if (!$util.isString(message.action)) - return "action: string expected"; return null; }; /** - * Creates a TokenProperties message from a plain object. Also converts values to their respective internal types. + * Creates a RiskAnalysis message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties + * @memberof google.cloud.recaptchaenterprise.v1.RiskAnalysis * @static * @param {Object.} object Plain object - * @returns {google.cloud.recaptchaenterprise.v1.TokenProperties} TokenProperties + * @returns {google.cloud.recaptchaenterprise.v1.RiskAnalysis} RiskAnalysis */ - TokenProperties.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.recaptchaenterprise.v1.TokenProperties) + RiskAnalysis.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.RiskAnalysis) return object; - var message = new $root.google.cloud.recaptchaenterprise.v1.TokenProperties(); - if (object.valid != null) - message.valid = Boolean(object.valid); - switch (object.invalidReason) { - case "INVALID_REASON_UNSPECIFIED": - case 0: - message.invalidReason = 0; - break; - case "UNKNOWN_INVALID_REASON": - case 1: - message.invalidReason = 1; - break; - case "MALFORMED": - case 2: - message.invalidReason = 2; - break; - case "EXPIRED": - case 3: - message.invalidReason = 3; - break; - case "DUPE": - case 4: - message.invalidReason = 4; - break; - case "MISSING": - case 5: - message.invalidReason = 5; - break; - case "BROWSER_ERROR": - case 6: - message.invalidReason = 6; - break; - } - if (object.createTime != null) { - if (typeof object.createTime !== "object") - throw TypeError(".google.cloud.recaptchaenterprise.v1.TokenProperties.createTime: object expected"); - message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + var message = new $root.google.cloud.recaptchaenterprise.v1.RiskAnalysis(); + if (object.score != null) + message.score = Number(object.score); + if (object.reasons) { + if (!Array.isArray(object.reasons)) + throw TypeError(".google.cloud.recaptchaenterprise.v1.RiskAnalysis.reasons: array expected"); + message.reasons = []; + for (var i = 0; i < object.reasons.length; ++i) + switch (object.reasons[i]) { + default: + case "CLASSIFICATION_REASON_UNSPECIFIED": + case 0: + message.reasons[i] = 0; + break; + case "AUTOMATION": + case 1: + message.reasons[i] = 1; + break; + case "UNEXPECTED_ENVIRONMENT": + case 2: + message.reasons[i] = 2; + break; + case "TOO_MUCH_TRAFFIC": + case 3: + message.reasons[i] = 3; + break; + case "UNEXPECTED_USAGE_PATTERNS": + case 4: + message.reasons[i] = 4; + break; + case "LOW_CONFIDENCE_SCORE": + case 5: + message.reasons[i] = 5; + break; + } } - if (object.hostname != null) - message.hostname = String(object.hostname); - if (object.action != null) - message.action = String(object.action); return message; }; /** - * Creates a plain object from a TokenProperties message. Also converts values to other types if specified. + * Creates a plain object from a RiskAnalysis message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties + * @memberof google.cloud.recaptchaenterprise.v1.RiskAnalysis * @static - * @param {google.cloud.recaptchaenterprise.v1.TokenProperties} message TokenProperties + * @param {google.cloud.recaptchaenterprise.v1.RiskAnalysis} message RiskAnalysis * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - TokenProperties.toObject = function toObject(message, options) { + RiskAnalysis.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.valid = false; - object.invalidReason = options.enums === String ? "INVALID_REASON_UNSPECIFIED" : 0; - object.createTime = null; - object.hostname = ""; - object.action = ""; + if (options.arrays || options.defaults) + object.reasons = []; + if (options.defaults) + object.score = 0; + if (message.score != null && message.hasOwnProperty("score")) + object.score = options.json && !isFinite(message.score) ? String(message.score) : message.score; + if (message.reasons && message.reasons.length) { + object.reasons = []; + for (var j = 0; j < message.reasons.length; ++j) + object.reasons[j] = options.enums === String ? $root.google.cloud.recaptchaenterprise.v1.RiskAnalysis.ClassificationReason[message.reasons[j]] : message.reasons[j]; } - if (message.valid != null && message.hasOwnProperty("valid")) - object.valid = message.valid; - if (message.invalidReason != null && message.hasOwnProperty("invalidReason")) - object.invalidReason = options.enums === String ? $root.google.cloud.recaptchaenterprise.v1.TokenProperties.InvalidReason[message.invalidReason] : message.invalidReason; - if (message.createTime != null && message.hasOwnProperty("createTime")) - object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); - if (message.hostname != null && message.hasOwnProperty("hostname")) - object.hostname = message.hostname; - if (message.action != null && message.hasOwnProperty("action")) - object.action = message.action; return object; }; /** - * Converts this TokenProperties to JSON. + * Converts this RiskAnalysis to JSON. * @function toJSON - * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties + * @memberof google.cloud.recaptchaenterprise.v1.RiskAnalysis * @instance * @returns {Object.} JSON object */ - TokenProperties.prototype.toJSON = function toJSON() { + RiskAnalysis.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for TokenProperties + * Gets the default type url for RiskAnalysis * @function getTypeUrl - * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties + * @memberof google.cloud.recaptchaenterprise.v1.RiskAnalysis * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - TokenProperties.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + RiskAnalysis.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1.TokenProperties"; + return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1.RiskAnalysis"; }; /** - * InvalidReason enum. - * @name google.cloud.recaptchaenterprise.v1.TokenProperties.InvalidReason + * ClassificationReason enum. + * @name google.cloud.recaptchaenterprise.v1.RiskAnalysis.ClassificationReason * @enum {number} - * @property {number} INVALID_REASON_UNSPECIFIED=0 INVALID_REASON_UNSPECIFIED value - * @property {number} UNKNOWN_INVALID_REASON=1 UNKNOWN_INVALID_REASON value - * @property {number} MALFORMED=2 MALFORMED value - * @property {number} EXPIRED=3 EXPIRED value - * @property {number} DUPE=4 DUPE value - * @property {number} MISSING=5 MISSING value - * @property {number} BROWSER_ERROR=6 BROWSER_ERROR value + * @property {number} CLASSIFICATION_REASON_UNSPECIFIED=0 CLASSIFICATION_REASON_UNSPECIFIED value + * @property {number} AUTOMATION=1 AUTOMATION value + * @property {number} UNEXPECTED_ENVIRONMENT=2 UNEXPECTED_ENVIRONMENT value + * @property {number} TOO_MUCH_TRAFFIC=3 TOO_MUCH_TRAFFIC value + * @property {number} UNEXPECTED_USAGE_PATTERNS=4 UNEXPECTED_USAGE_PATTERNS value + * @property {number} LOW_CONFIDENCE_SCORE=5 LOW_CONFIDENCE_SCORE value */ - TokenProperties.InvalidReason = (function() { + RiskAnalysis.ClassificationReason = (function() { var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "INVALID_REASON_UNSPECIFIED"] = 0; - values[valuesById[1] = "UNKNOWN_INVALID_REASON"] = 1; - values[valuesById[2] = "MALFORMED"] = 2; - values[valuesById[3] = "EXPIRED"] = 3; - values[valuesById[4] = "DUPE"] = 4; - values[valuesById[5] = "MISSING"] = 5; - values[valuesById[6] = "BROWSER_ERROR"] = 6; + values[valuesById[0] = "CLASSIFICATION_REASON_UNSPECIFIED"] = 0; + values[valuesById[1] = "AUTOMATION"] = 1; + values[valuesById[2] = "UNEXPECTED_ENVIRONMENT"] = 2; + values[valuesById[3] = "TOO_MUCH_TRAFFIC"] = 3; + values[valuesById[4] = "UNEXPECTED_USAGE_PATTERNS"] = 4; + values[valuesById[5] = "LOW_CONFIDENCE_SCORE"] = 5; return values; })(); - return TokenProperties; + return RiskAnalysis; })(); - v1.AccountDefenderAssessment = (function() { + v1.TokenProperties = (function() { /** - * Properties of an AccountDefenderAssessment. + * Properties of a TokenProperties. * @memberof google.cloud.recaptchaenterprise.v1 - * @interface IAccountDefenderAssessment - * @property {Array.|null} [labels] AccountDefenderAssessment labels + * @interface ITokenProperties + * @property {boolean|null} [valid] TokenProperties valid + * @property {google.cloud.recaptchaenterprise.v1.TokenProperties.InvalidReason|null} [invalidReason] TokenProperties invalidReason + * @property {google.protobuf.ITimestamp|null} [createTime] TokenProperties createTime + * @property {string|null} [hostname] TokenProperties hostname + * @property {string|null} [action] TokenProperties action */ /** - * Constructs a new AccountDefenderAssessment. + * Constructs a new TokenProperties. * @memberof google.cloud.recaptchaenterprise.v1 - * @classdesc Represents an AccountDefenderAssessment. - * @implements IAccountDefenderAssessment + * @classdesc Represents a TokenProperties. + * @implements ITokenProperties * @constructor - * @param {google.cloud.recaptchaenterprise.v1.IAccountDefenderAssessment=} [properties] Properties to set + * @param {google.cloud.recaptchaenterprise.v1.ITokenProperties=} [properties] Properties to set */ - function AccountDefenderAssessment(properties) { - this.labels = []; + function TokenProperties(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -2713,86 +2741,131 @@ } /** - * AccountDefenderAssessment labels. - * @member {Array.} labels - * @memberof google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment + * TokenProperties valid. + * @member {boolean} valid + * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties * @instance */ - AccountDefenderAssessment.prototype.labels = $util.emptyArray; + TokenProperties.prototype.valid = false; /** - * Creates a new AccountDefenderAssessment instance using the specified properties. + * TokenProperties invalidReason. + * @member {google.cloud.recaptchaenterprise.v1.TokenProperties.InvalidReason} invalidReason + * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties + * @instance + */ + TokenProperties.prototype.invalidReason = 0; + + /** + * TokenProperties createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties + * @instance + */ + TokenProperties.prototype.createTime = null; + + /** + * TokenProperties hostname. + * @member {string} hostname + * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties + * @instance + */ + TokenProperties.prototype.hostname = ""; + + /** + * TokenProperties action. + * @member {string} action + * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties + * @instance + */ + TokenProperties.prototype.action = ""; + + /** + * Creates a new TokenProperties instance using the specified properties. * @function create - * @memberof google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment + * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties * @static - * @param {google.cloud.recaptchaenterprise.v1.IAccountDefenderAssessment=} [properties] Properties to set - * @returns {google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment} AccountDefenderAssessment instance + * @param {google.cloud.recaptchaenterprise.v1.ITokenProperties=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.TokenProperties} TokenProperties instance */ - AccountDefenderAssessment.create = function create(properties) { - return new AccountDefenderAssessment(properties); + TokenProperties.create = function create(properties) { + return new TokenProperties(properties); }; /** - * Encodes the specified AccountDefenderAssessment message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment.verify|verify} messages. + * Encodes the specified TokenProperties message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.TokenProperties.verify|verify} messages. * @function encode - * @memberof google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment + * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties * @static - * @param {google.cloud.recaptchaenterprise.v1.IAccountDefenderAssessment} message AccountDefenderAssessment message or plain object to encode + * @param {google.cloud.recaptchaenterprise.v1.ITokenProperties} message TokenProperties message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AccountDefenderAssessment.encode = function encode(message, writer) { + TokenProperties.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.labels != null && message.labels.length) { - writer.uint32(/* id 1, wireType 2 =*/10).fork(); - for (var i = 0; i < message.labels.length; ++i) - writer.int32(message.labels[i]); - writer.ldelim(); - } + if (message.valid != null && Object.hasOwnProperty.call(message, "valid")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.valid); + if (message.invalidReason != null && Object.hasOwnProperty.call(message, "invalidReason")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.invalidReason); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.hostname != null && Object.hasOwnProperty.call(message, "hostname")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.hostname); + if (message.action != null && Object.hasOwnProperty.call(message, "action")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.action); return writer; }; /** - * Encodes the specified AccountDefenderAssessment message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment.verify|verify} messages. + * Encodes the specified TokenProperties message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.TokenProperties.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment + * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties * @static - * @param {google.cloud.recaptchaenterprise.v1.IAccountDefenderAssessment} message AccountDefenderAssessment message or plain object to encode + * @param {google.cloud.recaptchaenterprise.v1.ITokenProperties} message TokenProperties message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AccountDefenderAssessment.encodeDelimited = function encodeDelimited(message, writer) { + TokenProperties.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AccountDefenderAssessment message from the specified reader or buffer. + * Decodes a TokenProperties message from the specified reader or buffer. * @function decode - * @memberof google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment + * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment} AccountDefenderAssessment + * @returns {google.cloud.recaptchaenterprise.v1.TokenProperties} TokenProperties * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AccountDefenderAssessment.decode = function decode(reader, length) { + TokenProperties.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.TokenProperties(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - if (!(message.labels && message.labels.length)) - message.labels = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.labels.push(reader.int32()); - } else - message.labels.push(reader.int32()); + message.valid = reader.bool(); + break; + } + case 2: { + message.invalidReason = reader.int32(); + break; + } + case 3: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 4: { + message.hostname = reader.string(); + break; + } + case 5: { + message.action = reader.string(); break; } default: @@ -2804,188 +2877,223 @@ }; /** - * Decodes an AccountDefenderAssessment message from the specified reader or buffer, length delimited. + * Decodes a TokenProperties message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment + * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment} AccountDefenderAssessment + * @returns {google.cloud.recaptchaenterprise.v1.TokenProperties} TokenProperties * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AccountDefenderAssessment.decodeDelimited = function decodeDelimited(reader) { + TokenProperties.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an AccountDefenderAssessment message. + * Verifies a TokenProperties message. * @function verify - * @memberof google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment + * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AccountDefenderAssessment.verify = function verify(message) { + TokenProperties.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.labels != null && message.hasOwnProperty("labels")) { - if (!Array.isArray(message.labels)) - return "labels: array expected"; - for (var i = 0; i < message.labels.length; ++i) - switch (message.labels[i]) { - default: - return "labels: enum value[] expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - break; - } + if (message.valid != null && message.hasOwnProperty("valid")) + if (typeof message.valid !== "boolean") + return "valid: boolean expected"; + if (message.invalidReason != null && message.hasOwnProperty("invalidReason")) + switch (message.invalidReason) { + default: + return "invalidReason: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + break; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; } + if (message.hostname != null && message.hasOwnProperty("hostname")) + if (!$util.isString(message.hostname)) + return "hostname: string expected"; + if (message.action != null && message.hasOwnProperty("action")) + if (!$util.isString(message.action)) + return "action: string expected"; return null; }; /** - * Creates an AccountDefenderAssessment message from a plain object. Also converts values to their respective internal types. + * Creates a TokenProperties message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment + * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties * @static * @param {Object.} object Plain object - * @returns {google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment} AccountDefenderAssessment + * @returns {google.cloud.recaptchaenterprise.v1.TokenProperties} TokenProperties */ - AccountDefenderAssessment.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment) + TokenProperties.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.TokenProperties) return object; - var message = new $root.google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment(); - if (object.labels) { - if (!Array.isArray(object.labels)) - throw TypeError(".google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment.labels: array expected"); - message.labels = []; - for (var i = 0; i < object.labels.length; ++i) - switch (object.labels[i]) { - default: - case "ACCOUNT_DEFENDER_LABEL_UNSPECIFIED": - case 0: - message.labels[i] = 0; - break; - case "PROFILE_MATCH": - case 1: - message.labels[i] = 1; - break; - case "SUSPICIOUS_LOGIN_ACTIVITY": - case 2: - message.labels[i] = 2; - break; - case "SUSPICIOUS_ACCOUNT_CREATION": - case 3: - message.labels[i] = 3; - break; - case "RELATED_ACCOUNTS_NUMBER_HIGH": - case 4: - message.labels[i] = 4; - break; - } + var message = new $root.google.cloud.recaptchaenterprise.v1.TokenProperties(); + if (object.valid != null) + message.valid = Boolean(object.valid); + switch (object.invalidReason) { + case "INVALID_REASON_UNSPECIFIED": + case 0: + message.invalidReason = 0; + break; + case "UNKNOWN_INVALID_REASON": + case 1: + message.invalidReason = 1; + break; + case "MALFORMED": + case 2: + message.invalidReason = 2; + break; + case "EXPIRED": + case 3: + message.invalidReason = 3; + break; + case "DUPE": + case 4: + message.invalidReason = 4; + break; + case "MISSING": + case 5: + message.invalidReason = 5; + break; + case "BROWSER_ERROR": + case 6: + message.invalidReason = 6; + break; + } + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1.TokenProperties.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); } + if (object.hostname != null) + message.hostname = String(object.hostname); + if (object.action != null) + message.action = String(object.action); return message; }; /** - * Creates a plain object from an AccountDefenderAssessment message. Also converts values to other types if specified. + * Creates a plain object from a TokenProperties message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment + * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties * @static - * @param {google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment} message AccountDefenderAssessment + * @param {google.cloud.recaptchaenterprise.v1.TokenProperties} message TokenProperties * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AccountDefenderAssessment.toObject = function toObject(message, options) { + TokenProperties.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.labels = []; - if (message.labels && message.labels.length) { - object.labels = []; - for (var j = 0; j < message.labels.length; ++j) - object.labels[j] = options.enums === String ? $root.google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment.AccountDefenderLabel[message.labels[j]] : message.labels[j]; + if (options.defaults) { + object.valid = false; + object.invalidReason = options.enums === String ? "INVALID_REASON_UNSPECIFIED" : 0; + object.createTime = null; + object.hostname = ""; + object.action = ""; } + if (message.valid != null && message.hasOwnProperty("valid")) + object.valid = message.valid; + if (message.invalidReason != null && message.hasOwnProperty("invalidReason")) + object.invalidReason = options.enums === String ? $root.google.cloud.recaptchaenterprise.v1.TokenProperties.InvalidReason[message.invalidReason] : message.invalidReason; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.hostname != null && message.hasOwnProperty("hostname")) + object.hostname = message.hostname; + if (message.action != null && message.hasOwnProperty("action")) + object.action = message.action; return object; }; /** - * Converts this AccountDefenderAssessment to JSON. + * Converts this TokenProperties to JSON. * @function toJSON - * @memberof google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment + * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties * @instance * @returns {Object.} JSON object */ - AccountDefenderAssessment.prototype.toJSON = function toJSON() { + TokenProperties.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for AccountDefenderAssessment + * Gets the default type url for TokenProperties * @function getTypeUrl - * @memberof google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment + * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - AccountDefenderAssessment.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + TokenProperties.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment"; + return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1.TokenProperties"; }; /** - * AccountDefenderLabel enum. - * @name google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment.AccountDefenderLabel + * InvalidReason enum. + * @name google.cloud.recaptchaenterprise.v1.TokenProperties.InvalidReason * @enum {number} - * @property {number} ACCOUNT_DEFENDER_LABEL_UNSPECIFIED=0 ACCOUNT_DEFENDER_LABEL_UNSPECIFIED value - * @property {number} PROFILE_MATCH=1 PROFILE_MATCH value - * @property {number} SUSPICIOUS_LOGIN_ACTIVITY=2 SUSPICIOUS_LOGIN_ACTIVITY value - * @property {number} SUSPICIOUS_ACCOUNT_CREATION=3 SUSPICIOUS_ACCOUNT_CREATION value - * @property {number} RELATED_ACCOUNTS_NUMBER_HIGH=4 RELATED_ACCOUNTS_NUMBER_HIGH value + * @property {number} INVALID_REASON_UNSPECIFIED=0 INVALID_REASON_UNSPECIFIED value + * @property {number} UNKNOWN_INVALID_REASON=1 UNKNOWN_INVALID_REASON value + * @property {number} MALFORMED=2 MALFORMED value + * @property {number} EXPIRED=3 EXPIRED value + * @property {number} DUPE=4 DUPE value + * @property {number} MISSING=5 MISSING value + * @property {number} BROWSER_ERROR=6 BROWSER_ERROR value */ - AccountDefenderAssessment.AccountDefenderLabel = (function() { + TokenProperties.InvalidReason = (function() { var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "ACCOUNT_DEFENDER_LABEL_UNSPECIFIED"] = 0; - values[valuesById[1] = "PROFILE_MATCH"] = 1; - values[valuesById[2] = "SUSPICIOUS_LOGIN_ACTIVITY"] = 2; - values[valuesById[3] = "SUSPICIOUS_ACCOUNT_CREATION"] = 3; - values[valuesById[4] = "RELATED_ACCOUNTS_NUMBER_HIGH"] = 4; + values[valuesById[0] = "INVALID_REASON_UNSPECIFIED"] = 0; + values[valuesById[1] = "UNKNOWN_INVALID_REASON"] = 1; + values[valuesById[2] = "MALFORMED"] = 2; + values[valuesById[3] = "EXPIRED"] = 3; + values[valuesById[4] = "DUPE"] = 4; + values[valuesById[5] = "MISSING"] = 5; + values[valuesById[6] = "BROWSER_ERROR"] = 6; return values; })(); - return AccountDefenderAssessment; + return TokenProperties; })(); - v1.PrivatePasswordLeakVerification = (function() { + v1.AccountDefenderAssessment = (function() { /** - * Properties of a PrivatePasswordLeakVerification. + * Properties of an AccountDefenderAssessment. * @memberof google.cloud.recaptchaenterprise.v1 - * @interface IPrivatePasswordLeakVerification - * @property {Uint8Array|null} [lookupHashPrefix] PrivatePasswordLeakVerification lookupHashPrefix - * @property {Uint8Array|null} [encryptedUserCredentialsHash] PrivatePasswordLeakVerification encryptedUserCredentialsHash - * @property {Array.|null} [encryptedLeakMatchPrefixes] PrivatePasswordLeakVerification encryptedLeakMatchPrefixes - * @property {Uint8Array|null} [reencryptedUserCredentialsHash] PrivatePasswordLeakVerification reencryptedUserCredentialsHash + * @interface IAccountDefenderAssessment + * @property {Array.|null} [labels] AccountDefenderAssessment labels */ /** - * Constructs a new PrivatePasswordLeakVerification. + * Constructs a new AccountDefenderAssessment. * @memberof google.cloud.recaptchaenterprise.v1 - * @classdesc Represents a PrivatePasswordLeakVerification. - * @implements IPrivatePasswordLeakVerification + * @classdesc Represents an AccountDefenderAssessment. + * @implements IAccountDefenderAssessment * @constructor - * @param {google.cloud.recaptchaenterprise.v1.IPrivatePasswordLeakVerification=} [properties] Properties to set + * @param {google.cloud.recaptchaenterprise.v1.IAccountDefenderAssessment=} [properties] Properties to set */ - function PrivatePasswordLeakVerification(properties) { - this.encryptedLeakMatchPrefixes = []; + function AccountDefenderAssessment(properties) { + this.labels = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -2993,120 +3101,86 @@ } /** - * PrivatePasswordLeakVerification lookupHashPrefix. - * @member {Uint8Array} lookupHashPrefix - * @memberof google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification - * @instance - */ - PrivatePasswordLeakVerification.prototype.lookupHashPrefix = $util.newBuffer([]); - - /** - * PrivatePasswordLeakVerification encryptedUserCredentialsHash. - * @member {Uint8Array} encryptedUserCredentialsHash - * @memberof google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification - * @instance - */ - PrivatePasswordLeakVerification.prototype.encryptedUserCredentialsHash = $util.newBuffer([]); - - /** - * PrivatePasswordLeakVerification encryptedLeakMatchPrefixes. - * @member {Array.} encryptedLeakMatchPrefixes - * @memberof google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification - * @instance - */ - PrivatePasswordLeakVerification.prototype.encryptedLeakMatchPrefixes = $util.emptyArray; - - /** - * PrivatePasswordLeakVerification reencryptedUserCredentialsHash. - * @member {Uint8Array} reencryptedUserCredentialsHash - * @memberof google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification + * AccountDefenderAssessment labels. + * @member {Array.} labels + * @memberof google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment * @instance */ - PrivatePasswordLeakVerification.prototype.reencryptedUserCredentialsHash = $util.newBuffer([]); + AccountDefenderAssessment.prototype.labels = $util.emptyArray; /** - * Creates a new PrivatePasswordLeakVerification instance using the specified properties. + * Creates a new AccountDefenderAssessment instance using the specified properties. * @function create - * @memberof google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification + * @memberof google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment * @static - * @param {google.cloud.recaptchaenterprise.v1.IPrivatePasswordLeakVerification=} [properties] Properties to set - * @returns {google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification} PrivatePasswordLeakVerification instance + * @param {google.cloud.recaptchaenterprise.v1.IAccountDefenderAssessment=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment} AccountDefenderAssessment instance */ - PrivatePasswordLeakVerification.create = function create(properties) { - return new PrivatePasswordLeakVerification(properties); + AccountDefenderAssessment.create = function create(properties) { + return new AccountDefenderAssessment(properties); }; /** - * Encodes the specified PrivatePasswordLeakVerification message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification.verify|verify} messages. + * Encodes the specified AccountDefenderAssessment message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment.verify|verify} messages. * @function encode - * @memberof google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification + * @memberof google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment * @static - * @param {google.cloud.recaptchaenterprise.v1.IPrivatePasswordLeakVerification} message PrivatePasswordLeakVerification message or plain object to encode + * @param {google.cloud.recaptchaenterprise.v1.IAccountDefenderAssessment} message AccountDefenderAssessment message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PrivatePasswordLeakVerification.encode = function encode(message, writer) { + AccountDefenderAssessment.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.lookupHashPrefix != null && Object.hasOwnProperty.call(message, "lookupHashPrefix")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.lookupHashPrefix); - if (message.encryptedUserCredentialsHash != null && Object.hasOwnProperty.call(message, "encryptedUserCredentialsHash")) - writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.encryptedUserCredentialsHash); - if (message.encryptedLeakMatchPrefixes != null && message.encryptedLeakMatchPrefixes.length) - for (var i = 0; i < message.encryptedLeakMatchPrefixes.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.encryptedLeakMatchPrefixes[i]); - if (message.reencryptedUserCredentialsHash != null && Object.hasOwnProperty.call(message, "reencryptedUserCredentialsHash")) - writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.reencryptedUserCredentialsHash); + if (message.labels != null && message.labels.length) { + writer.uint32(/* id 1, wireType 2 =*/10).fork(); + for (var i = 0; i < message.labels.length; ++i) + writer.int32(message.labels[i]); + writer.ldelim(); + } return writer; }; /** - * Encodes the specified PrivatePasswordLeakVerification message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification.verify|verify} messages. + * Encodes the specified AccountDefenderAssessment message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification + * @memberof google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment * @static - * @param {google.cloud.recaptchaenterprise.v1.IPrivatePasswordLeakVerification} message PrivatePasswordLeakVerification message or plain object to encode + * @param {google.cloud.recaptchaenterprise.v1.IAccountDefenderAssessment} message AccountDefenderAssessment message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PrivatePasswordLeakVerification.encodeDelimited = function encodeDelimited(message, writer) { + AccountDefenderAssessment.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a PrivatePasswordLeakVerification message from the specified reader or buffer. + * Decodes an AccountDefenderAssessment message from the specified reader or buffer. * @function decode - * @memberof google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification + * @memberof google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification} PrivatePasswordLeakVerification + * @returns {google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment} AccountDefenderAssessment * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PrivatePasswordLeakVerification.decode = function decode(reader, length) { + AccountDefenderAssessment.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - message.lookupHashPrefix = reader.bytes(); - break; - } - case 2: { - message.encryptedUserCredentialsHash = reader.bytes(); - break; - } - case 3: { - if (!(message.encryptedLeakMatchPrefixes && message.encryptedLeakMatchPrefixes.length)) - message.encryptedLeakMatchPrefixes = []; - message.encryptedLeakMatchPrefixes.push(reader.bytes()); - break; - } - case 4: { - message.reencryptedUserCredentialsHash = reader.bytes(); + if (!(message.labels && message.labels.length)) + message.labels = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.labels.push(reader.int32()); + } else + message.labels.push(reader.int32()); break; } default: @@ -3118,170 +3192,164 @@ }; /** - * Decodes a PrivatePasswordLeakVerification message from the specified reader or buffer, length delimited. + * Decodes an AccountDefenderAssessment message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification + * @memberof google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification} PrivatePasswordLeakVerification + * @returns {google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment} AccountDefenderAssessment * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PrivatePasswordLeakVerification.decodeDelimited = function decodeDelimited(reader) { + AccountDefenderAssessment.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a PrivatePasswordLeakVerification message. + * Verifies an AccountDefenderAssessment message. * @function verify - * @memberof google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification + * @memberof google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - PrivatePasswordLeakVerification.verify = function verify(message) { + AccountDefenderAssessment.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.lookupHashPrefix != null && message.hasOwnProperty("lookupHashPrefix")) - if (!(message.lookupHashPrefix && typeof message.lookupHashPrefix.length === "number" || $util.isString(message.lookupHashPrefix))) - return "lookupHashPrefix: buffer expected"; - if (message.encryptedUserCredentialsHash != null && message.hasOwnProperty("encryptedUserCredentialsHash")) - if (!(message.encryptedUserCredentialsHash && typeof message.encryptedUserCredentialsHash.length === "number" || $util.isString(message.encryptedUserCredentialsHash))) - return "encryptedUserCredentialsHash: buffer expected"; - if (message.encryptedLeakMatchPrefixes != null && message.hasOwnProperty("encryptedLeakMatchPrefixes")) { - if (!Array.isArray(message.encryptedLeakMatchPrefixes)) - return "encryptedLeakMatchPrefixes: array expected"; - for (var i = 0; i < message.encryptedLeakMatchPrefixes.length; ++i) - if (!(message.encryptedLeakMatchPrefixes[i] && typeof message.encryptedLeakMatchPrefixes[i].length === "number" || $util.isString(message.encryptedLeakMatchPrefixes[i]))) - return "encryptedLeakMatchPrefixes: buffer[] expected"; + if (message.labels != null && message.hasOwnProperty("labels")) { + if (!Array.isArray(message.labels)) + return "labels: array expected"; + for (var i = 0; i < message.labels.length; ++i) + switch (message.labels[i]) { + default: + return "labels: enum value[] expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } } - if (message.reencryptedUserCredentialsHash != null && message.hasOwnProperty("reencryptedUserCredentialsHash")) - if (!(message.reencryptedUserCredentialsHash && typeof message.reencryptedUserCredentialsHash.length === "number" || $util.isString(message.reencryptedUserCredentialsHash))) - return "reencryptedUserCredentialsHash: buffer expected"; return null; }; /** - * Creates a PrivatePasswordLeakVerification message from a plain object. Also converts values to their respective internal types. + * Creates an AccountDefenderAssessment message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification + * @memberof google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment * @static * @param {Object.} object Plain object - * @returns {google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification} PrivatePasswordLeakVerification + * @returns {google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment} AccountDefenderAssessment */ - PrivatePasswordLeakVerification.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification) + AccountDefenderAssessment.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment) return object; - var message = new $root.google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification(); - if (object.lookupHashPrefix != null) - if (typeof object.lookupHashPrefix === "string") - $util.base64.decode(object.lookupHashPrefix, message.lookupHashPrefix = $util.newBuffer($util.base64.length(object.lookupHashPrefix)), 0); - else if (object.lookupHashPrefix.length >= 0) - message.lookupHashPrefix = object.lookupHashPrefix; - if (object.encryptedUserCredentialsHash != null) - if (typeof object.encryptedUserCredentialsHash === "string") - $util.base64.decode(object.encryptedUserCredentialsHash, message.encryptedUserCredentialsHash = $util.newBuffer($util.base64.length(object.encryptedUserCredentialsHash)), 0); - else if (object.encryptedUserCredentialsHash.length >= 0) - message.encryptedUserCredentialsHash = object.encryptedUserCredentialsHash; - if (object.encryptedLeakMatchPrefixes) { - if (!Array.isArray(object.encryptedLeakMatchPrefixes)) - throw TypeError(".google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification.encryptedLeakMatchPrefixes: array expected"); - message.encryptedLeakMatchPrefixes = []; - for (var i = 0; i < object.encryptedLeakMatchPrefixes.length; ++i) - if (typeof object.encryptedLeakMatchPrefixes[i] === "string") - $util.base64.decode(object.encryptedLeakMatchPrefixes[i], message.encryptedLeakMatchPrefixes[i] = $util.newBuffer($util.base64.length(object.encryptedLeakMatchPrefixes[i])), 0); - else if (object.encryptedLeakMatchPrefixes[i].length >= 0) - message.encryptedLeakMatchPrefixes[i] = object.encryptedLeakMatchPrefixes[i]; + var message = new $root.google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment(); + if (object.labels) { + if (!Array.isArray(object.labels)) + throw TypeError(".google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment.labels: array expected"); + message.labels = []; + for (var i = 0; i < object.labels.length; ++i) + switch (object.labels[i]) { + default: + case "ACCOUNT_DEFENDER_LABEL_UNSPECIFIED": + case 0: + message.labels[i] = 0; + break; + case "PROFILE_MATCH": + case 1: + message.labels[i] = 1; + break; + case "SUSPICIOUS_LOGIN_ACTIVITY": + case 2: + message.labels[i] = 2; + break; + case "SUSPICIOUS_ACCOUNT_CREATION": + case 3: + message.labels[i] = 3; + break; + case "RELATED_ACCOUNTS_NUMBER_HIGH": + case 4: + message.labels[i] = 4; + break; + } } - if (object.reencryptedUserCredentialsHash != null) - if (typeof object.reencryptedUserCredentialsHash === "string") - $util.base64.decode(object.reencryptedUserCredentialsHash, message.reencryptedUserCredentialsHash = $util.newBuffer($util.base64.length(object.reencryptedUserCredentialsHash)), 0); - else if (object.reencryptedUserCredentialsHash.length >= 0) - message.reencryptedUserCredentialsHash = object.reencryptedUserCredentialsHash; return message; }; /** - * Creates a plain object from a PrivatePasswordLeakVerification message. Also converts values to other types if specified. + * Creates a plain object from an AccountDefenderAssessment message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification + * @memberof google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment * @static - * @param {google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification} message PrivatePasswordLeakVerification + * @param {google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment} message AccountDefenderAssessment * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - PrivatePasswordLeakVerification.toObject = function toObject(message, options) { + AccountDefenderAssessment.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) - object.encryptedLeakMatchPrefixes = []; - if (options.defaults) { - if (options.bytes === String) - object.lookupHashPrefix = ""; - else { - object.lookupHashPrefix = []; - if (options.bytes !== Array) - object.lookupHashPrefix = $util.newBuffer(object.lookupHashPrefix); - } - if (options.bytes === String) - object.encryptedUserCredentialsHash = ""; - else { - object.encryptedUserCredentialsHash = []; - if (options.bytes !== Array) - object.encryptedUserCredentialsHash = $util.newBuffer(object.encryptedUserCredentialsHash); - } - if (options.bytes === String) - object.reencryptedUserCredentialsHash = ""; - else { - object.reencryptedUserCredentialsHash = []; - if (options.bytes !== Array) - object.reencryptedUserCredentialsHash = $util.newBuffer(object.reencryptedUserCredentialsHash); - } - } - if (message.lookupHashPrefix != null && message.hasOwnProperty("lookupHashPrefix")) - object.lookupHashPrefix = options.bytes === String ? $util.base64.encode(message.lookupHashPrefix, 0, message.lookupHashPrefix.length) : options.bytes === Array ? Array.prototype.slice.call(message.lookupHashPrefix) : message.lookupHashPrefix; - if (message.encryptedUserCredentialsHash != null && message.hasOwnProperty("encryptedUserCredentialsHash")) - object.encryptedUserCredentialsHash = options.bytes === String ? $util.base64.encode(message.encryptedUserCredentialsHash, 0, message.encryptedUserCredentialsHash.length) : options.bytes === Array ? Array.prototype.slice.call(message.encryptedUserCredentialsHash) : message.encryptedUserCredentialsHash; - if (message.encryptedLeakMatchPrefixes && message.encryptedLeakMatchPrefixes.length) { - object.encryptedLeakMatchPrefixes = []; - for (var j = 0; j < message.encryptedLeakMatchPrefixes.length; ++j) - object.encryptedLeakMatchPrefixes[j] = options.bytes === String ? $util.base64.encode(message.encryptedLeakMatchPrefixes[j], 0, message.encryptedLeakMatchPrefixes[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.encryptedLeakMatchPrefixes[j]) : message.encryptedLeakMatchPrefixes[j]; + object.labels = []; + if (message.labels && message.labels.length) { + object.labels = []; + for (var j = 0; j < message.labels.length; ++j) + object.labels[j] = options.enums === String ? $root.google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment.AccountDefenderLabel[message.labels[j]] : message.labels[j]; } - if (message.reencryptedUserCredentialsHash != null && message.hasOwnProperty("reencryptedUserCredentialsHash")) - object.reencryptedUserCredentialsHash = options.bytes === String ? $util.base64.encode(message.reencryptedUserCredentialsHash, 0, message.reencryptedUserCredentialsHash.length) : options.bytes === Array ? Array.prototype.slice.call(message.reencryptedUserCredentialsHash) : message.reencryptedUserCredentialsHash; return object; }; /** - * Converts this PrivatePasswordLeakVerification to JSON. + * Converts this AccountDefenderAssessment to JSON. * @function toJSON - * @memberof google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification + * @memberof google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment * @instance * @returns {Object.} JSON object */ - PrivatePasswordLeakVerification.prototype.toJSON = function toJSON() { + AccountDefenderAssessment.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for PrivatePasswordLeakVerification + * Gets the default type url for AccountDefenderAssessment * @function getTypeUrl - * @memberof google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification + * @memberof google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - PrivatePasswordLeakVerification.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + AccountDefenderAssessment.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification"; + return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment"; }; - return PrivatePasswordLeakVerification; + /** + * AccountDefenderLabel enum. + * @name google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment.AccountDefenderLabel + * @enum {number} + * @property {number} ACCOUNT_DEFENDER_LABEL_UNSPECIFIED=0 ACCOUNT_DEFENDER_LABEL_UNSPECIFIED value + * @property {number} PROFILE_MATCH=1 PROFILE_MATCH value + * @property {number} SUSPICIOUS_LOGIN_ACTIVITY=2 SUSPICIOUS_LOGIN_ACTIVITY value + * @property {number} SUSPICIOUS_ACCOUNT_CREATION=3 SUSPICIOUS_ACCOUNT_CREATION value + * @property {number} RELATED_ACCOUNTS_NUMBER_HIGH=4 RELATED_ACCOUNTS_NUMBER_HIGH value + */ + AccountDefenderAssessment.AccountDefenderLabel = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ACCOUNT_DEFENDER_LABEL_UNSPECIFIED"] = 0; + values[valuesById[1] = "PROFILE_MATCH"] = 1; + values[valuesById[2] = "SUSPICIOUS_LOGIN_ACTIVITY"] = 2; + values[valuesById[3] = "SUSPICIOUS_ACCOUNT_CREATION"] = 3; + values[valuesById[4] = "RELATED_ACCOUNTS_NUMBER_HIGH"] = 4; + return values; + })(); + + return AccountDefenderAssessment; })(); v1.CreateKeyRequest = (function() { @@ -3760,32 +3828,278 @@ if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1.ListKeysRequest"; + return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1.ListKeysRequest"; + }; + + return ListKeysRequest; + })(); + + v1.ListKeysResponse = (function() { + + /** + * Properties of a ListKeysResponse. + * @memberof google.cloud.recaptchaenterprise.v1 + * @interface IListKeysResponse + * @property {Array.|null} [keys] ListKeysResponse keys + * @property {string|null} [nextPageToken] ListKeysResponse nextPageToken + */ + + /** + * Constructs a new ListKeysResponse. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents a ListKeysResponse. + * @implements IListKeysResponse + * @constructor + * @param {google.cloud.recaptchaenterprise.v1.IListKeysResponse=} [properties] Properties to set + */ + function ListKeysResponse(properties) { + this.keys = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListKeysResponse keys. + * @member {Array.} keys + * @memberof google.cloud.recaptchaenterprise.v1.ListKeysResponse + * @instance + */ + ListKeysResponse.prototype.keys = $util.emptyArray; + + /** + * ListKeysResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.recaptchaenterprise.v1.ListKeysResponse + * @instance + */ + ListKeysResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListKeysResponse instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.ListKeysResponse + * @static + * @param {google.cloud.recaptchaenterprise.v1.IListKeysResponse=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.ListKeysResponse} ListKeysResponse instance + */ + ListKeysResponse.create = function create(properties) { + return new ListKeysResponse(properties); + }; + + /** + * Encodes the specified ListKeysResponse message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.ListKeysResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1.ListKeysResponse + * @static + * @param {google.cloud.recaptchaenterprise.v1.IListKeysResponse} message ListKeysResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListKeysResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.keys != null && message.keys.length) + for (var i = 0; i < message.keys.length; ++i) + $root.google.cloud.recaptchaenterprise.v1.Key.encode(message.keys[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListKeysResponse message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.ListKeysResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.ListKeysResponse + * @static + * @param {google.cloud.recaptchaenterprise.v1.IListKeysResponse} message ListKeysResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListKeysResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListKeysResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1.ListKeysResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1.ListKeysResponse} ListKeysResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListKeysResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.ListKeysResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.keys && message.keys.length)) + message.keys = []; + message.keys.push($root.google.cloud.recaptchaenterprise.v1.Key.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListKeysResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.ListKeysResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1.ListKeysResponse} ListKeysResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListKeysResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListKeysResponse message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1.ListKeysResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListKeysResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.keys != null && message.hasOwnProperty("keys")) { + if (!Array.isArray(message.keys)) + return "keys: array expected"; + for (var i = 0; i < message.keys.length; ++i) { + var error = $root.google.cloud.recaptchaenterprise.v1.Key.verify(message.keys[i]); + if (error) + return "keys." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListKeysResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1.ListKeysResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1.ListKeysResponse} ListKeysResponse + */ + ListKeysResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.ListKeysResponse) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1.ListKeysResponse(); + if (object.keys) { + if (!Array.isArray(object.keys)) + throw TypeError(".google.cloud.recaptchaenterprise.v1.ListKeysResponse.keys: array expected"); + message.keys = []; + for (var i = 0; i < object.keys.length; ++i) { + if (typeof object.keys[i] !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1.ListKeysResponse.keys: object expected"); + message.keys[i] = $root.google.cloud.recaptchaenterprise.v1.Key.fromObject(object.keys[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListKeysResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1.ListKeysResponse + * @static + * @param {google.cloud.recaptchaenterprise.v1.ListKeysResponse} message ListKeysResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListKeysResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.keys = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.keys && message.keys.length) { + object.keys = []; + for (var j = 0; j < message.keys.length; ++j) + object.keys[j] = $root.google.cloud.recaptchaenterprise.v1.Key.toObject(message.keys[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListKeysResponse to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1.ListKeysResponse + * @instance + * @returns {Object.} JSON object + */ + ListKeysResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListKeysResponse + * @function getTypeUrl + * @memberof google.cloud.recaptchaenterprise.v1.ListKeysResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListKeysResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1.ListKeysResponse"; }; - return ListKeysRequest; + return ListKeysResponse; })(); - v1.ListKeysResponse = (function() { + v1.RetrieveLegacySecretKeyRequest = (function() { /** - * Properties of a ListKeysResponse. + * Properties of a RetrieveLegacySecretKeyRequest. * @memberof google.cloud.recaptchaenterprise.v1 - * @interface IListKeysResponse - * @property {Array.|null} [keys] ListKeysResponse keys - * @property {string|null} [nextPageToken] ListKeysResponse nextPageToken + * @interface IRetrieveLegacySecretKeyRequest + * @property {string|null} [key] RetrieveLegacySecretKeyRequest key */ /** - * Constructs a new ListKeysResponse. + * Constructs a new RetrieveLegacySecretKeyRequest. * @memberof google.cloud.recaptchaenterprise.v1 - * @classdesc Represents a ListKeysResponse. - * @implements IListKeysResponse + * @classdesc Represents a RetrieveLegacySecretKeyRequest. + * @implements IRetrieveLegacySecretKeyRequest * @constructor - * @param {google.cloud.recaptchaenterprise.v1.IListKeysResponse=} [properties] Properties to set + * @param {google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyRequest=} [properties] Properties to set */ - function ListKeysResponse(properties) { - this.keys = []; + function RetrieveLegacySecretKeyRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -3793,92 +4107,75 @@ } /** - * ListKeysResponse keys. - * @member {Array.} keys - * @memberof google.cloud.recaptchaenterprise.v1.ListKeysResponse - * @instance - */ - ListKeysResponse.prototype.keys = $util.emptyArray; - - /** - * ListKeysResponse nextPageToken. - * @member {string} nextPageToken - * @memberof google.cloud.recaptchaenterprise.v1.ListKeysResponse + * RetrieveLegacySecretKeyRequest key. + * @member {string} key + * @memberof google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest * @instance */ - ListKeysResponse.prototype.nextPageToken = ""; + RetrieveLegacySecretKeyRequest.prototype.key = ""; /** - * Creates a new ListKeysResponse instance using the specified properties. + * Creates a new RetrieveLegacySecretKeyRequest instance using the specified properties. * @function create - * @memberof google.cloud.recaptchaenterprise.v1.ListKeysResponse + * @memberof google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest * @static - * @param {google.cloud.recaptchaenterprise.v1.IListKeysResponse=} [properties] Properties to set - * @returns {google.cloud.recaptchaenterprise.v1.ListKeysResponse} ListKeysResponse instance + * @param {google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyRequest=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest} RetrieveLegacySecretKeyRequest instance */ - ListKeysResponse.create = function create(properties) { - return new ListKeysResponse(properties); + RetrieveLegacySecretKeyRequest.create = function create(properties) { + return new RetrieveLegacySecretKeyRequest(properties); }; /** - * Encodes the specified ListKeysResponse message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.ListKeysResponse.verify|verify} messages. + * Encodes the specified RetrieveLegacySecretKeyRequest message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.recaptchaenterprise.v1.ListKeysResponse + * @memberof google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest * @static - * @param {google.cloud.recaptchaenterprise.v1.IListKeysResponse} message ListKeysResponse message or plain object to encode + * @param {google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyRequest} message RetrieveLegacySecretKeyRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListKeysResponse.encode = function encode(message, writer) { + RetrieveLegacySecretKeyRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.keys != null && message.keys.length) - for (var i = 0; i < message.keys.length; ++i) - $root.google.cloud.recaptchaenterprise.v1.Key.encode(message.keys[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.key); return writer; }; /** - * Encodes the specified ListKeysResponse message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.ListKeysResponse.verify|verify} messages. + * Encodes the specified RetrieveLegacySecretKeyRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.recaptchaenterprise.v1.ListKeysResponse + * @memberof google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest * @static - * @param {google.cloud.recaptchaenterprise.v1.IListKeysResponse} message ListKeysResponse message or plain object to encode + * @param {google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyRequest} message RetrieveLegacySecretKeyRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListKeysResponse.encodeDelimited = function encodeDelimited(message, writer) { + RetrieveLegacySecretKeyRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ListKeysResponse message from the specified reader or buffer. + * Decodes a RetrieveLegacySecretKeyRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.recaptchaenterprise.v1.ListKeysResponse + * @memberof google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.recaptchaenterprise.v1.ListKeysResponse} ListKeysResponse + * @returns {google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest} RetrieveLegacySecretKeyRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListKeysResponse.decode = function decode(reader, length) { + RetrieveLegacySecretKeyRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.ListKeysResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - if (!(message.keys && message.keys.length)) - message.keys = []; - message.keys.push($root.google.cloud.recaptchaenterprise.v1.Key.decode(reader, reader.uint32())); - break; - } - case 2: { - message.nextPageToken = reader.string(); + message.key = reader.string(); break; } default: @@ -3890,128 +4187,102 @@ }; /** - * Decodes a ListKeysResponse message from the specified reader or buffer, length delimited. + * Decodes a RetrieveLegacySecretKeyRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.recaptchaenterprise.v1.ListKeysResponse + * @memberof google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.recaptchaenterprise.v1.ListKeysResponse} ListKeysResponse + * @returns {google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest} RetrieveLegacySecretKeyRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListKeysResponse.decodeDelimited = function decodeDelimited(reader) { + RetrieveLegacySecretKeyRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ListKeysResponse message. + * Verifies a RetrieveLegacySecretKeyRequest message. * @function verify - * @memberof google.cloud.recaptchaenterprise.v1.ListKeysResponse + * @memberof google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ListKeysResponse.verify = function verify(message) { + RetrieveLegacySecretKeyRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.keys != null && message.hasOwnProperty("keys")) { - if (!Array.isArray(message.keys)) - return "keys: array expected"; - for (var i = 0; i < message.keys.length; ++i) { - var error = $root.google.cloud.recaptchaenterprise.v1.Key.verify(message.keys[i]); - if (error) - return "keys." + error; - } - } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - if (!$util.isString(message.nextPageToken)) - return "nextPageToken: string expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!$util.isString(message.key)) + return "key: string expected"; return null; }; /** - * Creates a ListKeysResponse message from a plain object. Also converts values to their respective internal types. + * Creates a RetrieveLegacySecretKeyRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.recaptchaenterprise.v1.ListKeysResponse + * @memberof google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.recaptchaenterprise.v1.ListKeysResponse} ListKeysResponse + * @returns {google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest} RetrieveLegacySecretKeyRequest */ - ListKeysResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.recaptchaenterprise.v1.ListKeysResponse) + RetrieveLegacySecretKeyRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest) return object; - var message = new $root.google.cloud.recaptchaenterprise.v1.ListKeysResponse(); - if (object.keys) { - if (!Array.isArray(object.keys)) - throw TypeError(".google.cloud.recaptchaenterprise.v1.ListKeysResponse.keys: array expected"); - message.keys = []; - for (var i = 0; i < object.keys.length; ++i) { - if (typeof object.keys[i] !== "object") - throw TypeError(".google.cloud.recaptchaenterprise.v1.ListKeysResponse.keys: object expected"); - message.keys[i] = $root.google.cloud.recaptchaenterprise.v1.Key.fromObject(object.keys[i]); - } - } - if (object.nextPageToken != null) - message.nextPageToken = String(object.nextPageToken); + var message = new $root.google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest(); + if (object.key != null) + message.key = String(object.key); return message; }; /** - * Creates a plain object from a ListKeysResponse message. Also converts values to other types if specified. + * Creates a plain object from a RetrieveLegacySecretKeyRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.recaptchaenterprise.v1.ListKeysResponse + * @memberof google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest * @static - * @param {google.cloud.recaptchaenterprise.v1.ListKeysResponse} message ListKeysResponse + * @param {google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest} message RetrieveLegacySecretKeyRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ListKeysResponse.toObject = function toObject(message, options) { + RetrieveLegacySecretKeyRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.keys = []; if (options.defaults) - object.nextPageToken = ""; - if (message.keys && message.keys.length) { - object.keys = []; - for (var j = 0; j < message.keys.length; ++j) - object.keys[j] = $root.google.cloud.recaptchaenterprise.v1.Key.toObject(message.keys[j], options); - } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - object.nextPageToken = message.nextPageToken; + object.key = ""; + if (message.key != null && message.hasOwnProperty("key")) + object.key = message.key; return object; }; /** - * Converts this ListKeysResponse to JSON. + * Converts this RetrieveLegacySecretKeyRequest to JSON. * @function toJSON - * @memberof google.cloud.recaptchaenterprise.v1.ListKeysResponse + * @memberof google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest * @instance * @returns {Object.} JSON object */ - ListKeysResponse.prototype.toJSON = function toJSON() { + RetrieveLegacySecretKeyRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for ListKeysResponse + * Gets the default type url for RetrieveLegacySecretKeyRequest * @function getTypeUrl - * @memberof google.cloud.recaptchaenterprise.v1.ListKeysResponse + * @memberof google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - ListKeysResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + RetrieveLegacySecretKeyRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1.ListKeysResponse"; + return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest"; }; - return ListKeysResponse; + return RetrieveLegacySecretKeyRequest; })(); v1.GetKeyRequest = (function() { @@ -5385,6 +5656,209 @@ return Metrics; })(); + v1.RetrieveLegacySecretKeyResponse = (function() { + + /** + * Properties of a RetrieveLegacySecretKeyResponse. + * @memberof google.cloud.recaptchaenterprise.v1 + * @interface IRetrieveLegacySecretKeyResponse + * @property {string|null} [legacySecretKey] RetrieveLegacySecretKeyResponse legacySecretKey + */ + + /** + * Constructs a new RetrieveLegacySecretKeyResponse. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents a RetrieveLegacySecretKeyResponse. + * @implements IRetrieveLegacySecretKeyResponse + * @constructor + * @param {google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyResponse=} [properties] Properties to set + */ + function RetrieveLegacySecretKeyResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RetrieveLegacySecretKeyResponse legacySecretKey. + * @member {string} legacySecretKey + * @memberof google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse + * @instance + */ + RetrieveLegacySecretKeyResponse.prototype.legacySecretKey = ""; + + /** + * Creates a new RetrieveLegacySecretKeyResponse instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse + * @static + * @param {google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyResponse=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse} RetrieveLegacySecretKeyResponse instance + */ + RetrieveLegacySecretKeyResponse.create = function create(properties) { + return new RetrieveLegacySecretKeyResponse(properties); + }; + + /** + * Encodes the specified RetrieveLegacySecretKeyResponse message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse + * @static + * @param {google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyResponse} message RetrieveLegacySecretKeyResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RetrieveLegacySecretKeyResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.legacySecretKey != null && Object.hasOwnProperty.call(message, "legacySecretKey")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.legacySecretKey); + return writer; + }; + + /** + * Encodes the specified RetrieveLegacySecretKeyResponse message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse + * @static + * @param {google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyResponse} message RetrieveLegacySecretKeyResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RetrieveLegacySecretKeyResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RetrieveLegacySecretKeyResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse} RetrieveLegacySecretKeyResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RetrieveLegacySecretKeyResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.legacySecretKey = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RetrieveLegacySecretKeyResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse} RetrieveLegacySecretKeyResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RetrieveLegacySecretKeyResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RetrieveLegacySecretKeyResponse message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RetrieveLegacySecretKeyResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.legacySecretKey != null && message.hasOwnProperty("legacySecretKey")) + if (!$util.isString(message.legacySecretKey)) + return "legacySecretKey: string expected"; + return null; + }; + + /** + * Creates a RetrieveLegacySecretKeyResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse} RetrieveLegacySecretKeyResponse + */ + RetrieveLegacySecretKeyResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse(); + if (object.legacySecretKey != null) + message.legacySecretKey = String(object.legacySecretKey); + return message; + }; + + /** + * Creates a plain object from a RetrieveLegacySecretKeyResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse + * @static + * @param {google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse} message RetrieveLegacySecretKeyResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RetrieveLegacySecretKeyResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.legacySecretKey = ""; + if (message.legacySecretKey != null && message.hasOwnProperty("legacySecretKey")) + object.legacySecretKey = message.legacySecretKey; + return object; + }; + + /** + * Converts this RetrieveLegacySecretKeyResponse to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse + * @instance + * @returns {Object.} JSON object + */ + RetrieveLegacySecretKeyResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for RetrieveLegacySecretKeyResponse + * @function getTypeUrl + * @memberof google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RetrieveLegacySecretKeyResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse"; + }; + + return RetrieveLegacySecretKeyResponse; + })(); + v1.Key = (function() { /** diff --git a/packages/google-cloud-recaptchaenterprise/protos/protos.json b/packages/google-cloud-recaptchaenterprise/protos/protos.json index d3ef26da0a5..740e42bfc12 100644 --- a/packages/google-cloud-recaptchaenterprise/protos/protos.json +++ b/packages/google-cloud-recaptchaenterprise/protos/protos.json @@ -94,6 +94,24 @@ } ] }, + "RetrieveLegacySecretKey": { + "requestType": "RetrieveLegacySecretKeyRequest", + "responseType": "RetrieveLegacySecretKeyResponse", + "options": { + "(google.api.http).get": "/v1/{key=projects/*/keys/*}:retrieveLegacySecretKey", + "(google.api.method_signature)": "key" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{key=projects/*/keys/*}:retrieveLegacySecretKey" + } + }, + { + "(google.api.method_signature)": "key" + } + ] + }, "GetKey": { "requestType": "GetKeyRequest", "responseType": "Key", @@ -298,12 +316,17 @@ "CHARGEBACK": 1, "CHARGEBACK_FRAUD": 8, "CHARGEBACK_DISPUTE": 9, + "REFUND": 10, + "REFUND_FRAUD": 11, + "TRANSACTION_ACCEPTED": 12, + "TRANSACTION_DECLINED": 13, "PAYMENT_HEURISTICS": 2, "INITIATED_TWO_FACTOR": 7, "PASSED_TWO_FACTOR": 3, "FAILED_TWO_FACTOR": 4, "CORRECT_PASSWORD": 5, - "INCORRECT_PASSWORD": 6 + "INCORRECT_PASSWORD": 6, + "SOCIAL_SPAM": 14 } } } @@ -311,6 +334,39 @@ "AnnotateAssessmentResponse": { "fields": {} }, + "PrivatePasswordLeakVerification": { + "fields": { + "lookupHashPrefix": { + "type": "bytes", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "encryptedUserCredentialsHash": { + "type": "bytes", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "encryptedLeakMatchPrefixes": { + "rule": "repeated", + "type": "bytes", + "id": 3, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "reencryptedUserCredentialsHash": { + "type": "bytes", + "id": 4, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + } + }, "Assessment": { "options": { "(google.api.resource).type": "recaptchaenterprise.googleapis.com/Assessment", @@ -480,39 +536,6 @@ } } }, - "PrivatePasswordLeakVerification": { - "fields": { - "lookupHashPrefix": { - "type": "bytes", - "id": 1, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "encryptedUserCredentialsHash": { - "type": "bytes", - "id": 2, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "encryptedLeakMatchPrefixes": { - "rule": "repeated", - "type": "bytes", - "id": 3, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "reencryptedUserCredentialsHash": { - "type": "bytes", - "id": 4, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - } - } - }, "CreateKeyRequest": { "fields": { "parent": { @@ -571,6 +594,18 @@ } } }, + "RetrieveLegacySecretKeyRequest": { + "fields": { + "key": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "recaptchaenterprise.googleapis.com/Key" + } + } + } + }, "GetKeyRequest": { "fields": { "name": { @@ -666,6 +701,14 @@ } } }, + "RetrieveLegacySecretKeyResponse": { + "fields": { + "legacySecretKey": { + "type": "string", + "id": 1 + } + } + }, "Key": { "options": { "(google.api.resource).type": "recaptchaenterprise.googleapis.com/Key", diff --git a/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.annotate_assessment.js b/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.annotate_assessment.js index 9a5a2ad4a34..24146c3cd7d 100644 --- a/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.annotate_assessment.js +++ b/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.annotate_assessment.js @@ -34,19 +34,18 @@ function main(name) { */ // const name = 'abc123' /** - * Optional. The annotation that will be assigned to the Event. This field can - * be left empty to provide reasons that apply to an event without concluding - * whether the event is legitimate or fraudulent. + * Optional. The annotation that will be assigned to the Event. This field can be left + * empty to provide reasons that apply to an event without concluding whether + * the event is legitimate or fraudulent. */ // const annotation = {} /** - * Optional. Optional reasons for the annotation that will be assigned to the - * Event. + * Optional. Optional reasons for the annotation that will be assigned to the Event. */ // const reasons = 1234 /** - * Optional. Optional unique stable hashed user identifier to apply to the - * assessment. This is an alternative to setting the hashed_account_id in + * Optional. Unique stable hashed user identifier to apply to the assessment. + * This is an alternative to setting the hashed_account_id in * CreateAssessment, for example when the account identifier is not yet known * in the initial request. It is recommended that the identifier is hashed * using hmac-sha256 with stable secret. diff --git a/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.list_related_account_group_memberships.js b/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.list_related_account_group_memberships.js index c12e903eb25..097f294ce3c 100644 --- a/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.list_related_account_group_memberships.js +++ b/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.list_related_account_group_memberships.js @@ -34,15 +34,15 @@ function main(parent) { */ // const parent = 'abc123' /** - * Optional. The maximum number of accounts to return. The service may return - * fewer than this value. If unspecified, at most 50 accounts will be - * returned. The maximum value is 1000; values above 1000 will be coerced to - * 1000. + * Optional. The maximum number of accounts to return. The service might return fewer + * than this value. + * If unspecified, at most 50 accounts are returned. + * The maximum value is 1000; values above 1000 are coerced to 1000. */ // const pageSize = 1234 /** - * Optional. A page token, received from a previous - * `ListRelatedAccountGroupMemberships` call. + * Optional. A page token, received from a previous `ListRelatedAccountGroupMemberships` + * call. * When paginating, all other parameters provided to * `ListRelatedAccountGroupMemberships` must match the call that provided the * page token. diff --git a/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.list_related_account_groups.js b/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.list_related_account_groups.js index e4b1eb7c198..9be614706a0 100644 --- a/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.list_related_account_groups.js +++ b/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.list_related_account_groups.js @@ -29,19 +29,20 @@ function main(parent) { * TODO(developer): Uncomment these variables before running the sample. */ /** - * Required. The name of the project to list related account groups from, in - * the format "projects/{project}". + * Required. The name of the project to list related account groups from, in the format + * "projects/{project}". */ // const parent = 'abc123' /** - * Optional. The maximum number of groups to return. The service may return - * fewer than this value. If unspecified, at most 50 groups will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. + * Optional. The maximum number of groups to return. The service might return fewer than + * this value. + * If unspecified, at most 50 groups are returned. + * The maximum value is 1000; values above 1000 are coerced to 1000. */ // const pageSize = 1234 /** - * Optional. A page token, received from a previous `ListRelatedAccountGroups` - * call. Provide this to retrieve the subsequent page. + * Optional. A page token, received from a previous `ListRelatedAccountGroups` call. + * Provide this to retrieve the subsequent page. * When paginating, all other parameters provided to * `ListRelatedAccountGroups` must match the call that provided the page * token. diff --git a/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.retrieve_legacy_secret_key.js b/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.retrieve_legacy_secret_key.js new file mode 100644 index 00000000000..95cb5eb22e9 --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.retrieve_legacy_secret_key.js @@ -0,0 +1,62 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(key) { + // [START recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_RetrieveLegacySecretKey_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The public key name linked to the requested secret key in the format + * "projects/{project}/keys/{key}". + */ + // const key = 'abc123' + + // Imports the Recaptchaenterprise library + const {RecaptchaEnterpriseServiceClient} = require('@google-cloud/recaptcha-enterprise').v1; + + // Instantiates a client + const recaptchaenterpriseClient = new RecaptchaEnterpriseServiceClient(); + + async function callRetrieveLegacySecretKey() { + // Construct request + const request = { + key, + }; + + // Run request + const response = await recaptchaenterpriseClient.retrieveLegacySecretKey(request); + console.log(response); + } + + callRetrieveLegacySecretKey(); + // [END recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_RetrieveLegacySecretKey_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.search_related_account_group_memberships.js b/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.search_related_account_group_memberships.js index c06150a8a2b..1e85d154cb6 100644 --- a/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.search_related_account_group_memberships.js +++ b/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.search_related_account_group_memberships.js @@ -29,20 +29,21 @@ function main(project) { * TODO(developer): Uncomment these variables before running the sample. */ /** - * Required. The name of the project to search related account group - * memberships from, in the format "projects/{project}". + * Required. The name of the project to search related account group memberships from. + * Specify the project name in the following format: "projects/{project}". */ // const project = 'my-project' /** - * Optional. The unique stable hashed user identifier we should search - * connections to. The identifier should correspond to a `hashed_account_id` - * provided in a previous CreateAssessment or AnnotateAssessment call. + * Optional. The unique stable hashed user identifier we should search connections to. + * The identifier should correspond to a `hashed_account_id` provided in a + * previous `CreateAssessment` or `AnnotateAssessment` call. */ // const hashedAccountId = 'Buffer.from('string')' /** - * Optional. The maximum number of groups to return. The service may return - * fewer than this value. If unspecified, at most 50 groups will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. + * Optional. The maximum number of groups to return. The service might return fewer than + * this value. + * If unspecified, at most 50 groups are returned. + * The maximum value is 1000; values above 1000 are coerced to 1000. */ // const pageSize = 1234 /** diff --git a/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.update_key.js b/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.update_key.js index b50005c503d..b7fc0fc86cd 100644 --- a/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.update_key.js +++ b/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.update_key.js @@ -33,8 +33,8 @@ function main(key) { */ // const key = {} /** - * Optional. The mask to control which fields of the key get updated. If the - * mask is not present, all fields will be updated. + * Optional. The mask to control which fields of the key get updated. If the mask is not + * present, all fields will be updated. */ // const updateMask = {} diff --git a/packages/google-cloud-recaptchaenterprise/samples/generated/v1/snippet_metadata.google.cloud.recaptchaenterprise.v1.json b/packages/google-cloud-recaptchaenterprise/samples/generated/v1/snippet_metadata.google.cloud.recaptchaenterprise.v1.json index c249b471cf1..077f8dfc9f4 100644 --- a/packages/google-cloud-recaptchaenterprise/samples/generated/v1/snippet_metadata.google.cloud.recaptchaenterprise.v1.json +++ b/packages/google-cloud-recaptchaenterprise/samples/generated/v1/snippet_metadata.google.cloud.recaptchaenterprise.v1.json @@ -66,7 +66,7 @@ "segments": [ { "start": 25, - "end": 73, + "end": 72, "type": "FULL" } ], @@ -199,6 +199,46 @@ } } }, + { + "regionTag": "recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_RetrieveLegacySecretKey_async", + "title": "RecaptchaEnterpriseService retrieveLegacySecretKey Sample", + "origin": "API_DEFINITION", + "description": " Returns the secret key related to the specified public key. You must use the legacy secret key only in a 3rd party integration with legacy reCAPTCHA.", + "canonical": true, + "file": "recaptcha_enterprise_service.retrieve_legacy_secret_key.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RetrieveLegacySecretKey", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.RetrieveLegacySecretKey", + "async": true, + "parameters": [ + { + "name": "key", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse", + "client": { + "shortName": "RecaptchaEnterpriseServiceClient", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient" + }, + "method": { + "shortName": "RetrieveLegacySecretKey", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.RetrieveLegacySecretKey", + "service": { + "shortName": "RecaptchaEnterpriseService", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService" + } + } + } + }, { "regionTag": "recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_GetKey_async", "title": "RecaptchaEnterpriseService getKey Sample", @@ -414,7 +454,7 @@ "segments": [ { "start": 25, - "end": 70, + "end": 71, "type": "FULL" } ], @@ -455,7 +495,7 @@ "regionTag": "recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_ListRelatedAccountGroupMemberships_async", "title": "RecaptchaEnterpriseService listRelatedAccountGroupMemberships Sample", "origin": "API_DEFINITION", - "description": " Get the memberships in a group of related accounts.", + "description": " Get memberships in a group of related accounts.", "canonical": true, "file": "recaptcha_enterprise_service.list_related_account_group_memberships.js", "language": "JAVASCRIPT", @@ -510,7 +550,7 @@ "segments": [ { "start": 25, - "end": 77, + "end": 78, "type": "FULL" } ], diff --git a/packages/google-cloud-recaptchaenterprise/src/v1/gapic_metadata.json b/packages/google-cloud-recaptchaenterprise/src/v1/gapic_metadata.json index 09321f22a15..023c63fe31e 100644 --- a/packages/google-cloud-recaptchaenterprise/src/v1/gapic_metadata.json +++ b/packages/google-cloud-recaptchaenterprise/src/v1/gapic_metadata.json @@ -25,6 +25,11 @@ "createKey" ] }, + "RetrieveLegacySecretKey": { + "methods": [ + "retrieveLegacySecretKey" + ] + }, "GetKey": { "methods": [ "getKey" @@ -98,6 +103,11 @@ "createKey" ] }, + "RetrieveLegacySecretKey": { + "methods": [ + "retrieveLegacySecretKey" + ] + }, "GetKey": { "methods": [ "getKey" diff --git a/packages/google-cloud-recaptchaenterprise/src/v1/recaptcha_enterprise_service_client.ts b/packages/google-cloud-recaptchaenterprise/src/v1/recaptcha_enterprise_service_client.ts index bc800f8e8dc..f4b28da6fb2 100644 --- a/packages/google-cloud-recaptchaenterprise/src/v1/recaptcha_enterprise_service_client.ts +++ b/packages/google-cloud-recaptchaenterprise/src/v1/recaptcha_enterprise_service_client.ts @@ -278,6 +278,7 @@ export class RecaptchaEnterpriseServiceClient { 'annotateAssessment', 'createKey', 'listKeys', + 'retrieveLegacySecretKey', 'getKey', 'updateKey', 'deleteKey', @@ -479,15 +480,14 @@ export class RecaptchaEnterpriseServiceClient { * Required. The resource name of the Assessment, in the format * "projects/{project}/assessments/{assessment}". * @param {google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest.Annotation} [request.annotation] - * Optional. The annotation that will be assigned to the Event. This field can - * be left empty to provide reasons that apply to an event without concluding - * whether the event is legitimate or fraudulent. + * Optional. The annotation that will be assigned to the Event. This field can be left + * empty to provide reasons that apply to an event without concluding whether + * the event is legitimate or fraudulent. * @param {number[]} [request.reasons] - * Optional. Optional reasons for the annotation that will be assigned to the - * Event. + * Optional. Optional reasons for the annotation that will be assigned to the Event. * @param {Buffer} [request.hashedAccountId] - * Optional. Optional unique stable hashed user identifier to apply to the - * assessment. This is an alternative to setting the hashed_account_id in + * Optional. Unique stable hashed user identifier to apply to the assessment. + * This is an alternative to setting the hashed_account_id in * CreateAssessment, for example when the account identifier is not yet known * in the initial request. It is recommended that the identifier is hashed * using hmac-sha256 with stable secret. @@ -675,6 +675,110 @@ export class RecaptchaEnterpriseServiceClient { this.initialize(); return this.innerApiCalls.createKey(request, options, callback); } + /** + * Returns the secret key related to the specified public key. + * You must use the legacy secret key only in a 3rd party integration with + * legacy reCAPTCHA. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.key + * Required. The public key name linked to the requested secret key in the format + * "projects/{project}/keys/{key}". + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [RetrieveLegacySecretKeyResponse]{@link google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/recaptcha_enterprise_service.retrieve_legacy_secret_key.js + * region_tag:recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_RetrieveLegacySecretKey_async + */ + retrieveLegacySecretKey( + request?: protos.google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyResponse, + ( + | protos.google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyRequest + | undefined + ), + {} | undefined + ] + >; + retrieveLegacySecretKey( + request: protos.google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyResponse, + | protos.google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyRequest + | null + | undefined, + {} | null | undefined + > + ): void; + retrieveLegacySecretKey( + request: protos.google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyRequest, + callback: Callback< + protos.google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyResponse, + | protos.google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyRequest + | null + | undefined, + {} | null | undefined + > + ): void; + retrieveLegacySecretKey( + request?: protos.google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyResponse, + | protos.google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyResponse, + | protos.google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyResponse, + ( + | protos.google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + key: request.key ?? '', + }); + this.initialize(); + return this.innerApiCalls.retrieveLegacySecretKey( + request, + options, + callback + ); + } /** * Returns the specified key. * @@ -775,8 +879,8 @@ export class RecaptchaEnterpriseServiceClient { * @param {google.cloud.recaptchaenterprise.v1.Key} request.key * Required. The key to update. * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. The mask to control which fields of the key get updated. If the - * mask is not present, all fields will be updated. + * Optional. The mask to control which fields of the key get updated. If the mask is not + * present, all fields will be updated. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -1348,15 +1452,16 @@ export class RecaptchaEnterpriseServiceClient { * @param {Object} request * The request object that will be sent. * @param {string} request.parent - * Required. The name of the project to list related account groups from, in - * the format "projects/{project}". + * Required. The name of the project to list related account groups from, in the format + * "projects/{project}". * @param {number} [request.pageSize] - * Optional. The maximum number of groups to return. The service may return - * fewer than this value. If unspecified, at most 50 groups will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. + * Optional. The maximum number of groups to return. The service might return fewer than + * this value. + * If unspecified, at most 50 groups are returned. + * The maximum value is 1000; values above 1000 are coerced to 1000. * @param {string} [request.pageToken] - * Optional. A page token, received from a previous `ListRelatedAccountGroups` - * call. Provide this to retrieve the subsequent page. + * Optional. A page token, received from a previous `ListRelatedAccountGroups` call. + * Provide this to retrieve the subsequent page. * * When paginating, all other parameters provided to * `ListRelatedAccountGroups` must match the call that provided the page @@ -1458,15 +1563,16 @@ export class RecaptchaEnterpriseServiceClient { * @param {Object} request * The request object that will be sent. * @param {string} request.parent - * Required. The name of the project to list related account groups from, in - * the format "projects/{project}". + * Required. The name of the project to list related account groups from, in the format + * "projects/{project}". * @param {number} [request.pageSize] - * Optional. The maximum number of groups to return. The service may return - * fewer than this value. If unspecified, at most 50 groups will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. + * Optional. The maximum number of groups to return. The service might return fewer than + * this value. + * If unspecified, at most 50 groups are returned. + * The maximum value is 1000; values above 1000 are coerced to 1000. * @param {string} [request.pageToken] - * Optional. A page token, received from a previous `ListRelatedAccountGroups` - * call. Provide this to retrieve the subsequent page. + * Optional. A page token, received from a previous `ListRelatedAccountGroups` call. + * Provide this to retrieve the subsequent page. * * When paginating, all other parameters provided to * `ListRelatedAccountGroups` must match the call that provided the page @@ -1512,15 +1618,16 @@ export class RecaptchaEnterpriseServiceClient { * @param {Object} request * The request object that will be sent. * @param {string} request.parent - * Required. The name of the project to list related account groups from, in - * the format "projects/{project}". + * Required. The name of the project to list related account groups from, in the format + * "projects/{project}". * @param {number} [request.pageSize] - * Optional. The maximum number of groups to return. The service may return - * fewer than this value. If unspecified, at most 50 groups will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. + * Optional. The maximum number of groups to return. The service might return fewer than + * this value. + * If unspecified, at most 50 groups are returned. + * The maximum value is 1000; values above 1000 are coerced to 1000. * @param {string} [request.pageToken] - * Optional. A page token, received from a previous `ListRelatedAccountGroups` - * call. Provide this to retrieve the subsequent page. + * Optional. A page token, received from a previous `ListRelatedAccountGroups` call. + * Provide this to retrieve the subsequent page. * * When paginating, all other parameters provided to * `ListRelatedAccountGroups` must match the call that provided the page @@ -1560,7 +1667,7 @@ export class RecaptchaEnterpriseServiceClient { ) as AsyncIterable; } /** - * Get the memberships in a group of related accounts. + * Get memberships in a group of related accounts. * * @param {Object} request * The request object that will be sent. @@ -1568,13 +1675,13 @@ export class RecaptchaEnterpriseServiceClient { * Required. The resource name for the related account group in the format * `projects/{project}/relatedaccountgroups/{relatedaccountgroup}`. * @param {number} [request.pageSize] - * Optional. The maximum number of accounts to return. The service may return - * fewer than this value. If unspecified, at most 50 accounts will be - * returned. The maximum value is 1000; values above 1000 will be coerced to - * 1000. + * Optional. The maximum number of accounts to return. The service might return fewer + * than this value. + * If unspecified, at most 50 accounts are returned. + * The maximum value is 1000; values above 1000 are coerced to 1000. * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * `ListRelatedAccountGroupMemberships` call. + * Optional. A page token, received from a previous `ListRelatedAccountGroupMemberships` + * call. * * When paginating, all other parameters provided to * `ListRelatedAccountGroupMemberships` must match the call that provided the @@ -1679,13 +1786,13 @@ export class RecaptchaEnterpriseServiceClient { * Required. The resource name for the related account group in the format * `projects/{project}/relatedaccountgroups/{relatedaccountgroup}`. * @param {number} [request.pageSize] - * Optional. The maximum number of accounts to return. The service may return - * fewer than this value. If unspecified, at most 50 accounts will be - * returned. The maximum value is 1000; values above 1000 will be coerced to - * 1000. + * Optional. The maximum number of accounts to return. The service might return fewer + * than this value. + * If unspecified, at most 50 accounts are returned. + * The maximum value is 1000; values above 1000 are coerced to 1000. * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * `ListRelatedAccountGroupMemberships` call. + * Optional. A page token, received from a previous `ListRelatedAccountGroupMemberships` + * call. * * When paginating, all other parameters provided to * `ListRelatedAccountGroupMemberships` must match the call that provided the @@ -1735,13 +1842,13 @@ export class RecaptchaEnterpriseServiceClient { * Required. The resource name for the related account group in the format * `projects/{project}/relatedaccountgroups/{relatedaccountgroup}`. * @param {number} [request.pageSize] - * Optional. The maximum number of accounts to return. The service may return - * fewer than this value. If unspecified, at most 50 accounts will be - * returned. The maximum value is 1000; values above 1000 will be coerced to - * 1000. + * Optional. The maximum number of accounts to return. The service might return fewer + * than this value. + * If unspecified, at most 50 accounts are returned. + * The maximum value is 1000; values above 1000 are coerced to 1000. * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * `ListRelatedAccountGroupMemberships` call. + * Optional. A page token, received from a previous `ListRelatedAccountGroupMemberships` + * call. * * When paginating, all other parameters provided to * `ListRelatedAccountGroupMemberships` must match the call that provided the @@ -1787,16 +1894,17 @@ export class RecaptchaEnterpriseServiceClient { * @param {Object} request * The request object that will be sent. * @param {string} request.project - * Required. The name of the project to search related account group - * memberships from, in the format "projects/{project}". + * Required. The name of the project to search related account group memberships from. + * Specify the project name in the following format: "projects/{project}". * @param {Buffer} [request.hashedAccountId] - * Optional. The unique stable hashed user identifier we should search - * connections to. The identifier should correspond to a `hashed_account_id` - * provided in a previous CreateAssessment or AnnotateAssessment call. + * Optional. The unique stable hashed user identifier we should search connections to. + * The identifier should correspond to a `hashed_account_id` provided in a + * previous `CreateAssessment` or `AnnotateAssessment` call. * @param {number} [request.pageSize] - * Optional. The maximum number of groups to return. The service may return - * fewer than this value. If unspecified, at most 50 groups will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. + * Optional. The maximum number of groups to return. The service might return fewer than + * this value. + * If unspecified, at most 50 groups are returned. + * The maximum value is 1000; values above 1000 are coerced to 1000. * @param {string} [request.pageToken] * Optional. A page token, received from a previous * `SearchRelatedAccountGroupMemberships` call. Provide this to retrieve the @@ -1902,16 +2010,17 @@ export class RecaptchaEnterpriseServiceClient { * @param {Object} request * The request object that will be sent. * @param {string} request.project - * Required. The name of the project to search related account group - * memberships from, in the format "projects/{project}". + * Required. The name of the project to search related account group memberships from. + * Specify the project name in the following format: "projects/{project}". * @param {Buffer} [request.hashedAccountId] - * Optional. The unique stable hashed user identifier we should search - * connections to. The identifier should correspond to a `hashed_account_id` - * provided in a previous CreateAssessment or AnnotateAssessment call. + * Optional. The unique stable hashed user identifier we should search connections to. + * The identifier should correspond to a `hashed_account_id` provided in a + * previous `CreateAssessment` or `AnnotateAssessment` call. * @param {number} [request.pageSize] - * Optional. The maximum number of groups to return. The service may return - * fewer than this value. If unspecified, at most 50 groups will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. + * Optional. The maximum number of groups to return. The service might return fewer than + * this value. + * If unspecified, at most 50 groups are returned. + * The maximum value is 1000; values above 1000 are coerced to 1000. * @param {string} [request.pageToken] * Optional. A page token, received from a previous * `SearchRelatedAccountGroupMemberships` call. Provide this to retrieve the @@ -1962,16 +2071,17 @@ export class RecaptchaEnterpriseServiceClient { * @param {Object} request * The request object that will be sent. * @param {string} request.project - * Required. The name of the project to search related account group - * memberships from, in the format "projects/{project}". + * Required. The name of the project to search related account group memberships from. + * Specify the project name in the following format: "projects/{project}". * @param {Buffer} [request.hashedAccountId] - * Optional. The unique stable hashed user identifier we should search - * connections to. The identifier should correspond to a `hashed_account_id` - * provided in a previous CreateAssessment or AnnotateAssessment call. + * Optional. The unique stable hashed user identifier we should search connections to. + * The identifier should correspond to a `hashed_account_id` provided in a + * previous `CreateAssessment` or `AnnotateAssessment` call. * @param {number} [request.pageSize] - * Optional. The maximum number of groups to return. The service may return - * fewer than this value. If unspecified, at most 50 groups will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. + * Optional. The maximum number of groups to return. The service might return fewer than + * this value. + * If unspecified, at most 50 groups are returned. + * The maximum value is 1000; values above 1000 are coerced to 1000. * @param {string} [request.pageToken] * Optional. A page token, received from a previous * `SearchRelatedAccountGroupMemberships` call. Provide this to retrieve the diff --git a/packages/google-cloud-recaptchaenterprise/src/v1/recaptcha_enterprise_service_client_config.json b/packages/google-cloud-recaptchaenterprise/src/v1/recaptcha_enterprise_service_client_config.json index 66fe297cf6f..acb5f95bd9c 100644 --- a/packages/google-cloud-recaptchaenterprise/src/v1/recaptcha_enterprise_service_client_config.json +++ b/packages/google-cloud-recaptchaenterprise/src/v1/recaptcha_enterprise_service_client_config.json @@ -40,6 +40,10 @@ "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, + "RetrieveLegacySecretKey": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, "GetKey": { "timeout_millis": 600000, "retry_codes_name": "non_idempotent", diff --git a/packages/google-cloud-recaptchaenterprise/test/gapic_recaptcha_enterprise_service_v1.ts b/packages/google-cloud-recaptchaenterprise/test/gapic_recaptcha_enterprise_service_v1.ts index db170b7bde6..ab5f746919a 100644 --- a/packages/google-cloud-recaptchaenterprise/test/gapic_recaptcha_enterprise_service_v1.ts +++ b/packages/google-cloud-recaptchaenterprise/test/gapic_recaptcha_enterprise_service_v1.ts @@ -674,6 +674,155 @@ describe('v1.RecaptchaEnterpriseServiceClient', () => { }); }); + describe('retrieveLegacySecretKey', () => { + it('invokes retrieveLegacySecretKey without error', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest', + ['key'] + ); + request.key = defaultValue1; + const expectedHeaderRequestParams = `key=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse() + ); + client.innerApiCalls.retrieveLegacySecretKey = + stubSimpleCall(expectedResponse); + const [response] = await client.retrieveLegacySecretKey(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.retrieveLegacySecretKey as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.retrieveLegacySecretKey as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes retrieveLegacySecretKey without error using callback', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest', + ['key'] + ); + request.key = defaultValue1; + const expectedHeaderRequestParams = `key=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse() + ); + client.innerApiCalls.retrieveLegacySecretKey = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.retrieveLegacySecretKey( + request, + ( + err?: Error | null, + result?: protos.google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.retrieveLegacySecretKey as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.retrieveLegacySecretKey as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes retrieveLegacySecretKey with error', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest', + ['key'] + ); + request.key = defaultValue1; + const expectedHeaderRequestParams = `key=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.retrieveLegacySecretKey = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.retrieveLegacySecretKey(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.retrieveLegacySecretKey as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.retrieveLegacySecretKey as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes retrieveLegacySecretKey with closed client', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest', + ['key'] + ); + request.key = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects( + client.retrieveLegacySecretKey(request), + expectedError + ); + }); + }); + describe('getKey', () => { it('invokes getKey without error', async () => { const client =