// Copyright 2022 Luca Casonato. All rights reserved. MIT license. /** * reCAPTCHA Enterprise API Client for Deno * ======================================== * * Help protect your website from fraudulent activity, spam, and abuse without creating friction. * * Docs: https://cloud.google.com/recaptcha-enterprise/ * Source: https://googleapis.deno.dev/v1/recaptchaenterprise:v1.ts */ import { auth, CredentialsClient, GoogleAuth, request } from "/_/base@v1/mod.ts"; export { auth, GoogleAuth }; export type { CredentialsClient }; /** * Help protect your website from fraudulent activity, spam, and abuse without * creating friction. */ export class reCAPTCHAEnterprise { #client: CredentialsClient | undefined; #baseUrl: string; constructor(client?: CredentialsClient, baseUrl: string = "https://recaptchaenterprise.googleapis.com/") { this.#client = client; this.#baseUrl = baseUrl; } /** * Annotates a previously created Assessment to provide additional * information on whether the event turned out to be authentic or fraudulent. * * @param name Required. The resource name of the Assessment, in the format `projects/{project}/assessments/{assessment}`. */ async projectsAssessmentsAnnotate(name: string, req: GoogleCloudRecaptchaenterpriseV1AnnotateAssessmentRequest): Promise { req = serializeGoogleCloudRecaptchaenterpriseV1AnnotateAssessmentRequest(req); const url = new URL(`${this.#baseUrl}v1/${ name }:annotate`); const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); return data as GoogleCloudRecaptchaenterpriseV1AnnotateAssessmentResponse; } /** * Creates an Assessment of the likelihood an event is legitimate. * * @param parent Required. The name of the project in which the assessment is created, in the format `projects/{project}`. */ async projectsAssessmentsCreate(parent: string, req: GoogleCloudRecaptchaenterpriseV1Assessment): Promise { req = serializeGoogleCloudRecaptchaenterpriseV1Assessment(req); const url = new URL(`${this.#baseUrl}v1/${ parent }/assessments`); const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); return deserializeGoogleCloudRecaptchaenterpriseV1Assessment(data); } /** * Creates a new FirewallPolicy, specifying conditions at which reCAPTCHA * Enterprise actions can be executed. A project may have a maximum of 1000 * policies. * * @param parent Required. The name of the project this policy applies to, in the format `projects/{project}`. */ async projectsFirewallpoliciesCreate(parent: string, req: GoogleCloudRecaptchaenterpriseV1FirewallPolicy): Promise { const url = new URL(`${this.#baseUrl}v1/${ parent }/firewallpolicies`); const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); return data as GoogleCloudRecaptchaenterpriseV1FirewallPolicy; } /** * Deletes the specified firewall policy. * * @param name Required. The name of the policy to be deleted, in the format `projects/{project}/firewallpolicies/{firewallpolicy}`. */ async projectsFirewallpoliciesDelete(name: string): Promise { const url = new URL(`${this.#baseUrl}v1/${ name }`); const data = await request(url.href, { client: this.#client, method: "DELETE", }); return data as GoogleProtobufEmpty; } /** * Returns the specified firewall policy. * * @param name Required. The name of the requested policy, in the format `projects/{project}/firewallpolicies/{firewallpolicy}`. */ async projectsFirewallpoliciesGet(name: string): Promise { const url = new URL(`${this.#baseUrl}v1/${ name }`); const data = await request(url.href, { client: this.#client, method: "GET", }); return data as GoogleCloudRecaptchaenterpriseV1FirewallPolicy; } /** * Returns the list of all firewall policies that belong to a project. * * @param parent Required. The name of the project to list the policies for, in the format `projects/{project}`. */ async projectsFirewallpoliciesList(parent: string, opts: ProjectsFirewallpoliciesListOptions = {}): Promise { const url = new URL(`${this.#baseUrl}v1/${ parent }/firewallpolicies`); if (opts.pageSize !== undefined) { url.searchParams.append("pageSize", String(opts.pageSize)); } if (opts.pageToken !== undefined) { url.searchParams.append("pageToken", String(opts.pageToken)); } const data = await request(url.href, { client: this.#client, method: "GET", }); return data as GoogleCloudRecaptchaenterpriseV1ListFirewallPoliciesResponse; } /** * Updates the specified firewall policy. * * @param name Identifier. The resource name for the FirewallPolicy in the format `projects/{project}/firewallpolicies/{firewallpolicy}`. */ async projectsFirewallpoliciesPatch(name: string, req: GoogleCloudRecaptchaenterpriseV1FirewallPolicy, opts: ProjectsFirewallpoliciesPatchOptions = {}): Promise { opts = serializeProjectsFirewallpoliciesPatchOptions(opts); const url = new URL(`${this.#baseUrl}v1/${ name }`); if (opts.updateMask !== undefined) { url.searchParams.append("updateMask", String(opts.updateMask)); } const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "PATCH", body, }); return data as GoogleCloudRecaptchaenterpriseV1FirewallPolicy; } /** * Reorders all firewall policies. * * @param parent Required. The name of the project to list the policies for, in the format `projects/{project}`. */ async projectsFirewallpoliciesReorder(parent: string, req: GoogleCloudRecaptchaenterpriseV1ReorderFirewallPoliciesRequest): Promise { const url = new URL(`${this.#baseUrl}v1/${ parent }/firewallpolicies:reorder`); const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); return data as GoogleCloudRecaptchaenterpriseV1ReorderFirewallPoliciesResponse; } /** * Adds an IP override to a key. The following restrictions hold: * The * maximum number of IP overrides per key is 100. * For any conflict (such as * IP already exists or IP part of an existing IP range), an error is * returned. * * @param name Required. The name of the key to which the IP override is added, in the format `projects/{project}/keys/{key}`. */ async projectsKeysAddIpOverride(name: string, req: GoogleCloudRecaptchaenterpriseV1AddIpOverrideRequest): Promise { const url = new URL(`${this.#baseUrl}v1/${ name }:addIpOverride`); const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); return data as GoogleCloudRecaptchaenterpriseV1AddIpOverrideResponse; } /** * Creates a new reCAPTCHA Enterprise key. * * @param parent Required. The name of the project in which the key is created, in the format `projects/{project}`. */ async projectsKeysCreate(parent: string, req: GoogleCloudRecaptchaenterpriseV1Key): Promise { const url = new URL(`${this.#baseUrl}v1/${ parent }/keys`); const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); return data as GoogleCloudRecaptchaenterpriseV1Key; } /** * Deletes the specified key. * * @param name Required. The name of the key to be deleted, in the format `projects/{project}/keys/{key}`. */ async projectsKeysDelete(name: string): Promise { const url = new URL(`${this.#baseUrl}v1/${ name }`); const data = await request(url.href, { client: this.#client, method: "DELETE", }); return data as GoogleProtobufEmpty; } /** * Returns the specified key. * * @param name Required. The name of the requested key, in the format `projects/{project}/keys/{key}`. */ async projectsKeysGet(name: string): Promise { const url = new URL(`${this.#baseUrl}v1/${ name }`); const data = await request(url.href, { client: this.#client, method: "GET", }); return data as GoogleCloudRecaptchaenterpriseV1Key; } /** * Get some aggregated metrics for a Key. This data can be used to build * dashboards. * * @param name Required. The name of the requested metrics, in the format `projects/{project}/keys/{key}/metrics`. */ async projectsKeysGetMetrics(name: string): Promise { const url = new URL(`${this.#baseUrl}v1/${ name }`); const data = await request(url.href, { client: this.#client, method: "GET", }); return deserializeGoogleCloudRecaptchaenterpriseV1Metrics(data); } /** * Returns the list of all keys that belong to a project. * * @param parent Required. The name of the project that contains the keys that is listed, in the format `projects/{project}`. */ async projectsKeysList(parent: string, opts: ProjectsKeysListOptions = {}): Promise { const url = new URL(`${this.#baseUrl}v1/${ parent }/keys`); if (opts.pageSize !== undefined) { url.searchParams.append("pageSize", String(opts.pageSize)); } if (opts.pageToken !== undefined) { url.searchParams.append("pageToken", String(opts.pageToken)); } const data = await request(url.href, { client: this.#client, method: "GET", }); return data as GoogleCloudRecaptchaenterpriseV1ListKeysResponse; } /** * Lists all IP overrides for a key. * * @param parent Required. The parent key for which the IP overrides are listed, in the format `projects/{project}/keys/{key}`. */ async projectsKeysListIpOverrides(parent: string, opts: ProjectsKeysListIpOverridesOptions = {}): Promise { const url = new URL(`${this.#baseUrl}v1/${ parent }:listIpOverrides`); if (opts.pageSize !== undefined) { url.searchParams.append("pageSize", String(opts.pageSize)); } if (opts.pageToken !== undefined) { url.searchParams.append("pageToken", String(opts.pageToken)); } const data = await request(url.href, { client: this.#client, method: "GET", }); return data as GoogleCloudRecaptchaenterpriseV1ListIpOverridesResponse; } /** * Migrates an existing key from reCAPTCHA to reCAPTCHA Enterprise. Once a * key is migrated, it can be used from either product. SiteVerify requests * are billed as CreateAssessment calls. You must be authenticated as one of * the current owners of the reCAPTCHA Key, and your user must have the * reCAPTCHA Enterprise Admin IAM role in the destination project. * * @param name Required. The name of the key to be migrated, in the format `projects/{project}/keys/{key}`. */ async projectsKeysMigrate(name: string, req: GoogleCloudRecaptchaenterpriseV1MigrateKeyRequest): Promise { const url = new URL(`${this.#baseUrl}v1/${ name }:migrate`); const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); return data as GoogleCloudRecaptchaenterpriseV1Key; } /** * Updates the specified key. * * @param name Identifier. The resource name for the Key in the format `projects/{project}/keys/{key}`. */ async projectsKeysPatch(name: string, req: GoogleCloudRecaptchaenterpriseV1Key, opts: ProjectsKeysPatchOptions = {}): Promise { opts = serializeProjectsKeysPatchOptions(opts); const url = new URL(`${this.#baseUrl}v1/${ name }`); if (opts.updateMask !== undefined) { url.searchParams.append("updateMask", String(opts.updateMask)); } const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "PATCH", body, }); return data as GoogleCloudRecaptchaenterpriseV1Key; } /** * Removes an IP override from a key. The following restrictions hold: * If * the IP isn't found in an existing IP override, a `NOT_FOUND` error is * returned. * If the IP is found in an existing IP override, but the override * type does not match, a `NOT_FOUND` error is returned. * * @param name Required. The name of the key from which the IP override is removed, in the format `projects/{project}/keys/{key}`. */ async projectsKeysRemoveIpOverride(name: string, req: GoogleCloudRecaptchaenterpriseV1RemoveIpOverrideRequest): Promise { const url = new URL(`${this.#baseUrl}v1/${ name }:removeIpOverride`); const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); return data as GoogleCloudRecaptchaenterpriseV1RemoveIpOverrideResponse; } /** * 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 key Required. The public key name linked to the requested secret key in the format `projects/{project}/keys/{key}`. */ async projectsKeysRetrieveLegacySecretKey(key: string): Promise { const url = new URL(`${this.#baseUrl}v1/${ key }:retrieveLegacySecretKey`); const data = await request(url.href, { client: this.#client, method: "GET", }); return data as GoogleCloudRecaptchaenterpriseV1RetrieveLegacySecretKeyResponse; } /** * Search group memberships related to a given account. * * @param project Required. The name of the project to search related account group memberships from. Specify the project name in the following format: `projects/{project}`. */ async projectsRelatedaccountgroupmembershipsSearch(project: string, req: GoogleCloudRecaptchaenterpriseV1SearchRelatedAccountGroupMembershipsRequest): Promise { req = serializeGoogleCloudRecaptchaenterpriseV1SearchRelatedAccountGroupMembershipsRequest(req); const url = new URL(`${this.#baseUrl}v1/${ project }/relatedaccountgroupmemberships:search`); const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); return deserializeGoogleCloudRecaptchaenterpriseV1SearchRelatedAccountGroupMembershipsResponse(data); } /** * List groups of related accounts. * * @param parent Required. The name of the project to list related account groups from, in the format `projects/{project}`. */ async projectsRelatedaccountgroupsList(parent: string, opts: ProjectsRelatedaccountgroupsListOptions = {}): Promise { const url = new URL(`${this.#baseUrl}v1/${ parent }/relatedaccountgroups`); if (opts.pageSize !== undefined) { url.searchParams.append("pageSize", String(opts.pageSize)); } if (opts.pageToken !== undefined) { url.searchParams.append("pageToken", String(opts.pageToken)); } const data = await request(url.href, { client: this.#client, method: "GET", }); return data as GoogleCloudRecaptchaenterpriseV1ListRelatedAccountGroupsResponse; } /** * Get memberships in a group of related accounts. * * @param parent Required. The resource name for the related account group in the format `projects/{project}/relatedaccountgroups/{relatedaccountgroup}`. */ async projectsRelatedaccountgroupsMembershipsList(parent: string, opts: ProjectsRelatedaccountgroupsMembershipsListOptions = {}): Promise { const url = new URL(`${this.#baseUrl}v1/${ parent }/memberships`); if (opts.pageSize !== undefined) { url.searchParams.append("pageSize", String(opts.pageSize)); } if (opts.pageToken !== undefined) { url.searchParams.append("pageToken", String(opts.pageToken)); } const data = await request(url.href, { client: this.#client, method: "GET", }); return deserializeGoogleCloudRecaptchaenterpriseV1ListRelatedAccountGroupMembershipsResponse(data); } } /** * Account defender risk assessment. */ export interface GoogleCloudRecaptchaenterpriseV1AccountDefenderAssessment { /** * Output only. Labels for this request. */ readonly labels?: | "ACCOUNT_DEFENDER_LABEL_UNSPECIFIED" | "PROFILE_MATCH" | "SUSPICIOUS_LOGIN_ACTIVITY" | "SUSPICIOUS_ACCOUNT_CREATION" | "RELATED_ACCOUNTS_NUMBER_HIGH"[]; } /** * Information about account verification, used for identity verification. */ export interface GoogleCloudRecaptchaenterpriseV1AccountVerificationInfo { /** * Optional. Endpoints that can be used for identity verification. */ endpoints?: GoogleCloudRecaptchaenterpriseV1EndpointVerificationInfo[]; /** * Optional. Language code preference for the verification message, set as a * IETF BCP 47 language code. */ languageCode?: string; /** * Output only. Result of the latest account verification challenge. */ readonly latestVerificationResult?: | "RESULT_UNSPECIFIED" | "SUCCESS_USER_VERIFIED" | "ERROR_USER_NOT_VERIFIED" | "ERROR_SITE_ONBOARDING_INCOMPLETE" | "ERROR_RECIPIENT_NOT_ALLOWED" | "ERROR_RECIPIENT_ABUSE_LIMIT_EXHAUSTED" | "ERROR_CRITICAL_INTERNAL" | "ERROR_CUSTOMER_QUOTA_EXHAUSTED" | "ERROR_VERIFICATION_BYPASSED" | "ERROR_VERDICT_MISMATCH"; /** * Username of the account that is being verified. Deprecated. Customers * should now provide the `account_id` field in `event.user_info`. */ username?: string; } /** * The AddIpOverride request message. */ export interface GoogleCloudRecaptchaenterpriseV1AddIpOverrideRequest { /** * Required. IP override added to the key. */ ipOverrideData?: GoogleCloudRecaptchaenterpriseV1IpOverrideData; } /** * Response for AddIpOverride. */ export interface GoogleCloudRecaptchaenterpriseV1AddIpOverrideResponse { } /** * Settings specific to keys that can be used by Android apps. */ export interface GoogleCloudRecaptchaenterpriseV1AndroidKeySettings { /** * Optional. If set to true, allowed_package_names are not enforced. */ allowAllPackageNames?: boolean; /** * Optional. Android package names of apps allowed to use the key. Example: * 'com.companyname.appname' */ allowedPackageNames?: string[]; /** * Optional. Set to true for keys that are used in an Android application * that is available for download in app stores in addition to the Google Play * Store. */ supportNonGoogleAppStoreDistribution?: boolean; } /** * The request message to annotate an Assessment. */ export interface GoogleCloudRecaptchaenterpriseV1AnnotateAssessmentRequest { /** * Optional. A stable account identifier to apply to the assessment. This is * an alternative to setting `account_id` in `CreateAssessment`, for example * when a stable account identifier is not yet known in the initial request. */ accountId?: string; /** * Optional. The annotation that is 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_UNSPECIFIED" | "LEGITIMATE" | "FRAUDULENT" | "PASSWORD_CORRECT" | "PASSWORD_INCORRECT"; /** * Optional. A stable hashed account identifier to apply to the assessment. * This is an alternative to setting `hashed_account_id` in * `CreateAssessment`, for example when a stable account identifier is not yet * known in the initial request. */ hashedAccountId?: Uint8Array; /** * Optional. Reasons for the annotation that are assigned to the event. */ reasons?: | "REASON_UNSPECIFIED" | "CHARGEBACK" | "CHARGEBACK_FRAUD" | "CHARGEBACK_DISPUTE" | "REFUND" | "REFUND_FRAUD" | "TRANSACTION_ACCEPTED" | "TRANSACTION_DECLINED" | "PAYMENT_HEURISTICS" | "INITIATED_TWO_FACTOR" | "PASSED_TWO_FACTOR" | "FAILED_TWO_FACTOR" | "CORRECT_PASSWORD" | "INCORRECT_PASSWORD" | "SOCIAL_SPAM"[]; /** * Optional. If the assessment is part of a payment transaction, provide * details on payment lifecycle events that occur in the transaction. */ transactionEvent?: GoogleCloudRecaptchaenterpriseV1TransactionEvent; } function serializeGoogleCloudRecaptchaenterpriseV1AnnotateAssessmentRequest(data: any): GoogleCloudRecaptchaenterpriseV1AnnotateAssessmentRequest { return { ...data, hashedAccountId: data["hashedAccountId"] !== undefined ? encodeBase64(data["hashedAccountId"]) : undefined, transactionEvent: data["transactionEvent"] !== undefined ? serializeGoogleCloudRecaptchaenterpriseV1TransactionEvent(data["transactionEvent"]) : undefined, }; } function deserializeGoogleCloudRecaptchaenterpriseV1AnnotateAssessmentRequest(data: any): GoogleCloudRecaptchaenterpriseV1AnnotateAssessmentRequest { return { ...data, hashedAccountId: data["hashedAccountId"] !== undefined ? decodeBase64(data["hashedAccountId"] as string) : undefined, transactionEvent: data["transactionEvent"] !== undefined ? deserializeGoogleCloudRecaptchaenterpriseV1TransactionEvent(data["transactionEvent"]) : undefined, }; } /** * Empty response for AnnotateAssessment. */ export interface GoogleCloudRecaptchaenterpriseV1AnnotateAssessmentResponse { } /** * Contains fields that are required to perform Apple-specific integrity * checks. */ export interface GoogleCloudRecaptchaenterpriseV1AppleDeveloperId { /** * Required. The Apple developer key ID (10-character string). */ keyId?: string; /** * Required. Input only. A private key (downloaded as a text file with a .p8 * file extension) generated for your Apple Developer account. Ensure that * Apple DeviceCheck is enabled for the private key. */ privateKey?: string; /** * Required. The Apple team ID (10-character string) owning the provisioning * profile used to build your application. */ teamId?: string; } /** * A reCAPTCHA Enterprise assessment resource. */ export interface GoogleCloudRecaptchaenterpriseV1Assessment { /** * Output only. Assessment returned by account defender when an account * identifier is provided. */ readonly accountDefenderAssessment?: GoogleCloudRecaptchaenterpriseV1AccountDefenderAssessment; /** * Optional. Account verification information for identity verification. The * assessment event must include a token and site key to use this feature. */ accountVerification?: GoogleCloudRecaptchaenterpriseV1AccountVerificationInfo; /** * Optional. The environment creating the assessment. This describes your * environment (the system invoking CreateAssessment), NOT the environment of * your user. */ assessmentEnvironment?: GoogleCloudRecaptchaenterpriseV1AssessmentEnvironment; /** * Optional. The event being assessed. */ event?: GoogleCloudRecaptchaenterpriseV1Event; /** * Output only. Assessment returned when firewall policies belonging to the * project are evaluated using the field firewall_policy_evaluation. */ readonly firewallPolicyAssessment?: GoogleCloudRecaptchaenterpriseV1FirewallPolicyAssessment; /** * Output only. Assessment returned by Fraud Prevention when TransactionData * is provided. */ readonly fraudPreventionAssessment?: GoogleCloudRecaptchaenterpriseV1FraudPreventionAssessment; /** * Output only. Fraud Signals specific to the users involved in a payment * transaction. */ readonly fraudSignals?: GoogleCloudRecaptchaenterpriseV1FraudSignals; /** * Output only. Identifier. The resource name for the Assessment in the * format `projects/{project}/assessments/{assessment}`. */ readonly name?: string; /** * Output only. Assessment returned when a site key, a token, and a phone * number as `user_id` are provided. Account defender and SMS toll fraud * protection need to be enabled. */ readonly phoneFraudAssessment?: GoogleCloudRecaptchaenterpriseV1PhoneFraudAssessment; /** * Optional. The private password leak verification field contains the * parameters that are used to to check for leaks privately without sharing * user credentials. */ privatePasswordLeakVerification?: GoogleCloudRecaptchaenterpriseV1PrivatePasswordLeakVerification; /** * Output only. The risk analysis result for the event being assessed. */ readonly riskAnalysis?: GoogleCloudRecaptchaenterpriseV1RiskAnalysis; /** * Output only. Properties of the provided event token. */ readonly tokenProperties?: GoogleCloudRecaptchaenterpriseV1TokenProperties; } function serializeGoogleCloudRecaptchaenterpriseV1Assessment(data: any): GoogleCloudRecaptchaenterpriseV1Assessment { return { ...data, event: data["event"] !== undefined ? serializeGoogleCloudRecaptchaenterpriseV1Event(data["event"]) : undefined, privatePasswordLeakVerification: data["privatePasswordLeakVerification"] !== undefined ? serializeGoogleCloudRecaptchaenterpriseV1PrivatePasswordLeakVerification(data["privatePasswordLeakVerification"]) : undefined, }; } function deserializeGoogleCloudRecaptchaenterpriseV1Assessment(data: any): GoogleCloudRecaptchaenterpriseV1Assessment { return { ...data, event: data["event"] !== undefined ? deserializeGoogleCloudRecaptchaenterpriseV1Event(data["event"]) : undefined, privatePasswordLeakVerification: data["privatePasswordLeakVerification"] !== undefined ? deserializeGoogleCloudRecaptchaenterpriseV1PrivatePasswordLeakVerification(data["privatePasswordLeakVerification"]) : undefined, }; } /** * The environment creating the assessment. This describes your environment * (the system invoking CreateAssessment), NOT the environment of your user. */ export interface GoogleCloudRecaptchaenterpriseV1AssessmentEnvironment { /** * Optional. Identifies the client module initiating the CreateAssessment * request. This can be the link to the client module's project. Examples * include: - * "github.com/GoogleCloudPlatform/recaptcha-enterprise-google-tag-manager" - * "cloud.google.com/recaptcha/docs/implement-waf-akamai" - * "cloud.google.com/recaptcha/docs/implement-waf-cloudflare" - * "wordpress.org/plugins/recaptcha-something" */ client?: string; /** * Optional. The version of the client module. For example, "1.0.0". */ version?: string; } /** * Metrics related to challenges. */ export interface GoogleCloudRecaptchaenterpriseV1ChallengeMetrics { /** * Count of submitted challenge solutions that were incorrect or otherwise * deemed suspicious such that a subsequent challenge was triggered. */ failedCount?: bigint; /** * Count of nocaptchas (successful verification without a challenge) issued. */ nocaptchaCount?: bigint; /** * Count of reCAPTCHA checkboxes or badges rendered. This is mostly * equivalent to a count of pageloads for pages that include reCAPTCHA. */ pageloadCount?: bigint; /** * Count of nocaptchas (successful verification without a challenge) plus * submitted challenge solutions that were correct and resulted in * verification. */ passedCount?: bigint; } function serializeGoogleCloudRecaptchaenterpriseV1ChallengeMetrics(data: any): GoogleCloudRecaptchaenterpriseV1ChallengeMetrics { return { ...data, failedCount: data["failedCount"] !== undefined ? String(data["failedCount"]) : undefined, nocaptchaCount: data["nocaptchaCount"] !== undefined ? String(data["nocaptchaCount"]) : undefined, pageloadCount: data["pageloadCount"] !== undefined ? String(data["pageloadCount"]) : undefined, passedCount: data["passedCount"] !== undefined ? String(data["passedCount"]) : undefined, }; } function deserializeGoogleCloudRecaptchaenterpriseV1ChallengeMetrics(data: any): GoogleCloudRecaptchaenterpriseV1ChallengeMetrics { return { ...data, failedCount: data["failedCount"] !== undefined ? BigInt(data["failedCount"]) : undefined, nocaptchaCount: data["nocaptchaCount"] !== undefined ? BigInt(data["nocaptchaCount"]) : undefined, pageloadCount: data["pageloadCount"] !== undefined ? BigInt(data["pageloadCount"]) : undefined, passedCount: data["passedCount"] !== undefined ? BigInt(data["passedCount"]) : undefined, }; } /** * Information about a verification endpoint that can be used for 2FA. */ export interface GoogleCloudRecaptchaenterpriseV1EndpointVerificationInfo { /** * Email address for which to trigger a verification request. */ emailAddress?: string; /** * Output only. Timestamp of the last successful verification for the * endpoint, if any. */ readonly lastVerificationTime?: Date; /** * Phone number for which to trigger a verification request. Should be given * in E.164 format. */ phoneNumber?: string; /** * Output only. Token to provide to the client to trigger endpoint * verification. It must be used within 15 minutes. */ readonly requestToken?: string; } /** * The event being assessed. */ export interface GoogleCloudRecaptchaenterpriseV1Event { /** * 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. */ expectedAction?: string; /** * Optional. Flag for a reCAPTCHA express request for an assessment without a * token. If enabled, `site_key` must reference an Express site key. */ express?: boolean; /** * Optional. Flag for enabling firewall policy config assessment. If this * flag is enabled, the firewall policy is evaluated and a suggested firewall * action is returned in the response. */ firewallPolicyEvaluation?: boolean; /** * Optional. The Fraud Prevention setting for this assessment. */ fraudPrevention?: | "FRAUD_PREVENTION_UNSPECIFIED" | "ENABLED" | "DISABLED"; /** * Optional. Deprecated: use `user_info.account_id` instead. Unique stable * hashed user identifier for the request. The identifier must be hashed using * hmac-sha256 with stable secret. */ hashedAccountId?: Uint8Array; /** * Optional. HTTP header information about the request. */ headers?: string[]; /** * Optional. JA3 fingerprint for SSL clients. */ ja3?: string; /** * Optional. The URI resource the user requested that triggered an * assessment. */ requestedUri?: string; /** * Optional. The site key that was used to invoke reCAPTCHA Enterprise on * your site and generate the token. */ siteKey?: string; /** * Optional. The user response token provided by the reCAPTCHA Enterprise * client-side integration on your site. */ token?: string; /** * Optional. Data describing a payment transaction to be assessed. Sending * this data enables reCAPTCHA Enterprise Fraud Prevention and the * FraudPreventionAssessment component in the response. */ transactionData?: GoogleCloudRecaptchaenterpriseV1TransactionData; /** * Optional. The user agent present in the request from the user's device * related to this event. */ userAgent?: string; /** * Optional. Information about the user that generates this event, when they * can be identified. They are often identified through the use of an account * for logged-in requests or login/registration requests, or by providing user * identifiers for guest actions like checkout. */ userInfo?: GoogleCloudRecaptchaenterpriseV1UserInfo; /** * Optional. The IP address in the request from the user's device related to * this event. */ userIpAddress?: string; /** * Optional. Flag for running WAF token assessment. If enabled, the token * must be specified, and have been created by a WAF-enabled key. */ wafTokenAssessment?: boolean; } function serializeGoogleCloudRecaptchaenterpriseV1Event(data: any): GoogleCloudRecaptchaenterpriseV1Event { return { ...data, hashedAccountId: data["hashedAccountId"] !== undefined ? encodeBase64(data["hashedAccountId"]) : undefined, transactionData: data["transactionData"] !== undefined ? serializeGoogleCloudRecaptchaenterpriseV1TransactionData(data["transactionData"]) : undefined, userInfo: data["userInfo"] !== undefined ? serializeGoogleCloudRecaptchaenterpriseV1UserInfo(data["userInfo"]) : undefined, }; } function deserializeGoogleCloudRecaptchaenterpriseV1Event(data: any): GoogleCloudRecaptchaenterpriseV1Event { return { ...data, hashedAccountId: data["hashedAccountId"] !== undefined ? decodeBase64(data["hashedAccountId"] as string) : undefined, transactionData: data["transactionData"] !== undefined ? deserializeGoogleCloudRecaptchaenterpriseV1TransactionData(data["transactionData"]) : undefined, userInfo: data["userInfo"] !== undefined ? deserializeGoogleCloudRecaptchaenterpriseV1UserInfo(data["userInfo"]) : undefined, }; } /** * Settings specific to keys that can be used for reCAPTCHA Express. */ export interface GoogleCloudRecaptchaenterpriseV1ExpressKeySettings { } /** * An individual action. Each action represents what to do if a policy matches. */ export interface GoogleCloudRecaptchaenterpriseV1FirewallAction { /** * The user request did not match any policy and should be allowed access to * the requested resource. */ allow?: GoogleCloudRecaptchaenterpriseV1FirewallActionAllowAction; /** * This action denies access to a given page. The user gets an HTTP error * code. */ block?: GoogleCloudRecaptchaenterpriseV1FirewallActionBlockAction; /** * This action injects reCAPTCHA JavaScript code into the HTML page returned * by the site backend. */ includeRecaptchaScript?: GoogleCloudRecaptchaenterpriseV1FirewallActionIncludeRecaptchaScriptAction; /** * This action redirects the request to a reCAPTCHA interstitial to attach a * token. */ redirect?: GoogleCloudRecaptchaenterpriseV1FirewallActionRedirectAction; /** * This action sets a custom header but allow the request to continue to the * customer backend. */ setHeader?: GoogleCloudRecaptchaenterpriseV1FirewallActionSetHeaderAction; /** * This action transparently serves a different page to an offending user. */ substitute?: GoogleCloudRecaptchaenterpriseV1FirewallActionSubstituteAction; } /** * An allow action continues processing a request unimpeded. */ export interface GoogleCloudRecaptchaenterpriseV1FirewallActionAllowAction { } /** * A block action serves an HTTP error code a prevents the request from hitting * the backend. */ export interface GoogleCloudRecaptchaenterpriseV1FirewallActionBlockAction { } /** * An include reCAPTCHA script action involves injecting reCAPTCHA JavaScript * code into the HTML returned by the site backend. This reCAPTCHA script is * tasked with collecting user signals on the requested web page, issuing tokens * as a cookie within the site domain, and enabling their utilization in * subsequent page requests. */ export interface GoogleCloudRecaptchaenterpriseV1FirewallActionIncludeRecaptchaScriptAction { } /** * A redirect action returns a 307 (temporary redirect) response, pointing the * user to a reCAPTCHA interstitial page to attach a token. */ export interface GoogleCloudRecaptchaenterpriseV1FirewallActionRedirectAction { } /** * A set header action sets a header and forwards the request to the backend. * This can be used to trigger custom protection implemented on the backend. */ export interface GoogleCloudRecaptchaenterpriseV1FirewallActionSetHeaderAction { /** * Optional. The header key to set in the request to the backend server. */ key?: string; /** * Optional. The header value to set in the request to the backend server. */ value?: string; } /** * A substitute action transparently serves a different page than the one * requested. */ export interface GoogleCloudRecaptchaenterpriseV1FirewallActionSubstituteAction { /** * Optional. The address to redirect to. The target is a relative path in the * current host. Example: "/blog/404.html". */ path?: string; } /** * A FirewallPolicy represents a single matching pattern and resulting actions * to take. */ export interface GoogleCloudRecaptchaenterpriseV1FirewallPolicy { /** * Optional. The actions that the caller should take regarding user access. * There should be at most one terminal action. A terminal action is any * action that forces a response, such as `AllowAction`, `BlockAction` or * `SubstituteAction`. Zero or more non-terminal actions such as `SetHeader` * might be specified. A single policy can contain up to 16 actions. */ actions?: GoogleCloudRecaptchaenterpriseV1FirewallAction[]; /** * Optional. A CEL (Common Expression Language) conditional expression that * specifies if this policy applies to an incoming user request. If this * condition evaluates to true and the requested path matched the path * pattern, the associated actions should be executed by the caller. The * condition string is checked for CEL syntax correctness on creation. For * more information, see the [CEL spec](https://github.com/google/cel-spec) * and its [language * definition](https://github.com/google/cel-spec/blob/master/doc/langdef.md). * A condition has a max length of 500 characters. */ condition?: string; /** * Optional. A description of what this policy aims to achieve, for * convenience purposes. The description can at most include 256 UTF-8 * characters. */ description?: string; /** * Identifier. The resource name for the FirewallPolicy in the format * `projects/{project}/firewallpolicies/{firewallpolicy}`. */ name?: string; /** * Optional. The path for which this policy applies, specified as a glob * pattern. For more information on glob, see the [manual * page](https://man7.org/linux/man-pages/man7/glob.7.html). A path has a max * length of 200 characters. */ path?: string; } /** * Policy config assessment. */ export interface GoogleCloudRecaptchaenterpriseV1FirewallPolicyAssessment { /** * Output only. If the processing of a policy config fails, an error is * populated and the firewall_policy is left empty. */ readonly error?: GoogleRpcStatus; /** * Output only. The policy that matched the request. If more than one policy * may match, this is the first match. If no policy matches the incoming * request, the policy field is left empty. */ readonly firewallPolicy?: GoogleCloudRecaptchaenterpriseV1FirewallPolicy; } /** * Assessment for Fraud Prevention. */ export interface GoogleCloudRecaptchaenterpriseV1FraudPreventionAssessment { /** * Output only. Assessment of this transaction for behavioral trust. */ readonly behavioralTrustVerdict?: GoogleCloudRecaptchaenterpriseV1FraudPreventionAssessmentBehavioralTrustVerdict; /** * Output only. Assessment of this transaction for risk of being part of a * card testing attack. */ readonly cardTestingVerdict?: GoogleCloudRecaptchaenterpriseV1FraudPreventionAssessmentCardTestingVerdict; /** * Output only. Assessment of this transaction for risk of a stolen * instrument. */ readonly stolenInstrumentVerdict?: GoogleCloudRecaptchaenterpriseV1FraudPreventionAssessmentStolenInstrumentVerdict; /** * Output only. Probability of this transaction being fraudulent. Summarizes * the combined risk of attack vectors below. Values are from 0.0 (lowest) to * 1.0 (highest). */ readonly transactionRisk?: number; } /** * Information about behavioral trust of the transaction. */ export interface GoogleCloudRecaptchaenterpriseV1FraudPreventionAssessmentBehavioralTrustVerdict { /** * Output only. Probability of this transaction attempt being executed in a * behaviorally trustworthy way. Values are from 0.0 (lowest) to 1.0 * (highest). */ readonly trust?: number; } /** * Information about card testing fraud, where an adversary is testing * fraudulently obtained cards or brute forcing their details. */ export interface GoogleCloudRecaptchaenterpriseV1FraudPreventionAssessmentCardTestingVerdict { /** * Output only. Probability of this transaction attempt being part of a card * testing attack. Values are from 0.0 (lowest) to 1.0 (highest). */ readonly risk?: number; } /** * Information about stolen instrument fraud, where the user is not the * legitimate owner of the instrument being used for the purchase. */ export interface GoogleCloudRecaptchaenterpriseV1FraudPreventionAssessmentStolenInstrumentVerdict { /** * Output only. Probability of this transaction being executed with a stolen * instrument. Values are from 0.0 (lowest) to 1.0 (highest). */ readonly risk?: number; } /** * Fraud signals describing users and cards involved in the transaction. */ export interface GoogleCloudRecaptchaenterpriseV1FraudSignals { /** * Output only. Signals describing the payment card or cards used in this * transaction. */ readonly cardSignals?: GoogleCloudRecaptchaenterpriseV1FraudSignalsCardSignals; /** * Output only. Signals describing the end user in this transaction. */ readonly userSignals?: GoogleCloudRecaptchaenterpriseV1FraudSignalsUserSignals; } /** * Signals describing the payment card used in this transaction. */ export interface GoogleCloudRecaptchaenterpriseV1FraudSignalsCardSignals { /** * Output only. The labels for the payment card in this transaction. */ readonly cardLabels?: | "CARD_LABEL_UNSPECIFIED" | "PREPAID" | "VIRTUAL" | "UNEXPECTED_LOCATION"[]; } /** * Signals describing the user involved in this transaction. */ export interface GoogleCloudRecaptchaenterpriseV1FraudSignalsUserSignals { /** * Output only. This user (based on email, phone, and other identifiers) has * been seen on the internet for at least this number of days. */ readonly activeDaysLowerBound?: number; /** * Output only. Likelihood (from 0.0 to 1.0) this user includes synthetic * components in their identity, such as a randomly generated email address, * temporary phone number, or fake shipping address. */ readonly syntheticRisk?: number; } /** * Settings specific to keys that can be used by iOS apps. */ export interface GoogleCloudRecaptchaenterpriseV1IOSKeySettings { /** * Optional. If set to true, allowed_bundle_ids are not enforced. */ allowAllBundleIds?: boolean; /** * Optional. iOS bundle ids of apps allowed to use the key. Example: * 'com.companyname.productname.appname' */ allowedBundleIds?: string[]; /** * Optional. Apple Developer account details for the app that is protected by * the reCAPTCHA Key. reCAPTCHA leverages platform-specific checks like Apple * App Attest and Apple DeviceCheck to protect your app from abuse. Providing * these fields allows reCAPTCHA to get a better assessment of the integrity * of your app. */ appleDeveloperId?: GoogleCloudRecaptchaenterpriseV1AppleDeveloperId; } /** * Information about the IP or IP range override. */ export interface GoogleCloudRecaptchaenterpriseV1IpOverrideData { /** * Required. The IP address to override (can be IPv4, IPv6 or CIDR). The IP * override must be a valid IPv4 or IPv6 address, or a CIDR range. The IP * override must be a public IP address. Example of IPv4: 168.192.5.6 Example * of IPv6: 2001:0000:130F:0000:0000:09C0:876A:130B Example of IPv4 with CIDR: * 168.192.5.0/24 Example of IPv6 with CIDR: 2001:0DB8:1234::/48 */ ip?: string; /** * Required. Describes the type of IP override. */ overrideType?: | "OVERRIDE_TYPE_UNSPECIFIED" | "ALLOW"; } /** * A key used to identify and configure applications (web and/or mobile) that * use reCAPTCHA Enterprise. */ export interface GoogleCloudRecaptchaenterpriseV1Key { /** * Settings for keys that can be used by Android apps. */ androidSettings?: GoogleCloudRecaptchaenterpriseV1AndroidKeySettings; /** * Output only. The timestamp corresponding to the creation of this key. */ readonly createTime?: Date; /** * Required. Human-readable display name of this key. Modifiable by user. */ displayName?: string; /** * Settings for keys that can be used by reCAPTCHA Express. */ expressSettings?: GoogleCloudRecaptchaenterpriseV1ExpressKeySettings; /** * Settings for keys that can be used by iOS apps. */ iosSettings?: GoogleCloudRecaptchaenterpriseV1IOSKeySettings; /** * Optional. See [Creating and managing labels] * (https://cloud.google.com/recaptcha/docs/labels). */ labels?: { [key: string]: string }; /** * Identifier. The resource name for the Key in the format * `projects/{project}/keys/{key}`. */ name?: string; /** * Optional. Options for user acceptance testing. */ testingOptions?: GoogleCloudRecaptchaenterpriseV1TestingOptions; /** * Optional. Settings for WAF */ wafSettings?: GoogleCloudRecaptchaenterpriseV1WafSettings; /** * Settings for keys that can be used by websites. */ webSettings?: GoogleCloudRecaptchaenterpriseV1WebKeySettings; } /** * Response to request to list firewall policies belonging to a project. */ export interface GoogleCloudRecaptchaenterpriseV1ListFirewallPoliciesResponse { /** * Policy details. */ firewallPolicies?: GoogleCloudRecaptchaenterpriseV1FirewallPolicy[]; /** * Token to retrieve the next page of results. It is set to empty if no * policies remain in results. */ nextPageToken?: string; } /** * Response for ListIpOverrides. */ export interface GoogleCloudRecaptchaenterpriseV1ListIpOverridesResponse { /** * IP Overrides details. */ ipOverrides?: GoogleCloudRecaptchaenterpriseV1IpOverrideData[]; /** * Token to retrieve the next page of results. If this field is empty, no * keys remain in the results. */ nextPageToken?: string; } /** * Response to request to list keys in a project. */ export interface GoogleCloudRecaptchaenterpriseV1ListKeysResponse { /** * Key details. */ keys?: GoogleCloudRecaptchaenterpriseV1Key[]; /** * Token to retrieve the next page of results. It is set to empty if no keys * remain in results. */ nextPageToken?: string; } /** * The response to a `ListRelatedAccountGroupMemberships` call. */ export interface GoogleCloudRecaptchaenterpriseV1ListRelatedAccountGroupMembershipsResponse { /** * A token, which can be sent as `page_token` to retrieve the next page. If * this field is omitted, there are no subsequent pages. */ nextPageToken?: string; /** * The memberships listed by the query. */ relatedAccountGroupMemberships?: GoogleCloudRecaptchaenterpriseV1RelatedAccountGroupMembership[]; } function serializeGoogleCloudRecaptchaenterpriseV1ListRelatedAccountGroupMembershipsResponse(data: any): GoogleCloudRecaptchaenterpriseV1ListRelatedAccountGroupMembershipsResponse { return { ...data, relatedAccountGroupMemberships: data["relatedAccountGroupMemberships"] !== undefined ? data["relatedAccountGroupMemberships"].map((item: any) => (serializeGoogleCloudRecaptchaenterpriseV1RelatedAccountGroupMembership(item))) : undefined, }; } function deserializeGoogleCloudRecaptchaenterpriseV1ListRelatedAccountGroupMembershipsResponse(data: any): GoogleCloudRecaptchaenterpriseV1ListRelatedAccountGroupMembershipsResponse { return { ...data, relatedAccountGroupMemberships: data["relatedAccountGroupMemberships"] !== undefined ? data["relatedAccountGroupMemberships"].map((item: any) => (deserializeGoogleCloudRecaptchaenterpriseV1RelatedAccountGroupMembership(item))) : undefined, }; } /** * The response to a `ListRelatedAccountGroups` call. */ export interface GoogleCloudRecaptchaenterpriseV1ListRelatedAccountGroupsResponse { /** * A token, which can be sent as `page_token` to retrieve the next page. If * this field is omitted, there are no subsequent pages. */ nextPageToken?: string; /** * The groups of related accounts listed by the query. */ relatedAccountGroups?: GoogleCloudRecaptchaenterpriseV1RelatedAccountGroup[]; } /** * Metrics for a single Key. */ export interface GoogleCloudRecaptchaenterpriseV1Metrics { /** * Metrics are continuous and in order by dates, and in the granularity of * day. Only challenge-based keys (CHECKBOX, INVISIBLE) have challenge-based * data. */ challengeMetrics?: GoogleCloudRecaptchaenterpriseV1ChallengeMetrics[]; /** * Output only. Identifier. The name of the metrics, in the format * `projects/{project}/keys/{key}/metrics`. */ readonly name?: string; /** * Metrics are continuous and in order by dates, and in the granularity of * day. All Key types should have score-based data. */ scoreMetrics?: GoogleCloudRecaptchaenterpriseV1ScoreMetrics[]; /** * Inclusive start time aligned to a day (UTC). */ startTime?: Date; } function serializeGoogleCloudRecaptchaenterpriseV1Metrics(data: any): GoogleCloudRecaptchaenterpriseV1Metrics { return { ...data, challengeMetrics: data["challengeMetrics"] !== undefined ? data["challengeMetrics"].map((item: any) => (serializeGoogleCloudRecaptchaenterpriseV1ChallengeMetrics(item))) : undefined, scoreMetrics: data["scoreMetrics"] !== undefined ? data["scoreMetrics"].map((item: any) => (serializeGoogleCloudRecaptchaenterpriseV1ScoreMetrics(item))) : undefined, startTime: data["startTime"] !== undefined ? data["startTime"].toISOString() : undefined, }; } function deserializeGoogleCloudRecaptchaenterpriseV1Metrics(data: any): GoogleCloudRecaptchaenterpriseV1Metrics { return { ...data, challengeMetrics: data["challengeMetrics"] !== undefined ? data["challengeMetrics"].map((item: any) => (deserializeGoogleCloudRecaptchaenterpriseV1ChallengeMetrics(item))) : undefined, scoreMetrics: data["scoreMetrics"] !== undefined ? data["scoreMetrics"].map((item: any) => (deserializeGoogleCloudRecaptchaenterpriseV1ScoreMetrics(item))) : undefined, startTime: data["startTime"] !== undefined ? new Date(data["startTime"]) : undefined, }; } /** * The migrate key request message. */ export interface GoogleCloudRecaptchaenterpriseV1MigrateKeyRequest { /** * Optional. If true, skips the billing check. A reCAPTCHA Enterprise key or * migrated key behaves differently than a reCAPTCHA (non-Enterprise version) * key when you reach a quota limit (see * https://cloud.google.com/recaptcha/quotas#quota_limit). To avoid any * disruption of your usage, we check that a billing account is present. If * your usage of reCAPTCHA is under the free quota, you can safely skip the * billing check and proceed with the migration. See * https://cloud.google.com/recaptcha/docs/billing-information. */ skipBillingCheck?: boolean; } /** * Assessment for Phone Fraud */ export interface GoogleCloudRecaptchaenterpriseV1PhoneFraudAssessment { /** * Output only. Assessment of this phone event for risk of SMS toll fraud. */ readonly smsTollFraudVerdict?: GoogleCloudRecaptchaenterpriseV1SmsTollFraudVerdict; } /** * Private password leak verification info. */ export interface GoogleCloudRecaptchaenterpriseV1PrivatePasswordLeakVerification { /** * 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` */ readonly encryptedLeakMatchPrefixes?: Uint8Array[]; /** * Optional. Encrypted Scrypt hash of the canonicalized username+password. It * is re-encrypted by the server and returned through * `reencrypted_user_credentials_hash`. */ encryptedUserCredentialsHash?: Uint8Array; /** * Required. 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. */ lookupHashPrefix?: Uint8Array; /** * 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`. */ readonly reencryptedUserCredentialsHash?: Uint8Array; } function serializeGoogleCloudRecaptchaenterpriseV1PrivatePasswordLeakVerification(data: any): GoogleCloudRecaptchaenterpriseV1PrivatePasswordLeakVerification { return { ...data, encryptedUserCredentialsHash: data["encryptedUserCredentialsHash"] !== undefined ? encodeBase64(data["encryptedUserCredentialsHash"]) : undefined, lookupHashPrefix: data["lookupHashPrefix"] !== undefined ? encodeBase64(data["lookupHashPrefix"]) : undefined, }; } function deserializeGoogleCloudRecaptchaenterpriseV1PrivatePasswordLeakVerification(data: any): GoogleCloudRecaptchaenterpriseV1PrivatePasswordLeakVerification { return { ...data, encryptedLeakMatchPrefixes: data["encryptedLeakMatchPrefixes"] !== undefined ? data["encryptedLeakMatchPrefixes"].map((item: any) => (decodeBase64(item as string))) : undefined, encryptedUserCredentialsHash: data["encryptedUserCredentialsHash"] !== undefined ? decodeBase64(data["encryptedUserCredentialsHash"] as string) : undefined, lookupHashPrefix: data["lookupHashPrefix"] !== undefined ? decodeBase64(data["lookupHashPrefix"] as string) : undefined, reencryptedUserCredentialsHash: data["reencryptedUserCredentialsHash"] !== undefined ? decodeBase64(data["reencryptedUserCredentialsHash"] as string) : undefined, }; } /** * A group of related accounts. */ export interface GoogleCloudRecaptchaenterpriseV1RelatedAccountGroup { /** * Required. Identifier. The resource name for the related account group in * the format * `projects/{project}/relatedaccountgroups/{related_account_group}`. */ name?: string; } /** * A membership in a group of related accounts. */ export interface GoogleCloudRecaptchaenterpriseV1RelatedAccountGroupMembership { /** * The unique stable account identifier of the member. The identifier * corresponds to an `account_id` provided in a previous `CreateAssessment` or * `AnnotateAssessment` call. */ accountId?: string; /** * Deprecated: use `account_id` instead. The unique stable hashed account * identifier of the member. The identifier corresponds to a * `hashed_account_id` provided in a previous `CreateAssessment` or * `AnnotateAssessment` call. */ hashedAccountId?: Uint8Array; /** * Required. Identifier. The resource name for this membership in the format * `projects/{project}/relatedaccountgroups/{relatedaccountgroup}/memberships/{membership}`. */ name?: string; } function serializeGoogleCloudRecaptchaenterpriseV1RelatedAccountGroupMembership(data: any): GoogleCloudRecaptchaenterpriseV1RelatedAccountGroupMembership { return { ...data, hashedAccountId: data["hashedAccountId"] !== undefined ? encodeBase64(data["hashedAccountId"]) : undefined, }; } function deserializeGoogleCloudRecaptchaenterpriseV1RelatedAccountGroupMembership(data: any): GoogleCloudRecaptchaenterpriseV1RelatedAccountGroupMembership { return { ...data, hashedAccountId: data["hashedAccountId"] !== undefined ? decodeBase64(data["hashedAccountId"] as string) : undefined, }; } /** * The RemoveIpOverride request message. */ export interface GoogleCloudRecaptchaenterpriseV1RemoveIpOverrideRequest { /** * Required. IP override to be removed from the key. */ ipOverrideData?: GoogleCloudRecaptchaenterpriseV1IpOverrideData; } /** * Response for RemoveIpOverride. */ export interface GoogleCloudRecaptchaenterpriseV1RemoveIpOverrideResponse { } /** * The reorder firewall policies request message. */ export interface GoogleCloudRecaptchaenterpriseV1ReorderFirewallPoliciesRequest { /** * Required. A list containing all policy names, in the new order. Each name * is in the format `projects/{project}/firewallpolicies/{firewallpolicy}`. */ names?: string[]; } /** * The reorder firewall policies response message. */ export interface GoogleCloudRecaptchaenterpriseV1ReorderFirewallPoliciesResponse { } /** * Secret key is used only in legacy reCAPTCHA. It must be used in a 3rd party * integration with legacy reCAPTCHA. */ export interface GoogleCloudRecaptchaenterpriseV1RetrieveLegacySecretKeyResponse { /** * 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. */ legacySecretKey?: string; } /** * Risk analysis result for an event. */ export interface GoogleCloudRecaptchaenterpriseV1RiskAnalysis { /** * Output only. Challenge information for SCORE_AND_CHALLENGE and INVISIBLE * keys */ readonly challenge?: | "CHALLENGE_UNSPECIFIED" | "NOCAPTCHA" | "PASSED" | "FAILED"; /** * Output only. Extended verdict reasons to be used for experimentation only. * The set of possible reasons is subject to change. */ readonly extendedVerdictReasons?: string[]; /** * Output only. Reasons contributing to the risk analysis verdict. */ readonly reasons?: | "CLASSIFICATION_REASON_UNSPECIFIED" | "AUTOMATION" | "UNEXPECTED_ENVIRONMENT" | "TOO_MUCH_TRAFFIC" | "UNEXPECTED_USAGE_PATTERNS" | "LOW_CONFIDENCE_SCORE" | "SUSPECTED_CARDING" | "SUSPECTED_CHARGEBACK"[]; /** * Output only. Legitimate event score from 0.0 to 1.0. (1.0 means very * likely legitimate traffic while 0.0 means very likely non-legitimate * traffic). */ readonly score?: number; } /** * Score distribution. */ export interface GoogleCloudRecaptchaenterpriseV1ScoreDistribution { /** * Map key is score value multiplied by 100. The scores are discrete values * between [0, 1]. The maximum number of buckets is on order of a few dozen, * but typically much lower (ie. 10). */ scoreBuckets?: { [key: string]: bigint }; } function serializeGoogleCloudRecaptchaenterpriseV1ScoreDistribution(data: any): GoogleCloudRecaptchaenterpriseV1ScoreDistribution { return { ...data, scoreBuckets: data["scoreBuckets"] !== undefined ? Object.fromEntries(Object.entries(data["scoreBuckets"]).map(([k, v]: [string, any]) => ([k, String(v)]))) : undefined, }; } function deserializeGoogleCloudRecaptchaenterpriseV1ScoreDistribution(data: any): GoogleCloudRecaptchaenterpriseV1ScoreDistribution { return { ...data, scoreBuckets: data["scoreBuckets"] !== undefined ? Object.fromEntries(Object.entries(data["scoreBuckets"]).map(([k, v]: [string, any]) => ([k, BigInt(v)]))) : undefined, }; } /** * Metrics related to scoring. */ export interface GoogleCloudRecaptchaenterpriseV1ScoreMetrics { /** * Action-based metrics. The map key is the action name which specified by * the site owners at time of the "execute" client-side call. */ actionMetrics?: { [key: string]: GoogleCloudRecaptchaenterpriseV1ScoreDistribution }; /** * Aggregated score metrics for all traffic. */ overallMetrics?: GoogleCloudRecaptchaenterpriseV1ScoreDistribution; } function serializeGoogleCloudRecaptchaenterpriseV1ScoreMetrics(data: any): GoogleCloudRecaptchaenterpriseV1ScoreMetrics { return { ...data, actionMetrics: data["actionMetrics"] !== undefined ? Object.fromEntries(Object.entries(data["actionMetrics"]).map(([k, v]: [string, any]) => ([k, serializeGoogleCloudRecaptchaenterpriseV1ScoreDistribution(v)]))) : undefined, overallMetrics: data["overallMetrics"] !== undefined ? serializeGoogleCloudRecaptchaenterpriseV1ScoreDistribution(data["overallMetrics"]) : undefined, }; } function deserializeGoogleCloudRecaptchaenterpriseV1ScoreMetrics(data: any): GoogleCloudRecaptchaenterpriseV1ScoreMetrics { return { ...data, actionMetrics: data["actionMetrics"] !== undefined ? Object.fromEntries(Object.entries(data["actionMetrics"]).map(([k, v]: [string, any]) => ([k, deserializeGoogleCloudRecaptchaenterpriseV1ScoreDistribution(v)]))) : undefined, overallMetrics: data["overallMetrics"] !== undefined ? deserializeGoogleCloudRecaptchaenterpriseV1ScoreDistribution(data["overallMetrics"]) : undefined, }; } /** * The request message to search related account group memberships. */ export interface GoogleCloudRecaptchaenterpriseV1SearchRelatedAccountGroupMembershipsRequest { /** * Optional. The unique stable account identifier used to search connections. * The identifier should correspond to an `account_id` provided in a previous * `CreateAssessment` or `AnnotateAssessment` call. Either hashed_account_id * or account_id must be set, but not both. */ accountId?: string; /** * Optional. Deprecated: use `account_id` instead. The unique stable hashed * account identifier used to search connections. The identifier should * correspond to a `hashed_account_id` provided in a previous * `CreateAssessment` or `AnnotateAssessment` call. Either hashed_account_id * or account_id must be set, but not both. */ hashedAccountId?: Uint8Array; /** * 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. */ pageSize?: number; /** * Optional. A page token, received from a previous * `SearchRelatedAccountGroupMemberships` call. Provide this to retrieve the * subsequent page. When paginating, all other parameters provided to * `SearchRelatedAccountGroupMemberships` must match the call that provided * the page token. */ pageToken?: string; } function serializeGoogleCloudRecaptchaenterpriseV1SearchRelatedAccountGroupMembershipsRequest(data: any): GoogleCloudRecaptchaenterpriseV1SearchRelatedAccountGroupMembershipsRequest { return { ...data, hashedAccountId: data["hashedAccountId"] !== undefined ? encodeBase64(data["hashedAccountId"]) : undefined, }; } function deserializeGoogleCloudRecaptchaenterpriseV1SearchRelatedAccountGroupMembershipsRequest(data: any): GoogleCloudRecaptchaenterpriseV1SearchRelatedAccountGroupMembershipsRequest { return { ...data, hashedAccountId: data["hashedAccountId"] !== undefined ? decodeBase64(data["hashedAccountId"] as string) : undefined, }; } /** * The response to a `SearchRelatedAccountGroupMemberships` call. */ export interface GoogleCloudRecaptchaenterpriseV1SearchRelatedAccountGroupMembershipsResponse { /** * A token, which can be sent as `page_token` to retrieve the next page. If * this field is omitted, there are no subsequent pages. */ nextPageToken?: string; /** * The queried memberships. */ relatedAccountGroupMemberships?: GoogleCloudRecaptchaenterpriseV1RelatedAccountGroupMembership[]; } function serializeGoogleCloudRecaptchaenterpriseV1SearchRelatedAccountGroupMembershipsResponse(data: any): GoogleCloudRecaptchaenterpriseV1SearchRelatedAccountGroupMembershipsResponse { return { ...data, relatedAccountGroupMemberships: data["relatedAccountGroupMemberships"] !== undefined ? data["relatedAccountGroupMemberships"].map((item: any) => (serializeGoogleCloudRecaptchaenterpriseV1RelatedAccountGroupMembership(item))) : undefined, }; } function deserializeGoogleCloudRecaptchaenterpriseV1SearchRelatedAccountGroupMembershipsResponse(data: any): GoogleCloudRecaptchaenterpriseV1SearchRelatedAccountGroupMembershipsResponse { return { ...data, relatedAccountGroupMemberships: data["relatedAccountGroupMemberships"] !== undefined ? data["relatedAccountGroupMemberships"].map((item: any) => (deserializeGoogleCloudRecaptchaenterpriseV1RelatedAccountGroupMembership(item))) : undefined, }; } /** * Information about SMS toll fraud. */ export interface GoogleCloudRecaptchaenterpriseV1SmsTollFraudVerdict { /** * Output only. Reasons contributing to the SMS toll fraud verdict. */ readonly reasons?: | "SMS_TOLL_FRAUD_REASON_UNSPECIFIED" | "INVALID_PHONE_NUMBER"[]; /** * Output only. Probability of an SMS event being fraudulent. Values are from * 0.0 (lowest) to 1.0 (highest). */ readonly risk?: number; } /** * Options for user acceptance testing. */ export interface GoogleCloudRecaptchaenterpriseV1TestingOptions { /** * Optional. For challenge-based keys only (CHECKBOX, INVISIBLE), all * challenge requests for this site return nocaptcha if NOCAPTCHA, or an * unsolvable challenge if CHALLENGE. */ testingChallenge?: | "TESTING_CHALLENGE_UNSPECIFIED" | "NOCAPTCHA" | "UNSOLVABLE_CHALLENGE"; /** * Optional. All assessments for this Key return this score. Must be between * 0 (likely not legitimate) and 1 (likely legitimate) inclusive. */ testingScore?: number; } /** * Properties of the provided event token. */ export interface GoogleCloudRecaptchaenterpriseV1TokenProperties { /** * Output only. Action name provided at token generation. */ readonly action?: string; /** * Output only. The name of the Android package with which the token was * generated (Android keys only). */ readonly androidPackageName?: string; /** * Output only. The timestamp corresponding to the generation of the token. */ readonly createTime?: Date; /** * Output only. The hostname of the page on which the token was generated * (Web keys only). */ readonly hostname?: string; /** * Output only. Reason associated with the response when valid = false. */ readonly invalidReason?: | "INVALID_REASON_UNSPECIFIED" | "UNKNOWN_INVALID_REASON" | "MALFORMED" | "EXPIRED" | "DUPE" | "MISSING" | "BROWSER_ERROR"; /** * Output only. The ID of the iOS bundle with which the token was generated * (iOS keys only). */ readonly iosBundleId?: string; /** * Output only. Whether the provided user response token is valid. When valid * = false, the reason could be specified in invalid_reason or it could also * be due to a user failing to solve a challenge or a sitekey mismatch (i.e * the sitekey used to generate the token was different than the one specified * in the assessment). */ readonly valid?: boolean; } /** * Transaction data associated with a payment protected by reCAPTCHA * Enterprise. */ export interface GoogleCloudRecaptchaenterpriseV1TransactionData { /** * Optional. Address associated with the payment method when applicable. */ billingAddress?: GoogleCloudRecaptchaenterpriseV1TransactionDataAddress; /** * Optional. The Bank Identification Number - generally the first 6 or 8 * digits of the card. */ cardBin?: string; /** * Optional. The last four digits of the card. */ cardLastFour?: string; /** * Optional. The currency code in ISO-4217 format. */ currencyCode?: string; /** * Optional. Information about the payment gateway's response to the * transaction. */ gatewayInfo?: GoogleCloudRecaptchaenterpriseV1TransactionDataGatewayInfo; /** * Optional. Items purchased in this transaction. */ items?: GoogleCloudRecaptchaenterpriseV1TransactionDataItem[]; /** * Optional. Information about the user or users fulfilling the transaction. */ merchants?: GoogleCloudRecaptchaenterpriseV1TransactionDataUser[]; /** * Optional. The payment method for the transaction. The allowed values are: * * credit-card * debit-card * gift-card * processor-{name} (If a third-party * is used, for example, processor-paypal) * custom-{name} (If an alternative * method is used, for example, custom-crypto) */ paymentMethod?: string; /** * Optional. Destination address if this transaction involves shipping a * physical item. */ shippingAddress?: GoogleCloudRecaptchaenterpriseV1TransactionDataAddress; /** * Optional. The value of shipping in the specified currency. 0 for free or * no shipping. */ shippingValue?: number; /** * Unique identifier for the transaction. This custom identifier can be used * to reference this transaction in the future, for example, labeling a refund * or chargeback event. Two attempts at the same transaction should use the * same transaction id. */ transactionId?: string; /** * Optional. Information about the user paying/initiating the transaction. */ user?: GoogleCloudRecaptchaenterpriseV1TransactionDataUser; /** * Optional. The decimal value of the transaction in the specified currency. */ value?: number; } function serializeGoogleCloudRecaptchaenterpriseV1TransactionData(data: any): GoogleCloudRecaptchaenterpriseV1TransactionData { return { ...data, items: data["items"] !== undefined ? data["items"].map((item: any) => (serializeGoogleCloudRecaptchaenterpriseV1TransactionDataItem(item))) : undefined, merchants: data["merchants"] !== undefined ? data["merchants"].map((item: any) => (serializeGoogleCloudRecaptchaenterpriseV1TransactionDataUser(item))) : undefined, user: data["user"] !== undefined ? serializeGoogleCloudRecaptchaenterpriseV1TransactionDataUser(data["user"]) : undefined, }; } function deserializeGoogleCloudRecaptchaenterpriseV1TransactionData(data: any): GoogleCloudRecaptchaenterpriseV1TransactionData { return { ...data, items: data["items"] !== undefined ? data["items"].map((item: any) => (deserializeGoogleCloudRecaptchaenterpriseV1TransactionDataItem(item))) : undefined, merchants: data["merchants"] !== undefined ? data["merchants"].map((item: any) => (deserializeGoogleCloudRecaptchaenterpriseV1TransactionDataUser(item))) : undefined, user: data["user"] !== undefined ? deserializeGoogleCloudRecaptchaenterpriseV1TransactionDataUser(data["user"]) : undefined, }; } /** * Structured address format for billing and shipping addresses. */ export interface GoogleCloudRecaptchaenterpriseV1TransactionDataAddress { /** * Optional. The first lines of the address. The first line generally * contains the street name and number, and further lines may include * information such as an apartment number. */ address?: string[]; /** * Optional. The state, province, or otherwise administrative area of the * address. */ administrativeArea?: string; /** * Optional. The town/city of the address. */ locality?: string; /** * Optional. The postal or ZIP code of the address. */ postalCode?: string; /** * Optional. The recipient name, potentially including information such as * "care of". */ recipient?: string; /** * Optional. The CLDR country/region of the address. */ regionCode?: string; } /** * Details about the transaction from the gateway. */ export interface GoogleCloudRecaptchaenterpriseV1TransactionDataGatewayInfo { /** * Optional. AVS response code from the gateway (available only when * reCAPTCHA Enterprise is called after authorization). */ avsResponseCode?: string; /** * Optional. CVV response code from the gateway (available only when * reCAPTCHA Enterprise is called after authorization). */ cvvResponseCode?: string; /** * Optional. Gateway response code describing the state of the transaction. */ gatewayResponseCode?: string; /** * Optional. Name of the gateway service (for example, stripe, square, * paypal). */ name?: string; } /** * Line items being purchased in this transaction. */ export interface GoogleCloudRecaptchaenterpriseV1TransactionDataItem { /** * Optional. When a merchant is specified, its corresponding account_id. * Necessary to populate marketplace-style transactions. */ merchantAccountId?: string; /** * Optional. The full name of the item. */ name?: string; /** * Optional. The quantity of this item that is being purchased. */ quantity?: bigint; /** * Optional. The value per item that the user is paying, in the transaction * currency, after discounts. */ value?: number; } function serializeGoogleCloudRecaptchaenterpriseV1TransactionDataItem(data: any): GoogleCloudRecaptchaenterpriseV1TransactionDataItem { return { ...data, quantity: data["quantity"] !== undefined ? String(data["quantity"]) : undefined, }; } function deserializeGoogleCloudRecaptchaenterpriseV1TransactionDataItem(data: any): GoogleCloudRecaptchaenterpriseV1TransactionDataItem { return { ...data, quantity: data["quantity"] !== undefined ? BigInt(data["quantity"]) : undefined, }; } /** * Details about a user's account involved in the transaction. */ export interface GoogleCloudRecaptchaenterpriseV1TransactionDataUser { /** * Optional. Unique account identifier for this user. If using account * defender, this should match the hashed_account_id field. Otherwise, a * unique and persistent identifier for this account. */ accountId?: string; /** * Optional. The epoch milliseconds of the user's account creation. */ creationMs?: bigint; /** * Optional. The email address of the user. */ email?: string; /** * Optional. Whether the email has been verified to be accessible by the user * (OTP or similar). */ emailVerified?: boolean; /** * Optional. The phone number of the user, with country code. */ phoneNumber?: string; /** * Optional. Whether the phone number has been verified to be accessible by * the user (OTP or similar). */ phoneVerified?: boolean; } function serializeGoogleCloudRecaptchaenterpriseV1TransactionDataUser(data: any): GoogleCloudRecaptchaenterpriseV1TransactionDataUser { return { ...data, creationMs: data["creationMs"] !== undefined ? String(data["creationMs"]) : undefined, }; } function deserializeGoogleCloudRecaptchaenterpriseV1TransactionDataUser(data: any): GoogleCloudRecaptchaenterpriseV1TransactionDataUser { return { ...data, creationMs: data["creationMs"] !== undefined ? BigInt(data["creationMs"]) : undefined, }; } /** * Describes an event in the lifecycle of a payment transaction. */ export interface GoogleCloudRecaptchaenterpriseV1TransactionEvent { /** * Optional. Timestamp when this transaction event occurred; otherwise * assumed to be the time of the API call. */ eventTime?: Date; /** * Optional. The type of this transaction event. */ eventType?: | "TRANSACTION_EVENT_TYPE_UNSPECIFIED" | "MERCHANT_APPROVE" | "MERCHANT_DENY" | "MANUAL_REVIEW" | "AUTHORIZATION" | "AUTHORIZATION_DECLINE" | "PAYMENT_CAPTURE" | "PAYMENT_CAPTURE_DECLINE" | "CANCEL" | "CHARGEBACK_INQUIRY" | "CHARGEBACK_ALERT" | "FRAUD_NOTIFICATION" | "CHARGEBACK" | "CHARGEBACK_REPRESENTMENT" | "CHARGEBACK_REVERSE" | "REFUND_REQUEST" | "REFUND_DECLINE" | "REFUND" | "REFUND_REVERSE"; /** * Optional. The reason or standardized code that corresponds with this * transaction event, if one exists. For example, a CHARGEBACK event with code * 6005. */ reason?: string; /** * Optional. The value that corresponds with this transaction event, if one * exists. For example, a refund event where $5.00 was refunded. Currency is * obtained from the original transaction data. */ value?: number; } function serializeGoogleCloudRecaptchaenterpriseV1TransactionEvent(data: any): GoogleCloudRecaptchaenterpriseV1TransactionEvent { return { ...data, eventTime: data["eventTime"] !== undefined ? data["eventTime"].toISOString() : undefined, }; } function deserializeGoogleCloudRecaptchaenterpriseV1TransactionEvent(data: any): GoogleCloudRecaptchaenterpriseV1TransactionEvent { return { ...data, eventTime: data["eventTime"] !== undefined ? new Date(data["eventTime"]) : undefined, }; } /** * An identifier associated with a user. */ export interface GoogleCloudRecaptchaenterpriseV1UserId { /** * Optional. An email address. */ email?: string; /** * Optional. A phone number. Should use the E.164 format. */ phoneNumber?: string; /** * Optional. A unique username, if different from all the other identifiers * and `account_id` that are provided. Can be a unique login handle or display * name for a user. */ username?: string; } /** * User information associated with a request protected by reCAPTCHA * Enterprise. */ export interface GoogleCloudRecaptchaenterpriseV1UserInfo { /** * Optional. For logged-in requests or login/registration requests, the * unique account identifier associated with this user. You can use the * username if it is stable (meaning it is the same for every request * associated with the same user), or any stable user ID of your choice. Leave * blank for non logged-in actions or guest checkout. */ accountId?: string; /** * Optional. Creation time for this account associated with this user. Leave * blank for non logged-in actions, guest checkout, or when there is no * account associated with the current user. */ createAccountTime?: Date; /** * Optional. Identifiers associated with this user or request. */ userIds?: GoogleCloudRecaptchaenterpriseV1UserId[]; } function serializeGoogleCloudRecaptchaenterpriseV1UserInfo(data: any): GoogleCloudRecaptchaenterpriseV1UserInfo { return { ...data, createAccountTime: data["createAccountTime"] !== undefined ? data["createAccountTime"].toISOString() : undefined, }; } function deserializeGoogleCloudRecaptchaenterpriseV1UserInfo(data: any): GoogleCloudRecaptchaenterpriseV1UserInfo { return { ...data, createAccountTime: data["createAccountTime"] !== undefined ? new Date(data["createAccountTime"]) : undefined, }; } /** * Settings specific to keys that can be used for WAF (Web Application * Firewall). */ export interface GoogleCloudRecaptchaenterpriseV1WafSettings { /** * Required. The WAF feature for which this key is enabled. */ wafFeature?: | "WAF_FEATURE_UNSPECIFIED" | "CHALLENGE_PAGE" | "SESSION_TOKEN" | "ACTION_TOKEN" | "EXPRESS"; /** * Required. The WAF service that uses this key. */ wafService?: | "WAF_SERVICE_UNSPECIFIED" | "CA" | "FASTLY" | "CLOUDFLARE" | "AKAMAI"; } /** * Settings specific to keys that can be used by websites. */ export interface GoogleCloudRecaptchaenterpriseV1WebKeySettings { /** * Optional. If set to true, it means allowed_domains are not enforced. */ allowAllDomains?: boolean; /** * Optional. If set to true, the key can be used on AMP (Accelerated Mobile * Pages) websites. This is supported only for the SCORE integration type. */ allowAmpTraffic?: boolean; /** * Optional. Domains or subdomains of websites allowed to use the key. All * subdomains of an allowed domain are automatically allowed. A valid domain * requires a host and must not include any path, port, query or fragment. * Examples: 'example.com' or 'subdomain.example.com' */ allowedDomains?: string[]; /** * Optional. Settings for the frequency and difficulty at which this key * triggers captcha challenges. This should only be specified for * IntegrationTypes CHECKBOX and INVISIBLE and SCORE_AND_CHALLENGE. */ challengeSecurityPreference?: | "CHALLENGE_SECURITY_PREFERENCE_UNSPECIFIED" | "USABILITY" | "BALANCE" | "SECURITY"; /** * Required. Describes how this key is integrated with the website. */ integrationType?: | "INTEGRATION_TYPE_UNSPECIFIED" | "SCORE" | "CHECKBOX" | "INVISIBLE"; } /** * A generic empty message that you can re-use to avoid defining duplicated * empty messages in your APIs. A typical example is to use it as the request or * the response type of an API method. For instance: service Foo { rpc * Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } */ export interface GoogleProtobufEmpty { } /** * The `Status` type defines a logical error model that is suitable for * different programming environments, including REST APIs and RPC APIs. It is * used by [gRPC](https://github.com/grpc). Each `Status` message contains three * pieces of data: error code, error message, and error details. You can find * out more about this error model and how to work with it in the [API Design * Guide](https://cloud.google.com/apis/design/errors). */ export interface GoogleRpcStatus { /** * The status code, which should be an enum value of google.rpc.Code. */ code?: number; /** * A list of messages that carry the error details. There is a common set of * message types for APIs to use. */ details?: { [key: string]: any }[]; /** * A developer-facing error message, which should be in English. Any * user-facing error message should be localized and sent in the * google.rpc.Status.details field, or localized by the client. */ message?: string; } /** * Additional options for reCAPTCHAEnterprise#projectsFirewallpoliciesList. */ export interface ProjectsFirewallpoliciesListOptions { /** * Optional. The maximum number of policies to return. Default is 10. Max * limit is 1000. */ pageSize?: number; /** * Optional. The next_page_token value returned from a previous. * ListFirewallPoliciesRequest, if any. */ pageToken?: string; } /** * Additional options for reCAPTCHAEnterprise#projectsFirewallpoliciesPatch. */ export interface ProjectsFirewallpoliciesPatchOptions { /** * Optional. The mask to control which fields of the policy get updated. If * the mask is not present, all fields are updated. */ updateMask?: string /* FieldMask */; } function serializeProjectsFirewallpoliciesPatchOptions(data: any): ProjectsFirewallpoliciesPatchOptions { return { ...data, updateMask: data["updateMask"] !== undefined ? data["updateMask"] : undefined, }; } function deserializeProjectsFirewallpoliciesPatchOptions(data: any): ProjectsFirewallpoliciesPatchOptions { return { ...data, updateMask: data["updateMask"] !== undefined ? data["updateMask"] : undefined, }; } /** * Additional options for reCAPTCHAEnterprise#projectsKeysListIpOverrides. */ export interface ProjectsKeysListIpOverridesOptions { /** * Optional. The maximum number of overrides to return. Default is 10. Max * limit is 100. If the number of overrides is less than the page_size, all * overrides are returned. If the page size is more than 100, it is coerced to * 100. */ pageSize?: number; /** * Optional. The next_page_token value returned from a previous * ListIpOverridesRequest, if any. */ pageToken?: string; } /** * Additional options for reCAPTCHAEnterprise#projectsKeysList. */ export interface ProjectsKeysListOptions { /** * Optional. The maximum number of keys to return. Default is 10. Max limit * is 1000. */ pageSize?: number; /** * Optional. The next_page_token value returned from a previous. * ListKeysRequest, if any. */ pageToken?: string; } /** * Additional options for reCAPTCHAEnterprise#projectsKeysPatch. */ export interface ProjectsKeysPatchOptions { /** * Optional. The mask to control which fields of the key get updated. If the * mask is not present, all fields are updated. */ updateMask?: string /* FieldMask */; } function serializeProjectsKeysPatchOptions(data: any): ProjectsKeysPatchOptions { return { ...data, updateMask: data["updateMask"] !== undefined ? data["updateMask"] : undefined, }; } function deserializeProjectsKeysPatchOptions(data: any): ProjectsKeysPatchOptions { return { ...data, updateMask: data["updateMask"] !== undefined ? data["updateMask"] : undefined, }; } /** * Additional options for reCAPTCHAEnterprise#projectsRelatedaccountgroupsList. */ export interface ProjectsRelatedaccountgroupsListOptions { /** * 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. */ pageSize?: number; /** * 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. */ pageToken?: string; } /** * Additional options for * reCAPTCHAEnterprise#projectsRelatedaccountgroupsMembershipsList. */ export interface ProjectsRelatedaccountgroupsMembershipsListOptions { /** * 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. */ pageSize?: number; /** * 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. */ pageToken?: string; } function decodeBase64(b64: string): Uint8Array { const binString = atob(b64); const size = binString.length; const bytes = new Uint8Array(size); for (let i = 0; i < size; i++) { bytes[i] = binString.charCodeAt(i); } return bytes; } const base64abc = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9","+","/"]; /** * CREDIT: https://gist.github.com/enepomnyaschih/72c423f727d395eeaa09697058238727 * Encodes a given Uint8Array, ArrayBuffer or string into RFC4648 base64 representation * @param data */ function encodeBase64(uint8: Uint8Array): string { let result = "", i; const l = uint8.length; for (i = 2; i < l; i += 3) { result += base64abc[uint8[i - 2] >> 2]; result += base64abc[((uint8[i - 2] & 0x03) << 4) | (uint8[i - 1] >> 4)]; result += base64abc[((uint8[i - 1] & 0x0f) << 2) | (uint8[i] >> 6)]; result += base64abc[uint8[i] & 0x3f]; } if (i === l + 1) { // 1 octet yet to write result += base64abc[uint8[i - 2] >> 2]; result += base64abc[(uint8[i - 2] & 0x03) << 4]; result += "=="; } if (i === l) { // 2 octets yet to write result += base64abc[uint8[i - 2] >> 2]; result += base64abc[((uint8[i - 2] & 0x03) << 4) | (uint8[i - 1] >> 4)]; result += base64abc[(uint8[i - 1] & 0x0f) << 2]; result += "="; } return result; }